From: Hisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp>
To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: [PATCH] fix invalidate_inode_pages2_range not to clear ret
Date: Thu, 13 Dec 2007 13:50:41 +0900 [thread overview]
Message-ID: <6.0.0.20.2.20071213133952.03e19d70@172.19.0.2> (raw)
Hi.
DIO invalidates page cache through invalidate_inode_pages2_range().
invalidate_inode_pages2_range() sets ret=-EIO when invalidate_complete_page2()
fails, but this ret is cleared if do_launder_page() succeed on a page of
next index.
In this case, dio is carried out even if invalidate_complete_page2() fails
on some pages.
This can cause inconsistency between memory and blocks on HDD because the page
cache still exists.
Following patch fixes this issue.
Thanks.
Signed-off-by :Hisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp>
diff -Nrup linux-2.6.24-rc5.org/mm/truncate.c linux-2.6.24-rc5/mm/truncate.c
--- linux-2.6.24-rc5.org/mm/truncate.c 2007-12-12 16:32:45.000000000 +0900
+++ linux-2.6.24-rc5/mm/truncate.c 2007-12-13 11:45:29.000000000 +0900
@@ -392,6 +392,7 @@ int invalidate_inode_pages2_range(struct
pgoff_t next;
int i;
int ret = 0;
+ int ret2 = 0;
int did_range_unmap = 0;
int wrapped = 0;
@@ -441,13 +442,13 @@ int invalidate_inode_pages2_range(struct
BUG_ON(page_mapped(page));
ret = do_launder_page(mapping, page);
if (ret == 0 && !invalidate_complete_page2(mapping, page))
- ret = -EIO;
+ ret2 = -EIO;
unlock_page(page);
}
pagevec_release(&pvec);
cond_resched();
}
- return ret;
+ return !ret ? ret2 : ret;
}
EXPORT_SYMBOL_GPL(invalidate_inode_pages2_range);
next reply other threads:[~2007-12-13 4:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-13 4:50 Hisashi Hifumi [this message]
2007-12-13 18:58 ` [PATCH] fix invalidate_inode_pages2_range not to clear ret Zach Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6.0.0.20.2.20071213133952.03e19d70@172.19.0.2 \
--to=hifumi.hisashi@oss.ntt.co.jp \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).