From: Al Viro Date: Fri, 9 May 2014 14:05:18 +0000 (-0400) Subject: ll_setxattr(): get rid of struct file on stack X-Git-Tag: firefly_0821_release~176^2~2652^2~11^2~15 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c139f3cef36291902d7a29a334acd25a1251cd9d;p=firefly-linux-kernel-4.4.55.git ll_setxattr(): get rid of struct file on stack Signed-off-by: Al Viro --- diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 382b53a8ce62..3f00a40cf387 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -1351,7 +1351,7 @@ static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg) return ll_lov_recreate(inode, &oi, ost_idx); } -int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file, +int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry, int flags, struct lov_user_md *lum, int lum_size) { struct lov_stripe_md *lsm = NULL; @@ -1368,21 +1368,20 @@ int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file, } ll_inode_size_lock(inode); - rc = ll_intent_file_open(file->f_path.dentry, lum, lum_size, &oit); + rc = ll_intent_file_open(dentry, lum, lum_size, &oit); if (rc) goto out_unlock; rc = oit.d.lustre.it_status; if (rc < 0) goto out_req_free; - ll_release_openhandle(file->f_dentry, &oit); + ll_release_openhandle(dentry, &oit); out_unlock: ll_inode_size_unlock(inode); ll_intent_release(&oit); ccc_inode_lsm_put(inode, lsm); out: - cl_lov_delay_create_clear(&file->f_flags); return rc; out_req_free: ptlrpc_req_finished((struct ptlrpc_request *) oit.d.lustre.it_data); @@ -1496,7 +1495,9 @@ static int ll_lov_setea(struct inode *inode, struct file *file, return -EFAULT; } - rc = ll_lov_setstripe_ea_info(inode, file, flags, lump, lum_size); + rc = ll_lov_setstripe_ea_info(inode, file->f_path.dentry, flags, lump, + lum_size); + cl_lov_delay_create_clear(&file->f_flags); OBD_FREE_LARGE(lump, lum_size); return rc; @@ -1523,7 +1524,9 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, return -EFAULT; } - rc = ll_lov_setstripe_ea_info(inode, file, flags, lumv1, lum_size); + rc = ll_lov_setstripe_ea_info(inode, file->f_path.dentry, flags, lumv1, + lum_size); + cl_lov_delay_create_clear(&file->f_flags); if (rc == 0) { struct lov_stripe_md *lsm; __u32 gen; diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 36aa0fd147f2..4b80a6f0c2f7 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -763,7 +763,7 @@ struct posix_acl *ll_get_acl(struct inode *inode, int type); int ll_inode_permission(struct inode *inode, int mask); -int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file, +int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry, int flags, struct lov_user_md *lum, int lum_size); int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 252a6194ed9b..5ad5e7b310c4 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -241,14 +241,11 @@ int ll_setxattr(struct dentry *dentry, const char *name, lump->lmm_stripe_offset = -1; 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); - memset(&f, 0, sizeof(f)); /* f.f_flags is used below */ - f.f_dentry = dentry; - rc = ll_lov_setstripe_ea_info(inode, &f, flags, lump, + rc = ll_lov_setstripe_ea_info(inode, dentry, flags, lump, lum_size); /* b10667: rc always be 0 here for now */ rc = 0;