[PATCH 3/6] JFS: fsync wrong behavior when I/O failure occurs

[email protected] (Dave Kleikamp) Tue, 26 Jul 2005 10:10:47 -0500 (CDT)
Newsgroups gmane.comp.file-systems.jfs.patches
Message-ID <[email protected]>
JFS: fsync wrong behavior when I/O failure occurs

This is half of a patch that Qu Fuping submitted in April.  The first part
was applied to fs/mpage.c in 2.6.12-rc4.

jfs_fsync should return error, but it doesn't wait for the metadata page to
be uptodate, e.g.:
jfs_fsync->jfs_commit_inode->txCommit->diWrite->read_metapage->
__get_metapage->read_cache_page reads a page from disk. Because read is
async, when read_cache_page: err = filler(data, page), filler will not
return error, it just submits I/O request and returns. So, page is not
uptodate.  Checking only if(IS_ERROR(mp->page)) is not enough, we should
add "|| !PageUptodate(mp->page)"

Signed-off-by: Dave Kleikamp <[email protected]>

---
commit 3d9b1cdd2455017c6aa25bc2442092b81438981f
tree 0f0bf8deaeabc2d14fbded203392ec5bf7dc37ad
parent 56d1254917d9f301a8e24155cd3f2236e642cb7d
author Qu Fuping <[email protected]> Fri, 15 Jul 2005 10:36:08 -0500
committer Dave Kleikamp <[email protected]> Fri, 15 Jul 2005 10:36:08 -0500

 fs/jfs/jfs_metapage.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -640,7 +640,7 @@ struct metapage *__get_metapage(struct i
 	} else {
 		page = read_cache_page(mapping, page_index,
 			    (filler_t *)mapping->a_ops->readpage, NULL);
-		if (IS_ERR(page)) {
+		if (IS_ERR(page) || !PageUptodate(mp->page)) {
 			jfs_err("read_cache_page failed!");
 			return NULL;
 		}


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click