ll_setxattr(): get rid of struct file on stack
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 9 May 2014 14:05:18 +0000 (10:05 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 3 Nov 2014 20:21:11 +0000 (15:21 -0500)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/staging/lustre/lustre/llite/file.c
drivers/staging/lustre/lustre/llite/llite_internal.h
drivers/staging/lustre/lustre/llite/xattr.c

index 382b53a..3f00a40 100644 (file)
@@ -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;
index 36aa0fd..4b80a6f 100644 (file)
@@ -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,
index 252a619..5ad5e7b 100644 (file)
@@ -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;