From: Jeff Mahoney <jeffm@suse.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
Knut Petersen <Knut_Petersen@t-online.de>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>,
reiserfs-devel@vger.kernel.org
Subject: Re: [BUG 3.13.0-rc6] reiserfs possible circular locking dependency
Date: Fri, 03 Jan 2014 17:04:32 -0500 [thread overview]
Message-ID: <52C733F0.7070103@suse.com> (raw)
In-Reply-To: <CA+55aFxVs_aGnMdcTck3C7AayFrjX=GrFSwmJwiC9q3-3wySgw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2237 bytes --]
On 1/3/14, 2:46 PM, Linus Torvalds wrote:
> On Fri, Jan 3, 2014 at 11:16 AM, Knut Petersen
> <Knut_Petersen@t-online.de> wrote:
>> Rebooting after a power failure on an openSuSE 13.1 system
>> with kernel 3.13.0-rc6 triggered the attached lockdep warning.
>
> Hmm. It seems to be that the *normal* sequence should be:
>
> - get i_mutex, call lookup, which gets sbi->lock (reiserfs_write_lock)
>
> but in the mounting path, we have special circumstances.
>
> That finish_unfinished() function does
>
> - reiserfs_write_lock_nested() .
> - remove_save_link
> - iput(inode) with the write lock held
>
> and that can apparently end up taking i_mutex in open_xa_dir (and then
> recursively the write lock, but that's an explicitly recursive lock,
> so that part should be ok).
>
> Now, I don't think this can *really* deadlock with the normal order of
> operations, because during mounting there is no other process that can
> take those in the reverse order (since the filesystem isn't live), but
> I do wonder if we should just release the reiserfs write lock over the
> iputs. We release it in other parts anyway (like for the quota off)
>
> Jeff, you already touched this exact case in commit d2d0395fd177
> ("reiserfs: locking, release lock around quota operations") except
> that was for those quota operation cases.
>
> Even if it's not a real problem, making lockdep happy sounds like a
> good idea. Of course, the trouble is that this code path almost never
> gets exercised (which is why this hasn't been noticed earlier), so
> testing...
>
> Jeff? Comments?
If someone ever invents a time machine, I'd go back to 2004 and tell
myself to fight harder to make a reiserfs v3.7 with real extended
attribute items. This code will haunt me to my death.
Anyway, yeah. The right thing here is to drop the lock for the iput.
More than that would be ok too. finish_unfinished happens when the file
system goes read-write and that includes the remount path. There can be
other users of the file system but it would be a recursive acquire so we
wouldn't actually deadlock there.
I'll work something up over the weekend or on Monday.
-Jeff
--
Jeff Mahoney
SUSE Labs
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 841 bytes --]
next prev parent reply other threads:[~2014-01-03 22:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-03 19:16 [BUG 3.13.0-rc6] reiserfs possible circular locking dependency Knut Petersen
2014-01-03 19:46 ` Linus Torvalds
2014-01-03 22:04 ` Jeff Mahoney [this message]
2014-01-15 23:29 ` Jeff Mahoney
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=52C733F0.7070103@suse.com \
--to=jeffm@suse.com \
--cc=Knut_Petersen@t-online.de \
--cc=linux-kernel@vger.kernel.org \
--cc=reiserfs-devel@vger.kernel.org \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).