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 <bass6@llnl.gov>
Change-Id: I6f6969dfaf2149f268d52272f538fee05459697b
Reviewed-on: http://review.whamcloud.com/5313
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Hudson
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
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)) {