public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [xfs-masters] lockdep report (2.6.26-rc2)
       [not found] ` <20080515220757.GS155679365@sgi.com>
@ 2008-05-18  8:26   ` Christoph Hellwig
  0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2008-05-18  8:26 UTC (permalink / raw)
  To: David Chinner; +Cc: xfs-masters, xfs, linux-mm

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-18  8:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1210858590.3900.1.camel@johannes.berg>
     [not found] ` <20080515220757.GS155679365@sgi.com>
2008-05-18  8:26   ` [xfs-masters] lockdep report (2.6.26-rc2) Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox