• Nick Piggin's avatar
    mm: fix warning on memory offline · 3a902c5f
    Nick Piggin authored
    KAMEZAWA Hiroyuki found a warning message in the buffer dirtying code that
    is coming from page migration caller.
    
    WARNING: at fs/buffer.c:720 __set_page_dirty+0x330/0x360()
    Call Trace:
     [<a000000100015220>] show_stack+0x80/0xa0
     [<a000000100015270>] dump_stack+0x30/0x60
     [<a000000100089ed0>] warn_on_slowpath+0x90/0xe0
     [<a0000001001f8b10>] __set_page_dirty+0x330/0x360
     [<a0000001001ffb90>] __set_page_dirty_buffers+0xd0/0x280
     [<a00000010012fec0>] set_page_dirty+0xc0/0x260
     [<a000000100195670>] migrate_page_copy+0x5d0/0x5e0
     [<a000000100197840>] buffer_migrate_page+0x2e0/0x3c0
     [<a000000100195eb0>] migrate_pages+0x770/0xe00
    
    What was happening is that migrate_page_copy wants to transfer the PG_dirty
    bit from old page to new page, so what it would do is set_page_dirty(newpage).
    However set_page_dirty() is used to set the entire page dirty, wheras in
    this case, only part of the page was dirty, and it also was not uptodate.
    
    Marking the whole page dirty with set_page_dirty would lead to corruption or
    unresolvable conditions -- a dirty && !uptodate page and dirty && !uptodate
    buffers.
    
    Possibly we could just ClearPageDirty(oldpage); SetPageDirty(newpage);
    however in the interests of keeping the change minimal...
    Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
    Tested-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    3a902c5f
migrate.c 24.6 KB