nfsd: break lease on unlink due to rename
authorJ. Bruce Fields <bfields@redhat.com>
Sun, 6 Feb 2011 21:46:30 +0000 (16:46 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Mon, 14 Feb 2011 15:35:19 +0000 (10:35 -0500)
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@redhat.com>
fs/nfsd/vfs.c

index 30c73f8a57913dd6540fb9d7690410c8c01c9eb8..da1d9701f8e4496e306199d820a6a3c44aaab920 100644 (file)
@@ -1742,6 +1742,13 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
                goto out_dput_new;
 
        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);