[PATCH] nfsd: break lease on unlink due to rename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When I added code to break leases on nfsd rename, I overlooked the case
where the rename unlinks a preexisting file at the target path.

It was an important oversight, and the fix is pretty minor, but there's
no regression here, so I'm a bit on the fence whether to put this off
to 2.6.39 or try to slip it into 2.6.38.

--b.

commit 090f03c2183cf0ad8596c0a8c30a3976a47cdea8
Author: J. Bruce Fields <bfields@xxxxxxxxxx>
Date:   Sun Feb 6 16:46:30 2011 -0500

    nfsd: break lease on unlink due to rename
    
    4795bb37effb7b8fe77e2d2034545d062d3788a8 "nfsd: break lease on unlink,
    link, and rename", only broke the lease on the file that was being
    renamed, and didn't handle the case where the target path refers to an
    already-existing file that will be unlinked by a rename--in that case
    the target file should have any leases broken as well.
    
    Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxx>

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 4218531..d7aa65c 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1744,6 +1744,13 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
 	host_err = nfsd_break_lease(odentry->d_inode);
 	if (host_err)
 		goto out_drop_write;
+	if (ndentry->d_inode) {
+		host_err = nfsd_break_lease(ndentry->d_inode);
+		if (host_err)
+			goto out_drop_write;
+	}
+	if (host_err)
+		goto out_drop_write;
 	host_err = vfs_rename(fdir, odentry, tdir, ndentry);
 	if (!host_err) {
 		host_err = commit_metadata(tfhp);
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux