Commit 97aff52a authored by Tao Ma's avatar Tao Ma Committed by Mark Fasheh

ocfs2/xattr: Fix a bug in xattr allocation estimation

When we extend one xattr's value to a large size, the old value size might
be smaller than the size of a value root. In those cases, we still need to
guess the metadata allocation.
Reported-by: default avatarTiger Yang <tiger.yang@oracle.com>
Signed-off-by: default avatarTao Ma <tao.ma@oracle.com>
Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
parent 53ef99ca
...@@ -2270,6 +2270,7 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode, ...@@ -2270,6 +2270,7 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode,
value_size); value_size);
xv = (struct ocfs2_xattr_value_root *) xv = (struct ocfs2_xattr_value_root *)
(base + name_offset + name_len); (base + name_offset + name_len);
value_size = OCFS2_XATTR_ROOT_SIZE;
} else } else
xv = &def_xv.xv; xv = &def_xv.xv;
...@@ -2283,7 +2284,8 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode, ...@@ -2283,7 +2284,8 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode,
&xv->xr_list, &xv->xr_list,
new_clusters - new_clusters -
old_clusters); old_clusters);
goto out; if (value_size >= OCFS2_XATTR_ROOT_SIZE)
goto out;
} }
} else { } else {
/* /*
......
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