Re: [PATCH 05/11] mm: compaction: Determine if dirty pages can be migrated without blocking within ->migratepage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 17 Dec 2011 11:03:01 +0800 Nai Xia <nai.xia@xxxxxxxxx> wrote:

> On Saturday 17 December 2011 07:20:54 Andrew Morton wrote:
> > 
> > I hadn't paid a lot of attention to buffer_migrate_page() before. 
> > Scary function.  I'm rather worried about its interactions with ext3
> > journal commit which locks buffers then plays with them while leaving
> > the page unlocked.  How vigorously has this been whitebox-tested?
> 
> buffer_migrate_page() is done under page lock & buffer head locks.
> 
> I had assumed that anyone who has locked the buffer_heads should 
> also have a stable relationship between buffer_head <---> page,
> otherwise, the buffer_head locking semantics should be broken itself ?
> 
> I am actually using the similar logic for some other stuff,
> it will make me cry if it can really crash ext3....

It's complicated ;) JBD attaches a journal_head to the buffer_head and
thereby largely increases the amount of metadata in the buffer_head. 
Locking the buffer_head isn't considered to have locked the
journal_head, although it might often work out that way.

I don't see anything in the journal_head which refers to the page
contents (b_committed_data points to a JBD-private copy of the data),
and buffer_migrate_page() migrates the buffers to a new page, rather
than migrating new buffers to the new page.

We should check that the b_committed_data copy is taken under
lock_buffer() (surely true).

The core writeback code will initiate writeback against buffer_heads
and will then unlock the page.  But in that case the buffer_heads are
locked and come unlocked after writeback has completed.  So that should
be OK.

set_page_dirty() and friends can sometimes play with an unlocked page
and even unlocked buffers, from IRQ context iirc.  If there are
problems around this, taking ->private_lock in buffer_migrate_page()
will help...

It's just ...  scary.  Whether there are gremlins in there (or in other
filesystems!) I just don't know.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]