Skip to content

Commit

Permalink
NFS: Make opened as optional argument in _nfs4_do_open
Browse files Browse the repository at this point in the history
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: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
  • Loading branch information
Kinglong Mee authored and Trond Myklebust committed Aug 27, 2015
1 parent ae57ca0 commit c5c3fb5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions fs/nfs/nfs4file.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ nfs4_file_open(struct inode *inode, struct file *filp)
struct inode *dir;
unsigned openflags = filp->f_flags;
struct iattr attr;
int opened = 0;
int err;

/*
Expand Down Expand Up @@ -66,7 +65,7 @@ nfs4_file_open(struct inode *inode, struct file *filp)
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)) {
err = PTR_ERR(inode);
switch (err) {
Expand Down
5 changes: 2 additions & 3 deletions fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2452,7 +2452,7 @@ static int _nfs4_do_open(struct inode *dir,
nfs_setsecurity(state->inode, opendata->o_res.f_attr, olabel);
}
}
if (opendata->file_created)
if (opened && opendata->file_created)
*opened |= FILE_CREATED;

if (pnfs_use_threshold(ctx_th, opendata->f_attr.mdsthreshold, server)) {
Expand Down Expand Up @@ -3562,7 +3562,6 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
struct nfs4_label l, *ilabel = NULL;
struct nfs_open_context *ctx;
struct nfs4_state *state;
int opened = 0;
int status = 0;

ctx = alloc_nfs_open_context(dentry, FMODE_READ);
Expand All @@ -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);

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)) {
status = PTR_ERR(state);
goto out;
Expand Down

0 comments on commit c5c3fb5

Please sign in to comment.