mirror of https://github.com/torvalds/linux.git
NFSv4: Fix an incorrect parameter when calling nfs4_call_sync()
The Smatch static checker noted that in _nfs4_proc_lookupp(), the flag
RPC_TASK_TIMEOUT is being passed as an argument to nfs4_init_sequence(),
which is clearly incorrect.
Since LOOKUPP is an idempotent operation, nfs4_init_sequence() should
not ask the server to cache the result. The RPC_TASK_TIMEOUT flag needs
to be passed down to the RPC layer.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Reported-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Fixes: 76998ebb91 ("NFSv4: Observe the NFS_MOUNT_SOFTREVAL flag in _nfs4_proc_lookupp")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
This commit is contained in:
parent
7a7a345652
commit
1f214e9c3a
|
|
@ -4715,15 +4715,18 @@ static int _nfs4_proc_lookupp(struct inode *inode,
|
||||||
};
|
};
|
||||||
unsigned short task_flags = 0;
|
unsigned short task_flags = 0;
|
||||||
|
|
||||||
if (NFS_SERVER(inode)->flags & NFS_MOUNT_SOFTREVAL)
|
if (server->flags & NFS_MOUNT_SOFTREVAL)
|
||||||
task_flags |= RPC_TASK_TIMEOUT;
|
task_flags |= RPC_TASK_TIMEOUT;
|
||||||
|
if (server->caps & NFS_CAP_MOVEABLE)
|
||||||
|
task_flags |= RPC_TASK_MOVEABLE;
|
||||||
|
|
||||||
args.bitmask = nfs4_bitmask(server, fattr->label);
|
args.bitmask = nfs4_bitmask(server, fattr->label);
|
||||||
|
|
||||||
nfs_fattr_init(fattr);
|
nfs_fattr_init(fattr);
|
||||||
|
nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 0);
|
||||||
|
|
||||||
dprintk("NFS call lookupp ino=0x%lx\n", inode->i_ino);
|
dprintk("NFS call lookupp ino=0x%lx\n", inode->i_ino);
|
||||||
status = nfs4_call_sync(clnt, server, &msg, &args.seq_args,
|
status = nfs4_do_call_sync(clnt, server, &msg, &args.seq_args,
|
||||||
&res.seq_res, task_flags);
|
&res.seq_res, task_flags);
|
||||||
dprintk("NFS reply lookupp: %d\n", status);
|
dprintk("NFS reply lookupp: %d\n", status);
|
||||||
return status;
|
return status;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue