Skip to content

Commit

Permalink
nfsd4: break lease on nfsd setattr
Browse files Browse the repository at this point in the history
Leases (delegations) should really be broken on any metadata change, not
just on size change.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
J. Bruce Fields committed Jan 14, 2011
1 parent 9ce137e commit 6a76beb
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions fs/nfsd/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,6 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
goto out;
}

/*
* If we are changing the size of the file, then
* we need to break all leases.
*/
host_err = break_lease(inode, O_WRONLY | O_NONBLOCK);
if (host_err) /* ENOMEM or EWOULDBLOCK */
goto out_nfserr;

host_err = get_write_access(inode);
if (host_err)
goto out_nfserr;
Expand Down Expand Up @@ -422,7 +414,11 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,

err = nfserr_notsync;
if (!check_guard || guardtime == inode->i_ctime.tv_sec) {
host_err = break_lease(inode, O_WRONLY | O_NONBLOCK);
if (host_err)
goto out_nfserr;
fh_lock(fhp);

host_err = notify_change(dentry, iap);
err = nfserrno(host_err);
fh_unlock(fhp);
Expand Down

0 comments on commit 6a76beb

Please sign in to comment.