Commit 3ed2be71 authored by Tariq Saeed's avatar Tariq Saeed Committed by Linus Torvalds

ocfs2: allow for more than one data extent when creating xattr

Orabug: 18108070

ocfs2_xattr_extend_allocation() hits panic when creating xattr during
data extent alloc phase.  The problem occurs if due to local alloc
fragmentation, clusters are spread over multiple extents.  In this case
ocfs2_add_clusters_in_btree() finds no space to store more than one
extent record and therefore fails returning RESTART_META.  The situation
is anticipated for xattr update case but not xattr create case.  This
fix simply ports that code to create case.
Signed-off-by: default avatarTariq Saeed <tariq.x.saeed@oracle.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a35ad97c
...@@ -3200,8 +3200,15 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode, ...@@ -3200,8 +3200,15 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode,
clusters_add += 1; clusters_add += 1;
} }
} else { } else {
meta_add += 1;
credits += OCFS2_XATTR_BLOCK_CREATE_CREDITS; credits += OCFS2_XATTR_BLOCK_CREATE_CREDITS;
if (xi->xi_value_len > OCFS2_XATTR_INLINE_SIZE) {
struct ocfs2_extent_list *el = &def_xv.xv.xr_list;
meta_add += ocfs2_extend_meta_needed(el);
credits += ocfs2_calc_extend_credits(inode->i_sb,
el);
} else {
meta_add += 1;
}
} }
out: out:
if (clusters_need) if (clusters_need)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment