From: Linus Torvalds <torvalds@linux-foundation.org>
To: Bart Trojanowski <bart@jukie.net>
Cc: linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: vfat BKL/lock_super regression in v2.6.26-rc3-g8f59342
Date: Tue, 19 Aug 2008 15:17:29 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.1.10.0808191505590.3324@nehalem.linux-foundation.org> (raw)
In-Reply-To: <20080819220311.GA28029@jukie.net>
On Tue, 19 Aug 2008, Bart Trojanowski wrote:
>
> I was able to bisect it to the commit 8f5934278d1d86590244c2791b28f77d67466007
> which claims to "Replace BKL with superblock lock in fat/msdos/vfat".
>
> When I run with lock debugging I get...
>
> =============================================
> [ INFO: possible recursive locking detected ]
> 2.6.27-rc3-bisect-00448-ga7f5aaf #16
> ---------------------------------------------
> mv/4020 is trying to acquire lock:
> (&type->s_lock_key#9){--..}, at: [<c01a90fe>] lock_super+0x1e/0x20
>
> but task is already holding lock:
> (&type->s_lock_key#9){--..}, at: [<c01a90fe>] lock_super+0x1e/0x20
Thanks for the excellent debug.
> It looks like the call trace is:
>
> - do_unlinkat
> - vfs_unlink
> - vfat_unlink
> * lock_super
> - fat_remove_entries
> - fat_sync_inode
> - fat_write_inode
> * lock_super
Very much so.
And I think you hit this issue because you probably mounted the USB stick
as a "sync" (or dirsync) mount - which is what some distros do by default,
even if it is known to cause problems for some flash cards that don't do a
good job at wear levelling.
But it's good that you did that, because all _my_ testing (which was
admittedly very deficient) had been done with a default mount without that
thing.
> So this code really really liked BKL because it was recursive.
Yeah, we had some other cases like that. It's the main source of BKL
problems by far (if it wasn't for the recursion, BKL removal would
generally be trivial).
The other example of this was 9c20616c385ebeaa30257ef5d35e8f346db4ee32,
where fat_setattr->fat_truncate caused a deadlock.
> I am testing a naive patch to address this problem and will follow up on
> it in a bit.
Thanks.
Btw, quite often, the right solution may be to remove one of the locks
entirely. FAT should actually have been largely BKL free, and my
conversion of BKL to super-lock was "overly eager" exactly because it's
easier to find deadlocks (and debug things carefully and handle them as
they pop up) than it is to find races (which are almost impossible to
debug and pinpoint).
In particular, I think fat_write_inode() really is safe. It already uses
spin_lock(&sbi->inode_hash_lock);
..
spin_unlock(&sbi->inode_hash_lock);
to protect its internal data structures, and all that [un]lock_super()
protects is really just local variables and code that is already SMP-safe
(ie "sb_bread()" certainly doesn't need locking.
So I'm pretty sure the right fix is to just remove [un]lock_super()
entirely from fat_write_inode().
Linus
next prev parent reply other threads:[~2008-08-19 22:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-19 22:03 Bart Trojanowski
2008-08-19 22:06 ` [PATCH] make lock_super recursive to simulate BKL Bart Trojanowski
2008-08-19 22:21 ` Linus Torvalds
2008-08-20 1:14 ` Bart Trojanowski
2008-08-19 22:17 ` Linus Torvalds [this message]
2008-08-20 0:03 ` vfat BKL/lock_super regression in v2.6.26-rc3-g8f59342 Bart Trojanowski
2008-08-20 0:11 ` Linus Torvalds
2008-08-20 0:24 ` Bart Trojanowski
2008-08-20 0:18 ` Bart Trojanowski
2008-08-20 0:43 ` Linus Torvalds
2008-08-20 0:56 ` Linus Torvalds
2008-08-20 2:27 ` Bart Trojanowski
2008-08-20 21:23 ` Diego Calleja
2008-08-23 0:54 ` [PATCH] document additional vfat mount options Bart Trojanowski
2008-08-23 2:33 ` Grant Coady
2008-08-23 3:12 ` Bart Trojanowski
2008-08-23 3:14 ` Bart Trojanowski
2008-08-23 3:27 ` OGAWA Hirofumi
2008-08-23 13:11 ` Bart Trojanowski
2008-08-23 14:47 ` OGAWA Hirofumi
2008-08-23 3:10 ` OGAWA Hirofumi
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=alpine.LFD.1.10.0808191505590.3324@nehalem.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=bart@jukie.net \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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®