From: Al Viro <viro@ZenIV.linux.org.uk>
To: linux-fsdevel@vger.kernel.org
Cc: Jan Kara <jack@suse.cz>, Josh Boyer <jwboyer@redhat.com>,
Dave Jones <davej@redhat.com>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Tyler Hicks <tyhicks@canonical.com>
Subject: udf deadlock (was Re: hugetlbfs lockdep spew revisited.)
Date: Fri, 17 Feb 2012 17:48:18 +0000 [thread overview]
Message-ID: <20120217174818.GP23916@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20120217004922.GN23916@ZenIV.linux.org.uk>
On Fri, Feb 17, 2012 at 12:49:22AM +0000, Al Viro wrote:
> Folks, this is not a false positive and it has nothing to do with misannotation
> for directories. Deadlock is real; I have no idea WTF do we what ->i_mutex
> held over that area in hugetlbfs ->mmap(), but doing that is really, really
> wrong, whatever the reason.
Arrrrgh... Some grepping around has uncovered another deadlock on
i_mutex/mmap_sem and this one is not hard to hit at all.
Thread A:
opens file on UDF (O_RDWR open)
does big, fat write() to it
Thread B:
opens the same file (also O_RDWR)
mmaps it
closes
does munmap()
and there we are - munmap() will end up closing the second struct file,
call udf_release_file() and we are hitting ->i_mutex while under
->mmap_sem. Blocking on it, actually, since generic_file_aio_write()
in the first thread is holding ->i_mutex. And as soon as thread A gets
around to faulting the next piece of data in, well... To widen the
window a lot, mmap something large sitting on NFS and do write() from
that mmapped area. Race window as wide as one could ask for...
What happens there is prealloc discard on close; do we even want ->i_mutex
there these days? Note that there's also
down_write(&UDF_I(inode)->i_data_sem);
in udf_release_file()...
next parent reply other threads:[~2012-02-17 17:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20120217000856.GA13112@redhat.com>
[not found] ` <20120217001634.GH23550@zod.bos.redhat.com>
[not found] ` <20120217003848.GB20071@boyd>
[not found] ` <20120217004922.GN23916@ZenIV.linux.org.uk>
2012-02-17 17:48 ` Al Viro [this message]
2012-02-20 16:01 ` udf deadlock (was Re: hugetlbfs lockdep spew revisited.) Jan Kara
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=20120217174818.GP23916@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=davej@redhat.com \
--cc=jack@suse.cz \
--cc=jwboyer@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tyhicks@canonical.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;
as well as URLs for NNTP newsgroup(s).