[PATCH] #224642 atomic rename buggy on NFS

Timo Aaltonen tjaalton at cc.hut.fi
Fri Mar 20 07:56:34 GMT 2009


 	Hi!

   I've tested that the following patch fixes this bug:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/224642

and would appreciate if it made it in the jaunty kernel.

-- 

From: Trond Myklebust <Trond.Myklebust at netapp.com>
Subject: NFS: Fix the notifications when renaming onto an existing file

NFS appears to be returning an unnecessary "delete" notification when
we're doing an atomic rename. See

   http://bugzilla.gnome.org/show_bug.cgi?id=575684

The fix is to get rid of the redundant call to d_delete().

Signed-off-by: Trond Myklebust <Trond.Myklebust at netapp.com>
---

  fs/nfs/dir.c |    9 ++++-----
  1 files changed, 4 insertions(+), 5 deletions(-)


diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 672368f..3b2f697 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1624,8 +1624,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
  		} else if (atomic_read(&new_dentry->d_count) > 1)
  			/* dentry still busy? */
  			goto out;
-	} else
-		nfs_drop_nlink(new_inode);
+	}

  go_ahead:
  	/*
@@ -1638,10 +1637,8 @@ go_ahead:
  	}
  	nfs_inode_return_delegation(old_inode);

-	if (new_inode != NULL) {
+	if (new_inode != NULL)
  		nfs_inode_return_delegation(new_inode);
-		d_delete(new_dentry);
-	}

  	error = NFS_PROTO(old_dir)->rename(old_dir, &old_dentry->d_name,
  					   new_dir, &new_dentry->d_name);
@@ -1650,6 +1647,8 @@ out:
  	if (rehash)
  		d_rehash(rehash);
  	if (!error) {
+		if (new_inode != NULL)
+			nfs_drop_nlink(new_inode);
  		d_move(old_dentry, new_dentry);
  		nfs_set_verifier(new_dentry,
  					nfs_save_change_attribute(new_dir));


_______________________________________________
NFSv4 mailing list
NFSv4 at linux-nfs.org
http://linux-nfs.org/cgi-bin/mailman/listinfo/nfsv4



More information about the kernel-team mailing list