Skip to content

Commit 1f214e9

Browse files
Trond MyklebustAnna Schumaker
authored andcommitted
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 <[email protected]> Reported-by: Harshit Mogalapalli <[email protected]> Fixes: 76998eb ("NFSv4: Observe the NFS_MOUNT_SOFTREVAL flag in _nfs4_proc_lookupp") Signed-off-by: Trond Myklebust <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 7a7a345 commit 1f214e9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

fs/nfs/nfs4proc.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4715,16 +4715,19 @@ static int _nfs4_proc_lookupp(struct inode *inode,
47154715
};
47164716
unsigned short task_flags = 0;
47174717

4718-
if (NFS_SERVER(inode)->flags & NFS_MOUNT_SOFTREVAL)
4718+
if (server->flags & NFS_MOUNT_SOFTREVAL)
47194719
task_flags |= RPC_TASK_TIMEOUT;
4720+
if (server->caps & NFS_CAP_MOVEABLE)
4721+
task_flags |= RPC_TASK_MOVEABLE;
47204722

47214723
args.bitmask = nfs4_bitmask(server, fattr->label);
47224724

47234725
nfs_fattr_init(fattr);
4726+
nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 0);
47244727

47254728
dprintk("NFS call lookupp ino=0x%lx\n", inode->i_ino);
4726-
status = nfs4_call_sync(clnt, server, &msg, &args.seq_args,
4727-
&res.seq_res, task_flags);
4729+
status = nfs4_do_call_sync(clnt, server, &msg, &args.seq_args,
4730+
&res.seq_res, task_flags);
47284731
dprintk("NFS reply lookupp: %d\n", status);
47294732
return status;
47304733
}

0 commit comments

Comments
 (0)