All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olaf Kirch <okir@suse.de>
To: nfs@lists.sourceforge.net
Cc: Michael Schroeder <mls@suse.de>
Subject: Re: [PATCH NFSv2] Drop inode after rename
Date: Mon, 11 Jul 2005 12:50:45 +0200	[thread overview]
Message-ID: <20050711105045.GL27163@suse.de> (raw)
In-Reply-To: <20050711104611.GK27163@suse.de>

[-- Attachment #1: Type: text/plain, Size: 219 bytes --]

Sorry, I sent an older version of this patch. Here's the one for
2.6.12.

Olaf
-- 
Olaf Kirch   |  --- o --- Nous sommes du soleil we love when we play
okir@suse.de |    / | \   sol.dhoop.naytheet.ah kin.ir.samse.qurax

[-- Attachment #2: nfs-rename-zap-inode --]
[-- Type: text/plain, Size: 1103 bytes --]

Index: test12/fs/nfs/dir.c
===================================================================
--- test12.orig/fs/nfs/dir.c	2005-07-08 11:45:18.000000000 +0200
+++ test12/fs/nfs/dir.c	2005-07-11 12:49:34.000000000 +0200
@@ -1445,8 +1445,15 @@ go_ahead:
 		shrink_dcache_parent(old_dentry);
 	}
 
-	if (new_inode)
+	/* d_delete will currently not do a dentry_iput
+	 * because new_dentry->d_count is at least 2 when
+	 * we get here. As a matter of caution
+	 * let's grab a reference to the inode anyway.
+	 */
+	if (new_inode && igrab(new_inode)) {
+		nfs_begin_data_update(new_inode);
 		d_delete(new_dentry);
+	}
 
 	nfs_begin_data_update(old_dir);
 	nfs_begin_data_update(new_dir);
@@ -1456,6 +1463,17 @@ go_ahead:
 	nfs_end_data_update(old_inode);
 	nfs_end_data_update(new_dir);
 	nfs_end_data_update(old_dir);
+
+	if (new_inode) {
+		/* If this was the last reference to the inode make
+		 * sure the VFS zaps it and all associated caches.
+		 */
+		if (error == 0)
+			new_inode->i_nlink--;
+		nfs_end_data_update(new_inode);  
+		iput(new_inode);
+	}
+
 out:
 	if (rehash)
 		d_rehash(rehash);

  reply	other threads:[~2005-07-11 10:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-11 10:46 [PATCH NFSv2] Drop inode after rename Olaf Kirch
2005-07-11 10:50 ` Olaf Kirch [this message]
2005-07-11 11:05 ` Trond Myklebust
2005-07-11 11:07   ` Olaf Kirch
2005-07-11 11:14     ` Trond Myklebust
2005-07-11 11:24       ` Olaf Kirch
2005-07-11 11:56         ` Trond Myklebust
2005-07-11 12:28           ` Michael Schroeder
2005-07-11 12:34             ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050711105045.GL27163@suse.de \
    --to=okir@suse.de \
    --cc=mls@suse.de \
    --cc=nfs@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.