* fput under mmap_sem
[not found] ` <20090315221921.GY26138@disturbed>
@ 2009-03-18 7:13 ` Christoph Hellwig
2009-03-18 12:37 ` Nick Piggin
0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2009-03-18 7:13 UTC (permalink / raw)
To: xfs, linux-mm
On Mon, Mar 16, 2009 at 09:19:21AM +1100, Dave Chinner wrote:
> This is a VM problem where it calls fput() with the mmap_sem() held
> in remove_vma(). It makes the incorrect assumption that filesystems
> will never use the same lock in the IO path and the inode release path.
>
> This can deadlock if you are really unlucky.
I really wonder why other filesystems haven't hit this yet. Any chance
we can get the fput moved out of mmap_sem to get rid of this class of
problems?
--
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: fput under mmap_sem
2009-03-18 7:13 ` fput under mmap_sem Christoph Hellwig
@ 2009-03-18 12:37 ` Nick Piggin
0 siblings, 0 replies; 2+ messages in thread
From: Nick Piggin @ 2009-03-18 12:37 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs, linux-mm
On Wednesday 18 March 2009 18:13:13 Christoph Hellwig wrote:
> On Mon, Mar 16, 2009 at 09:19:21AM +1100, Dave Chinner wrote:
> > This is a VM problem where it calls fput() with the mmap_sem() held
> > in remove_vma(). It makes the incorrect assumption that filesystems
> > will never use the same lock in the IO path and the inode release path.
> >
> > This can deadlock if you are really unlucky.
>
> I really wonder why other filesystems haven't hit this yet. Any chance
> we can get the fput moved out of mmap_sem to get rid of this class of
> problems?
Yes I don't think there is any reason against holding the file refcount
a little longer, but it can be pretty nasty to do in practice because
of deep call chains and sometimes multiple fputs within a given lock
section.
Possibly the easiest and quickest way will be to move aio's deferred
__fput into a usable API and try that. If there are any performance
problems, then we can try to move those fputs out from the mmap_sem
one at a time (eg. I don't expect fput for vma replacement/merging to
often cause the refcount to reach 0, and this is one of the harder
places; wheras fput for a simple munmap might be more often causing
refcount to reach 0 but it should be simpler to move out of mmap_sem
if it is a problem).
--
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-03-18 12:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <200903151459.01320.denys@visp.net.lb>
[not found] ` <20090315221921.GY26138@disturbed>
2009-03-18 7:13 ` fput under mmap_sem Christoph Hellwig
2009-03-18 12:37 ` Nick Piggin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox