NFSv4: Ensure that we wait for the CLOSE request to complete
Otherwise, we do end up breaking close-to-open semantics. We also end up breaking some of the silly-rename tests in Connectathon on some setups. Please refer to the bug-report at http://bugzilla.linux-nfs.org/show_bug.cgi?id=150 Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
@@ -1305,7 +1305,7 @@ static const struct rpc_call_ops nfs4_close_ops = {
|
||||
*
|
||||
* NOTE: Caller must be holding the sp->so_owner semaphore!
|
||||
*/
|
||||
int nfs4_do_close(struct path *path, struct nfs4_state *state)
|
||||
int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait)
|
||||
{
|
||||
struct nfs_server *server = NFS_SERVER(state->inode);
|
||||
struct nfs4_closedata *calldata;
|
||||
@@ -1333,8 +1333,11 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state)
|
||||
task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_close_ops, calldata);
|
||||
if (IS_ERR(task))
|
||||
return PTR_ERR(task);
|
||||
status = 0;
|
||||
if (wait)
|
||||
status = rpc_wait_for_completion_task(task);
|
||||
rpc_put_task(task);
|
||||
return 0;
|
||||
return status;
|
||||
out_free_calldata:
|
||||
kfree(calldata);
|
||||
out:
|
||||
@@ -1365,7 +1368,7 @@ static int nfs4_intent_set_file(struct nameidata *nd, struct path *path, struct
|
||||
}
|
||||
ret = PTR_ERR(filp);
|
||||
out_close:
|
||||
nfs4_close_state(path, state, nd->intent.open.flags);
|
||||
nfs4_close_sync(path, state, nd->intent.open.flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1450,7 +1453,7 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st
|
||||
nfs4_intent_set_file(nd, &path, state);
|
||||
return 1;
|
||||
}
|
||||
nfs4_close_state(&path, state, openflags);
|
||||
nfs4_close_sync(&path, state, openflags);
|
||||
out_drop:
|
||||
d_drop(dentry);
|
||||
return 0;
|
||||
@@ -1904,7 +1907,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
|
||||
if (status == 0 && (nd->flags & LOOKUP_OPEN) != 0)
|
||||
status = nfs4_intent_set_file(nd, &path, state);
|
||||
else
|
||||
nfs4_close_state(&path, state, flags);
|
||||
nfs4_close_sync(&path, state, flags);
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user