From: Ned Bass Date: Fri, 8 Feb 2013 22:09:09 +0000 (-0800) Subject: LU-2786 llite: allow setting pool name via fsetxattr() X-Git-Tag: 2.3.62~42 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=bc5d8ddb32aad8eb382f00a058a59c1ec8de0d20 LU-2786 llite: allow setting pool name via fsetxattr() Setting the pool name in the striping data of a file fails when the fsetxattr() interface is used to store the lustre extended attributes, while using ioctl() works as expected. This is because ll_setxattr() assumes the size of the lustre user metadata structure to be that of the older v1 format which doesn't include a pool name field. Fix this by using the magic number to detect the format version and setting the size accordingly when passing the user data down the stack. Signed-off-by: Ned Bass Change-Id: I6f6969dfaf2149f268d52272f538fee05459697b Reviewed-on: http://review.whamcloud.com/5313 Reviewed-by: Andreas Dilger Tested-by: Hudson Reviewed-by: Keith Mannthey Tested-by: Maloo --- diff --git a/lustre/llite/xattr.c b/lustre/llite/xattr.c index 2e4e530..1d9923e 100644 --- a/lustre/llite/xattr.c +++ b/lustre/llite/xattr.c @@ -239,10 +239,12 @@ int ll_setxattr(struct dentry *dentry, const char *name, if (lump != NULL && S_ISREG(inode->i_mode)) { struct file f; int flags = FMODE_WRITE; + int lum_size = (lump->lmm_magic == LOV_USER_MAGIC_V1) ? + sizeof(*lump) : sizeof(struct lov_user_md_v3); - f.f_dentry = dentry; - rc = ll_lov_setstripe_ea_info(inode, &f, flags, - lump, sizeof(*lump)); + f.f_dentry = dentry; + rc = ll_lov_setstripe_ea_info(inode, &f, flags, lump, + lum_size); /* b10667: rc always be 0 here for now */ rc = 0; } else if (S_ISDIR(inode->i_mode)) {