Skip to content

Commit 3887ce1

Browse files
author
Trond Myklebust
committed
NFSv4: Fix nfs4_inode_make_writeable()
Fix the checks in nfs4_inode_make_writeable() to ignore the case where we hold no delegations. Currently, in such a case, we automatically flush writes. Signed-off-by: Trond Myklebust <[email protected]>
1 parent 40e6aa1 commit 3887ce1

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

fs/nfs/delegation.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,18 @@ int nfs4_inode_return_delegation(struct inode *inode)
644644
*/
645645
int nfs4_inode_make_writeable(struct inode *inode)
646646
{
647-
if (!nfs4_has_session(NFS_SERVER(inode)->nfs_client) ||
648-
!nfs4_check_delegation(inode, FMODE_WRITE))
649-
return nfs4_inode_return_delegation(inode);
650-
return 0;
647+
struct nfs_delegation *delegation;
648+
649+
rcu_read_lock();
650+
delegation = nfs4_get_valid_delegation(inode);
651+
if (delegation == NULL ||
652+
(nfs4_has_session(NFS_SERVER(inode)->nfs_client) &&
653+
(delegation->type & FMODE_WRITE))) {
654+
rcu_read_unlock();
655+
return 0;
656+
}
657+
rcu_read_unlock();
658+
return nfs4_inode_return_delegation(inode);
651659
}
652660

653661
static void nfs_mark_return_if_closed_delegation(struct nfs_server *server,

0 commit comments

Comments
 (0)