Commit 3887ce1a authored by Trond Myklebust's avatar Trond Myklebust
Browse files

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: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 40e6aa10
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -644,11 +644,19 @@ int nfs4_inode_return_delegation(struct inode *inode)
 */
int nfs4_inode_make_writeable(struct inode *inode)
{
	if (!nfs4_has_session(NFS_SERVER(inode)->nfs_client) ||
	    !nfs4_check_delegation(inode, FMODE_WRITE))
		return nfs4_inode_return_delegation(inode);
	struct nfs_delegation *delegation;

	rcu_read_lock();
	delegation = nfs4_get_valid_delegation(inode);
	if (delegation == NULL ||
	    (nfs4_has_session(NFS_SERVER(inode)->nfs_client) &&
	     (delegation->type & FMODE_WRITE))) {
		rcu_read_unlock();
		return 0;
	}
	rcu_read_unlock();
	return nfs4_inode_return_delegation(inode);
}

static void nfs_mark_return_if_closed_delegation(struct nfs_server *server,
		struct nfs_delegation *delegation)