Commit c5c3fb5f authored by Kinglong Mee's avatar Kinglong Mee Committed by Trond Myklebust

NFS: Make opened as optional argument in _nfs4_do_open

Check opened, only update it when non-NULL.
It's not needs define an unused value for the opened
when calling _nfs4_do_open.

v3, same as v2.
Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent ae57ca0f
...@@ -27,7 +27,6 @@ nfs4_file_open(struct inode *inode, struct file *filp) ...@@ -27,7 +27,6 @@ nfs4_file_open(struct inode *inode, struct file *filp)
struct inode *dir; struct inode *dir;
unsigned openflags = filp->f_flags; unsigned openflags = filp->f_flags;
struct iattr attr; struct iattr attr;
int opened = 0;
int err; int err;
/* /*
...@@ -66,7 +65,7 @@ nfs4_file_open(struct inode *inode, struct file *filp) ...@@ -66,7 +65,7 @@ nfs4_file_open(struct inode *inode, struct file *filp)
nfs_sync_inode(inode); nfs_sync_inode(inode);
} }
inode = NFS_PROTO(dir)->open_context(dir, ctx, openflags, &attr, &opened); inode = NFS_PROTO(dir)->open_context(dir, ctx, openflags, &attr, NULL);
if (IS_ERR(inode)) { if (IS_ERR(inode)) {
err = PTR_ERR(inode); err = PTR_ERR(inode);
switch (err) { switch (err) {
......
...@@ -2452,7 +2452,7 @@ static int _nfs4_do_open(struct inode *dir, ...@@ -2452,7 +2452,7 @@ static int _nfs4_do_open(struct inode *dir,
nfs_setsecurity(state->inode, opendata->o_res.f_attr, olabel); nfs_setsecurity(state->inode, opendata->o_res.f_attr, olabel);
} }
} }
if (opendata->file_created) if (opened && opendata->file_created)
*opened |= FILE_CREATED; *opened |= FILE_CREATED;
if (pnfs_use_threshold(ctx_th, opendata->f_attr.mdsthreshold, server)) { if (pnfs_use_threshold(ctx_th, opendata->f_attr.mdsthreshold, server)) {
...@@ -3562,7 +3562,6 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, ...@@ -3562,7 +3562,6 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
struct nfs4_label l, *ilabel = NULL; struct nfs4_label l, *ilabel = NULL;
struct nfs_open_context *ctx; struct nfs_open_context *ctx;
struct nfs4_state *state; struct nfs4_state *state;
int opened = 0;
int status = 0; int status = 0;
ctx = alloc_nfs_open_context(dentry, FMODE_READ); ctx = alloc_nfs_open_context(dentry, FMODE_READ);
...@@ -3572,7 +3571,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, ...@@ -3572,7 +3571,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
ilabel = nfs4_label_init_security(dir, dentry, sattr, &l); ilabel = nfs4_label_init_security(dir, dentry, sattr, &l);
sattr->ia_mode &= ~current_umask(); sattr->ia_mode &= ~current_umask();
state = nfs4_do_open(dir, ctx, flags, sattr, ilabel, &opened); state = nfs4_do_open(dir, ctx, flags, sattr, ilabel, NULL);
if (IS_ERR(state)) { if (IS_ERR(state)) {
status = PTR_ERR(state); status = PTR_ERR(state);
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment