浏览代码

nfsd4: break lease on nfsd setattr

Leases (delegations) should really be broken on any metadata change, not
just on size change.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
J. Bruce Fields 14 年之前
父节点
当前提交
6a76bebefe
共有 1 个文件被更改,包括 4 次插入8 次删除
  1. 4 8
      fs/nfsd/vfs.c

+ 4 - 8
fs/nfsd/vfs.c

@@ -374,14 +374,6 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
 				goto out;
 				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);
 		host_err = get_write_access(inode);
 		if (host_err)
 		if (host_err)
 			goto out_nfserr;
 			goto out_nfserr;
@@ -422,7 +414,11 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
 
 
 	err = nfserr_notsync;
 	err = nfserr_notsync;
 	if (!check_guard || guardtime == inode->i_ctime.tv_sec) {
 	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);
 		fh_lock(fhp);
+
 		host_err = notify_change(dentry, iap);
 		host_err = notify_change(dentry, iap);
 		err = nfserrno(host_err);
 		err = nfserrno(host_err);
 		fh_unlock(fhp);
 		fh_unlock(fhp);