Skip to contentSkip to conversation

Re-dirty pages on I/O error

PATCH In review Lachlan McIlroy 3 participants 4 messages Feb 10, 2009 – Feb 15, 2009 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Re-dirty pages on I/O error

[This patch seems to have slipped through the proverbial crack.]

If we get an error in xfs_page_state_convert() - and it's not EAGAIN - then we throw away the dirty page without converting the delayed allocation. This leaves delayed allocations that can never be removed and confuses code that expects a flush of the file to clear them. We need to re-dirty the page on error so we can try again later or report that the flush failed.

fs/xfs/linux-2.6/xfs_aops.c +4 -17
Index: xfs-fixes/fs/xfs/linux-2.6/xfs_aops.c
===================================================================
@@ -1185,16 +1185,6 @@ error:
 	if (iohead)
 		xfs_cancel_ioend(iohead);
 
-	/*
-	 * If it's delalloc and we have nowhere to put it,
-	 * throw it away, unless the lower layers told
-	 * us to try again.
-	 */
-	if (err != -EAGAIN) {
-		if (!unmapped)
-			block_invalidatepage(page, 0);
-		ClearPageUptodate(page);
-	}
 	return err;
 }
 
@@ -1223,7 +1213,7 @@ xfs_vm_writepage(
 	struct page		*page,
 	struct writeback_control *wbc)
 {
-	int			error;
+	int			error = 0;
 	int			need_trans;
 	int			delalloc, unmapped, unwritten;
 	struct inode		*inode = page->mapping->host;
@@ -1269,19 +1259,16 @@ xfs_vm_writepage(
 	 * to real space and flush out to disk.
 	 */
 	error = xfs_page_state_convert(inode, page, wbc, 1, unmapped);
-	if (error == -EAGAIN)
-		goto out_fail;
 	if (unlikely(error < 0))
-		goto out_unlock;
+		goto out_fail;
 
 	return 0;
 
 out_fail:
 	redirty_page_for_writepage(wbc, page);
 	unlock_page(page);
-	return 0;
-out_unlock:
-	unlock_page(page);
+	if (error == -EAGAIN)
+		error = 0;
 	return error;
 }
 

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 7 lines · Lachlan McIlroy

[This patch seems to have slipped through the proverbial crack.]

If we get an error in xfs_page_state_convert() - and it's not EAGAIN - then we throw away the dirty page without converting the delayed allocation. This leaves delayed allocations that can never be removed and confuses code that expects a flush of the file to clear them. We need to re-dirty the page on error so we can try again later or report that the flush failed.

As discussed previously, the fix that is needed in the page invalidation path. i.e. the page invalidate path clears the buffer_delay() flag (via discard_buffer) before we get to ->releasepage and so releasepage fails to convert the delalloc extent before tossing the page....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#2 lore raw
Quoted 9 lines · Dave Chinner
Quoted 7 lines · Lachlan McIlroy

[This patch seems to have slipped through the proverbial crack.]

If we get an error in xfs_page_state_convert() - and it's not EAGAIN - then we throw away the dirty page without converting the delayed allocation. This leaves delayed allocations that can never be removed and confuses code that expects a flush of the file to clear them. We need to re-dirty the page on error so we can try again later or report that the flush failed.

Quoted 5 lines

As discussed previously, the fix that is needed in the page invalidation path. i.e. the page invalidate path clears the buffer_delay() flag (via discard_buffer) before we get to ->releasepage and so releasepage fails to convert the delalloc extent before tossing the page....

I'll leave it up to you to implement that then Dave since I think you are the only one who understands your angle of attack.

Meanwhile we have this patch running on customer systems and it's fixed the problems they were having with orphaned delayed allocations being left behind due to pages being erroneously invalidated.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
In reply to Dave Chinner
Quoted 9 lines · Dave Chinner
Quoted 7 lines · Lachlan McIlroy

[This patch seems to have slipped through the proverbial crack.]

If we get an error in xfs_page_state_convert() - and it's not EAGAIN - then we throw away the dirty page without converting the delayed allocation. This leaves delayed allocations that can never be removed and confuses code that expects a flush of the file to clear them. We need to re-dirty the page on error so we can try again later or report that the flush failed.

Quoted 5 lines

As discussed previously, the fix that is needed in the page invalidation path. i.e. the page invalidate path clears the buffer_delay() flag (via discard_buffer) before we get to ->releasepage and so releasepage fails to convert the delalloc extent before tossing the page....

And we need to get started on that fix rather sooner than later.

Any chance to get some testcase extrace from the scenarios at those customer sites?

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs