1 Subject: Re-dirty pages on ENOSPC when converting delayed allocations
2 From: Lachlan McIlroy <lachlan@sgi.com>
3 References: 433112 - LTC48749
5 http://oss.sgi.com/archives/xfs/2008-10/msg00058.html
7 If we get an error in xfs_page_state_convert() - and it's not EAGAIN - then
8 we throw away the dirty page without converting the delayed allocation. This
9 leaves delayed allocations that can never be removed and confuses code that
10 expects a flush of the file to clear them. We need to re-dirty the page on
11 error so we can try again later or report that the flush failed.
14 This change is needed to handle the condition where we are at ENOSPC and we
15 exhaust the reserved block pool (because many transactions are executing
16 concurrently) and calls to xfs_trans_reserve() start failing with ENOSPC
20 Version 2 wont return EAGAIN from xfs_vm_writepage() and also converts an
21 ENOSPC error to an EAGAIN for asynchronous writeback to avoid setting an
22 error in the inode mapping when we don't need to.
24 Signed-off-by: Olaf Hering <olh@suse.de>
26 fs/xfs/linux-2.6/xfs_aops.c | 21 ++++-----------------
27 1 file changed, 4 insertions(+), 17 deletions(-)
29 --- a/fs/xfs/linux-2.6/xfs_aops.c
30 +++ b/fs/xfs/linux-2.6/xfs_aops.c
31 @@ -1147,16 +1147,6 @@ error:
33 xfs_cancel_ioend(iohead);
36 - * If it's delalloc and we have nowhere to put it,
37 - * throw it away, unless the lower layers told
40 - if (err != -EAGAIN) {
42 - block_invalidatepage(page, 0);
43 - ClearPageUptodate(page);
48 @@ -1185,7 +1175,7 @@ xfs_vm_writepage(
50 struct writeback_control *wbc)
55 int delalloc, unmapped, unwritten;
56 struct inode *inode = page->mapping->host;
57 @@ -1231,19 +1221,16 @@ xfs_vm_writepage(
58 * to real space and flush out to disk.
60 error = xfs_page_state_convert(inode, page, wbc, 1, unmapped);
61 - if (error == -EAGAIN)
63 if (unlikely(error < 0))
70 redirty_page_for_writepage(wbc, page);
75 + if (error == -EAGAIN)