linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: David Chinner <dgc@sgi.com>
Cc: xfs-masters@oss.sgi.com, xfs <xfs@oss.sgi.com>,
	linux-mm <linux-mm@kvack.org>
Subject: Re: [xfs-masters] lockdep report (2.6.26-rc2)
Date: Sun, 18 May 2008 04:26:18 -0400	[thread overview]
Message-ID: <20080518082618.GA27923@infradead.org> (raw)
In-Reply-To: <20080515220757.GS155679365@sgi.com>

On Fri, May 16, 2008 at 08:07:57AM +1000, David Chinner wrote:
> Fundamentally  - if a filesystem takes the same lock in
> ->file_aio_read as it does in ->release, then this will happen.
> The lock outside the filesystem (the mmap lock) is can be taken
> before we enter the filesystem or while we are inside a filesystem
> method reading or writing data.
> 
> In this case, XFS uses the iolock to serialise I/O vs truncate.
> We hold the iolock shared over read I/O, and exclusive when we
> do a truncate. The truncate in this case is a truncate of blocks
> past EOF on ->release. 
> 
> Whether this can deadlock depends on whether these two things can
> happen on the same mmap->sem and same inode at the same time.
> I know they can happen onteh same inode at the same time, but
> can this happen on the same mmap->sem? VM gurus?

I think it can.  Think of a process with two threads, and two open file
instances of the same inode.

thread 1:
	in read() fauling in from the inode via file 1

thread 2:
	at the same time dropping the last reference to a file via
	munmap.

Getting this right would mean not doing any fputs from under the
mmap_seem in munmap.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2008-05-18  8:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1210858590.3900.1.camel@johannes.berg>
2008-05-15 22:07 ` [xfs-masters] lockdep report (2.6.26-rc2) David Chinner
2008-05-18  8:26   ` Christoph Hellwig [this message]

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=20080518082618.GA27923@infradead.org \
    --to=hch@infradead.org \
    --cc=dgc@sgi.com \
    --cc=linux-mm@kvack.org \
    --cc=xfs-masters@oss.sgi.com \
    --cc=xfs@oss.sgi.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).