Re: [PATCH 24/25] r/o bind mounts: track number of mount writers

From: Andrew Morton
Date: Mon Sep 24 2007 - 02:17:55 EST

On Thu, 20 Sep 2007 12:53:20 -0700 Dave Hansen <haveblue@xxxxxxxxxx> wrote:

> This is the real meat of the entire series. It actually
> implements the tracking of the number of writers to a mount.
> However, it causes scalability problems because there can
> be hundreds of cpus doing open()/close() on files on the
> same mnt at the same time. Even an atomic_t in the mnt
> has massive scalaing problems because the cacheline gets
> so terribly contended.
> This uses a statically-allocated percpu variable. All
> operations are local to a cpu as long that cpu operates on
> the same mount, and there are no writer count imbalances.
> Writer count imbalances happen when a write is taken on one
> cpu, and released on another, like when an open/close pair
> is performed on two different cpus because the task moved.

Did you test with lockdep enabled?

[ INFO: possible recursive locking detected ]
2.6.23-rc7-mm1 #1
swapper/1 is trying to acquire lock:
(&writer->lock){--..}, at: [<c0197a32>] lock_and_coalesce_cpu_mnt_writer_counts+0x32/0x70

but task is already holding lock:
(&writer->lock){--..}, at: [<c0197a32>] lock_and_coalesce_cpu_mnt_writer_counts+0x32/0x70

other info that might help us debug this:
1 lock held by swapper/1:
#0: (&writer->lock){--..}, at: [<c0197a32>] lock_and_coalesce_cpu_mnt_writer_counts+0x32/0x70

stack backtrace:
[<c0103ffa>] show_trace_log_lvl+0x1a/0x30
[<c0104b82>] show_trace+0x12/0x20
[<c0104c96>] dump_stack+0x16/0x20
[<c0144dc5>] __lock_acquire+0xde5/0x10a0
[<c01450fa>] lock_acquire+0x7a/0xa0
[<c03e734c>] _spin_lock+0x2c/0x40
[<c0197a32>] lock_and_coalesce_cpu_mnt_writer_counts+0x32/0x70
[<c01982c6>] mntput_no_expire+0x36/0xc0
[<c0188f15>] path_release_on_umount+0x15/0x20
[<c0198930>] sys_umount+0x40/0x230
[<c010070b>] name_to_dev_t+0x9b/0x270
[<c05230c2>] prepare_namespace+0x62/0x1b0
[<c05226ca>] kernel_init+0x21a/0x320
[<c0103b47>] kernel_thread_helper+0x7/0x10

It look like a false positive to me, but really, for a patchset of this
complexity and maturity I cannot fathom how it could have escaped any
lockdep testing.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at