Unionfs: prevent multiple writers to lower_page
authorErez Zadok <ezk@cs.sunysb.edu>
Sun, 25 Nov 2007 23:27:27 +0000 (18:27 -0500)
committerErez Zadok <ezk@cs.sunysb.edu>
Sun, 23 Mar 2008 03:49:05 +0000 (23:49 -0400)
Without this patch, the LTP fs test "rwtest04" triggers a
BUG_ON(PageWriteback(page)) in fs/buffer.c:1706.

CC: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/mmap.c

index d8bae10d91b30f243219f1bfff0333ceeb5e1d8f..40ba2fcf25c4910569e32af5ba3978d29f20c578 100644 (file)
@@ -104,6 +104,7 @@ static int unionfs_writepage(struct page *page, struct writeback_control *wbc)
 
        BUG_ON(!lower_mapping->a_ops->writepage);
        clear_page_dirty_for_io(lower_page); /* emulate VFS behavior */
+       wait_on_page_writeback(lower_page); /* prevent multiple writers */
        err = lower_mapping->a_ops->writepage(lower_page, wbc);
        wbc->for_writepages = saved_for_writepages; /* restore value */
        if (err < 0)