]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: delalloc for page dirtied out-of-band in fixup worker
authorJeff Mahoney <jeffm@suse.com>
Wed, 15 Feb 2012 15:23:57 +0000 (16:23 +0100)
committerDavid Sterba <dsterba@suse.cz>
Wed, 15 Feb 2012 15:40:25 +0000 (16:40 +0100)
commit39f04bf6c46105c19f5e8b4df96ba97a1aa05b54
tree7d95bf1ff03c82805903330a279a67642be68699
parent764e4c29e407bca0af28d35da2079813f508ed4b
btrfs: delalloc for page dirtied out-of-band in fixup worker

 We encountered an issue that was easily observable on s/390 systems but
 could really happen anywhere. The timing just seemed to hit reliably
 on s/390 with limited memory.

 The gist is that when an unexpected set_page_dirty() happened, we'd
 run into the BUG() in btrfs_writepage_fixup_worker since it wasn't
 properly set up for delalloc.

 This patch does the following:
 - Performs the missing delalloc in the fixup worker
 - Allow the start hook to return -EBUSY which informs __extent_writepage
   that it should mark the page skipped and not to redirty it. This is
   required since the fixup worker can fail with -ENOSPC and the page
   will have already been redirtied. That causes an Oops in
   drop_outstanding_extents later. Retrying the fixup worker could
   lead to an infinite loop. Deferring the page redirty also saves us
   some cycles since the page would be stuck in a resubmit-redirty loop
   until the fixup worker completes. It's not harmful, just wasteful.
 - If the fixup worker fails, we mark the page and mapping as errored,
   and end the writeback, similar to what we would do had the page
   actually been submitted to writeback.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/inode.c