diff options
-rw-r--r-- | fs/nfs/nfs4proc.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 4ae8141452c9..450bfedbe2f4 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2398,13 +2398,16 @@ static int _nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, | |||
2398 | 2398 | ||
2399 | if (nfs4_copy_delegation_stateid(&arg.stateid, inode, fmode)) { | 2399 | if (nfs4_copy_delegation_stateid(&arg.stateid, inode, fmode)) { |
2400 | /* Use that stateid */ | 2400 | /* Use that stateid */ |
2401 | } else if (truncate && state != NULL && nfs4_valid_open_stateid(state)) { | 2401 | } else if (truncate && state != NULL) { |
2402 | struct nfs_lockowner lockowner = { | 2402 | struct nfs_lockowner lockowner = { |
2403 | .l_owner = current->files, | 2403 | .l_owner = current->files, |
2404 | .l_pid = current->tgid, | 2404 | .l_pid = current->tgid, |
2405 | }; | 2405 | }; |
2406 | nfs4_select_rw_stateid(&arg.stateid, state, FMODE_WRITE, | 2406 | if (!nfs4_valid_open_stateid(state)) |
2407 | &lockowner); | 2407 | return -EBADF; |
2408 | if (nfs4_select_rw_stateid(&arg.stateid, state, FMODE_WRITE, | ||
2409 | &lockowner) == -EIO) | ||
2410 | return -EBADF; | ||
2408 | } else | 2411 | } else |
2409 | nfs4_stateid_copy(&arg.stateid, &zero_stateid); | 2412 | nfs4_stateid_copy(&arg.stateid, &zero_stateid); |
2410 | 2413 | ||