[PATCH 25/27] r-o-bind-mounts-track-number-of-mount-writers-make-lockdep-happy-with-r-o-bind-mounts

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <akpm@...>
Cc: <linux-kernel@...>, <miklos@...>, <hch@...>, Dave Hansen <haveblue@...>
Date: Thursday, November 1, 2007 - 7:09 pm

With the r/o bind mount patches, we can have as many
spinlocks nested as there are CPUs on the system.
Lockdep freaks out after 8.

So, create a new lockdep class of locks for the
mnt_writer spinlocks, and initialize each of the
cpu locks to be in a different class.

It should shut up warnings like this, while still
allowing some of the lockdep goodness to remain:

=============================================
[ INFO: possible recursive locking detected ]
2.6.23-rc6 #6

---

 linux-2.6.git-dave/fs/namespace.c |    2 ++
 1 file changed, 2 insertions(+)

diff -puN fs/namespace.c~r-o-bind-mounts-track-number-of-mount-writers-make-lockdep-happy-with-r-o-bind-mounts fs/namespace.c
--- linux-2.6.git/fs/namespace.c~r-o-bind-mounts-track-number-of-mount-writers-make-lockdep-happy-with-r-o-bind-mounts	2007-11-01 14:46:21.000000000 -0700
+++ linux-2.6.git-dave/fs/namespace.c	2007-11-01 14:46:21.000000000 -0700
@@ -112,6 +112,7 @@ struct mnt_writer {
 	 * must be ordered by cpu number.
 	 */
 	spinlock_t lock;
+	struct lock_class_key lock_class; /* compiles out with !lockdep */
 	unsigned long count;
 	struct vfsmount *mnt;
 } ____cacheline_aligned_in_smp;
@@ -123,6 +124,7 @@ static int __init init_mnt_writers(void)
 	for_each_possible_cpu(cpu) {
 		struct mnt_writer *writer = &per_cpu(mnt_writers, cpu);
 		spin_lock_init(&writer->lock);
+		lockdep_set_class(&writer->lock, &writer->lock_class);
 		writer->count = 0;
 	}
 	return 0;
_
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/27] Read-only bind mounts (-mm resend), Dave Hansen, (Thu Nov 1, 7:08 pm)
[PATCH 25/27] r-o-bind-mounts-track-number-of-mount-writers-..., Dave Hansen, (Thu Nov 1, 7:09 pm)
[PATCH 06/27] r-o-bind-mounts-stub-functions, Dave Hansen, (Thu Nov 1, 7:08 pm)
[PATCH 05/27] rename open_namei() to open_pathname(), Dave Hansen, (Thu Nov 1, 7:08 pm)
Re: [PATCH 05/27] rename open_namei() to open_pathname(), Christoph Hellwig, (Mon Nov 26, 10:33 am)
[PATCH 04/27] kill filp_open(), Dave Hansen, (Thu Nov 1, 7:08 pm)
Re: [PATCH 04/27] kill filp_open(), Andrew Morton, (Wed Jan 16, 4:52 am)
Re: [PATCH 04/27] kill filp_open(), Dave Hansen, (Wed Jan 16, 1:04 pm)
Re: [PATCH 04/27] kill filp_open(), Bryn M. Reeves, (Wed Jan 16, 1:12 pm)
Re: [PATCH 04/27] kill filp_open(), Christoph Hellwig, (Wed Jan 16, 1:10 pm)
Re: [PATCH 04/27] kill filp_open(), Dave Hansen, (Wed Jan 16, 1:41 pm)
Re: [PATCH 04/27] kill filp_open(), Christoph Hellwig, (Wed Jan 16, 1:47 pm)
[PATCH 03/27] kill do_filp_open(), Dave Hansen, (Thu Nov 1, 7:08 pm)
[PATCH 02/27] make open_namei() return a filp, Dave Hansen, (Thu Nov 1, 7:08 pm)