提交 c139f3ce 编写于 作者: A Al Viro

ll_setxattr(): get rid of struct file on stack

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 48eddfd5
...@@ -1351,7 +1351,7 @@ static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg) ...@@ -1351,7 +1351,7 @@ static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg)
return ll_lov_recreate(inode, &oi, ost_idx); 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) int flags, struct lov_user_md *lum, int lum_size)
{ {
struct lov_stripe_md *lsm = NULL; struct lov_stripe_md *lsm = NULL;
...@@ -1368,21 +1368,20 @@ int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file, ...@@ -1368,21 +1368,20 @@ int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
} }
ll_inode_size_lock(inode); 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) if (rc)
goto out_unlock; goto out_unlock;
rc = oit.d.lustre.it_status; rc = oit.d.lustre.it_status;
if (rc < 0) if (rc < 0)
goto out_req_free; goto out_req_free;
ll_release_openhandle(file->f_dentry, &oit); ll_release_openhandle(dentry, &oit);
out_unlock: out_unlock:
ll_inode_size_unlock(inode); ll_inode_size_unlock(inode);
ll_intent_release(&oit); ll_intent_release(&oit);
ccc_inode_lsm_put(inode, lsm); ccc_inode_lsm_put(inode, lsm);
out: out:
cl_lov_delay_create_clear(&file->f_flags);
return rc; return rc;
out_req_free: out_req_free:
ptlrpc_req_finished((struct ptlrpc_request *) oit.d.lustre.it_data); 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, ...@@ -1496,7 +1495,9 @@ static int ll_lov_setea(struct inode *inode, struct file *file,
return -EFAULT; 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); OBD_FREE_LARGE(lump, lum_size);
return rc; return rc;
...@@ -1523,7 +1524,9 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, ...@@ -1523,7 +1524,9 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file,
return -EFAULT; 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) { if (rc == 0) {
struct lov_stripe_md *lsm; struct lov_stripe_md *lsm;
__u32 gen; __u32 gen;
......
...@@ -763,7 +763,7 @@ struct posix_acl *ll_get_acl(struct inode *inode, int type); ...@@ -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_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 flags, struct lov_user_md *lum,
int lum_size); int lum_size);
int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename,
......
...@@ -241,14 +241,11 @@ int ll_setxattr(struct dentry *dentry, const char *name, ...@@ -241,14 +241,11 @@ int ll_setxattr(struct dentry *dentry, const char *name,
lump->lmm_stripe_offset = -1; lump->lmm_stripe_offset = -1;
if (lump != NULL && S_ISREG(inode->i_mode)) { if (lump != NULL && S_ISREG(inode->i_mode)) {
struct file f;
int flags = FMODE_WRITE; int flags = FMODE_WRITE;
int lum_size = (lump->lmm_magic == LOV_USER_MAGIC_V1) ? int lum_size = (lump->lmm_magic == LOV_USER_MAGIC_V1) ?
sizeof(*lump) : sizeof(struct lov_user_md_v3); sizeof(*lump) : sizeof(struct lov_user_md_v3);
memset(&f, 0, sizeof(f)); /* f.f_flags is used below */ rc = ll_lov_setstripe_ea_info(inode, dentry, flags, lump,
f.f_dentry = dentry;
rc = ll_lov_setstripe_ea_info(inode, &f, flags, lump,
lum_size); lum_size);
/* b10667: rc always be 0 here for now */ /* b10667: rc always be 0 here for now */
rc = 0; rc = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册