linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfsd: break lease on unlink due to rename
@ 2011-02-09  5:04 J. Bruce Fields
  0 siblings, 0 replies; only message in thread
From: J. Bruce Fields @ 2011-02-09  5:04 UTC (permalink / raw)
  To: linux-nfs

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@redhat.com>
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@redhat.com>

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);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-02-09  5:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-09  5:04 [PATCH] nfsd: break lease on unlink due to rename J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).