Skip to contentSkip to conversation

do_generic_file_read: clear page errors when issuing a fresh read of the page

RFC PATCH New Jeff Moyer 1 participant 1 message Jan 23, 2009

Subsystems (2)
lore
Share & tools
lore

Jeff Moyer

author
#0 lore raw

RFC PATCH 1/1 do_generic_file_read: clear page errors when issuing a fresh read of the page

Hi,

In testing older kernels, I've seen I/O errors set PG_error for the page cache page (for a failure of the last path in a mulitpath setup). Then, when the device is back online, the page error is never cleared, so all reads from the previously bad disk location fail. You can actually get around this by simply mmap()ing the file (the device node, in my case) and accessing the page that way, as filemap_fault will clear the page error bit.

So, hopefully this patch makes sense. As implied above, I haven't verified empirically that this is the case on newer kernels (though, from code inspection, it looks to still be a problem). I'll try to reproduce the problem, but just in case I can't, I wanted to get this rfc out there.

Cheers,
Jeff

mm/filemap.c +6 -0
index 0e77f4a..3adafc8 100644
@@ -1139,6 +1139,12 @@ page_not_up_to_date_locked:
 		}
 
 readpage:
+		/*
+		 * If there was an I/O error flagged previously, clear it
+		 * here.  PG_error will be set again if the readpage fails.
+		 */
+		ClearPageError(page);
+
 		/* Start the actual read. The read will unlock the page. */
 		error = mapping->a_ops->readpage(filp, page);