[lkml]   [2004]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: 2.6.9-rc2-mm4 ps hang ?
Hugh Dickins <> wrote:
> lock_page inside mmap_sem a ranking bug? Please recant!

generic_file_buffered_write() can take mmap_sem for reading while holding a
page lock. In that rare case where the page gets unmapped even though we
manually faulted it in.

Now, that's lock_page->down_read versus down_read->lock_page which I
_think_ is safe, due to down_read semantics. Even if a third thread is
waiting for a down_write.

Except filemap_nopage() does lock_page too, so we have


as well.

All this does mean that down_write cannot nest either inside or outside

The bigger problem is ext3 and reiser3 transaction start/stop. It is
equivalent to a down()/up() operation and we get the ranking for that
inconsistent too. Both wrt lock_page and wrt, I think, down_read(mmap_sem).

generic_file_buffered_write() does, effectively


and over in do_mmap_pgoff() we nest transaction start inside

->transaction start

It's all a bit of a mess. Chris Mason and I have discussed it on and off.
I think Chris has a workload which actually does trigger a deadlock.

Maybe dropping and retaking mmap_sem in generic_file_mmap would be a
sufficient stopgap.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:06    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean