mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Florin Iucha <florin@iucha.net>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Linux 2.5.71
Date: Sun, 15 Jun 2003 01:03:58 -0700	[thread overview]
Message-ID: <16108.10350.294138.850242@charged.uio.no> (raw)
In-Reply-To: <Pine.LNX.4.44.0306141849290.20728-100000@home.transmeta.com>

>>>>> " " == Linus Torvalds <torvalds@transmeta.com> writes:

     > Trond, any ideas?

Here's the patch I posted to Bugzilla earlier today. The problem is
that whereas using the dentry->d_hash list for private purposes was
previously harmless, it is not allowed with the RCU lists, because we
depend on the unhashed node continuing to point back to the original
list.

Cheers,
   Trond

diff -u --recursive --new-file linux-2.5.71/net/sunrpc/rpc_pipe.c linux-2.5.71-fix_rpcpipe/net/sunrpc/rpc_pipe.c
--- linux-2.5.71/net/sunrpc/rpc_pipe.c	2003-06-11 19:24:29.000000000 -0700
+++ linux-2.5.71-fix_rpcpipe/net/sunrpc/rpc_pipe.c	2003-06-14 16:58:21.000000000 -0700
@@ -472,30 +472,37 @@
 rpc_depopulate(struct dentry *parent)
 {
 	struct inode *dir = parent->d_inode;
-	HLIST_HEAD(head);
 	struct list_head *pos, *next;
-	struct dentry *dentry;
+	struct dentry *dentry, *dvec[10];
+	int n = 0;
 
 	down(&dir->i_sem);
+repeat:
 	spin_lock(&dcache_lock);
 	list_for_each_safe(pos, next, &parent->d_subdirs) {
 		dentry = list_entry(pos, struct dentry, d_child);
+		spin_lock(&dentry->d_lock);
 		if (!d_unhashed(dentry)) {
 			dget_locked(dentry);
 			__d_drop(dentry);
-			hlist_add_head(&dentry->d_hash, &head);
-		}
+			spin_unlock(&dentry->d_lock);
+			dvec[n++] = dentry;
+			if (n == ARRAY_SIZE(dvec))
+				break;
+		} else
+			spin_unlock(&dentry->d_lock);
 	}
 	spin_unlock(&dcache_lock);
-	while (!hlist_empty(&head)) {
-		dentry = list_entry(head.first, struct dentry, d_hash);
-		/* Private list, so no dcache_lock needed and use __d_drop */
-		__d_drop(dentry);
-		if (dentry->d_inode) {
-			rpc_inode_setowner(dentry->d_inode, NULL);
-			simple_unlink(dir, dentry);
-		}
-		dput(dentry);
+	if (n) {
+		do {
+			dentry = dvec[--n];
+			if (dentry->d_inode) {
+				rpc_inode_setowner(dentry->d_inode, NULL);
+				simple_unlink(dir, dentry);
+			}
+			dput(dentry);
+		} while (n);
+		goto repeat;
 	}
 	up(&dir->i_sem);
 }

  parent reply	other threads:[~2003-06-15  7:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-14 21:17 Linus Torvalds
2003-06-15  1:42 ` Florin Iucha
2003-06-15  1:58   ` Linus Torvalds
2003-06-15  2:00     ` Florin Iucha
2003-06-15  4:55       ` Florin Iucha
2003-06-15  8:03     ` Trond Myklebust [this message]
2003-06-15  6:54 ` Andre Hedrick
2003-06-15  7:15   ` Andre Hedrick
2003-06-15 13:29 ` Paweł Gołaszewski
2003-06-15 13:45   ` Russell King
2003-06-16 18:04 ` John Cherry
2003-06-17 19:29 ` [2.5 patch] 2.5.72: moxa.c doesn't compile Adrian Bunk
2003-06-17 23:33   ` viro
2003-06-19 18:53   ` Thiago Rondon
2003-06-20  4:28     ` Rusty Russell
     [not found] <20030614213012$6a47@gated-at.bofh.it>
2003-06-14 22:21 ` Linux 2.5.71 John Weber
2003-06-15  0:42   ` Herbert Xu
2003-06-15  0:43   ` Herbert Xu
2003-06-15  1:10     ` Arnaldo Carvalho de Melo
2003-06-15  0:21 Larry McVoy
2003-06-17 16:13 ` H. Peter Anvin

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=16108.10350.294138.850242@charged.uio.no \
    --to=trond.myklebust@fys.uio.no \
    --cc=florin@iucha.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®