From: Jan Kara <jack@suse.cz>
To: LKML <linux-kernel@vger.kernel.org>
Cc: linux-ext4@vger.kernel.org, Jan Kara <jack@suse.cz>
Subject: [PATCH 2/4] ext3: Avoid false EIO errors
Date: Tue, 17 Mar 2009 18:33:53 +0100 [thread overview]
Message-ID: <1237311235-13623-3-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1237311235-13623-2-git-send-email-jack@suse.cz>
Sometimes block_write_begin() can map buffers in a page but later we
fail to copy data into those buffers (because the source page has
been paged out in the mean time). We then end up with !uptodate mapped
buffers. We must not file such buffers into a transaction - firstly they
contain garbage and secondly it confuses the journaling code (it thinks
write has failed and complains about IO errors).
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext3/inode.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 62005c0..d351eab 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1430,7 +1430,11 @@ static int bput_one(handle_t *handle, struct buffer_head *bh)
static int journal_dirty_data_fn(handle_t *handle, struct buffer_head *bh)
{
- if (buffer_mapped(bh))
+ /*
+ * Parallel write could have mapped the buffer but it didn't copy
+ * the data in yet. So avoid filing such buffer into a transaction.
+ */
+ if (buffer_mapped(bh) && buffer_uptodate(bh))
return ext3_journal_dirty_data(handle, bh);
return 0;
}
--
1.6.0.2
next prev parent reply other threads:[~2009-03-17 19:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-17 17:33 [PATCH 0/4] Fix bugs and possible data corruption if blocksize < pagesize Jan Kara
2009-03-17 17:33 ` [PATCH 1/4] ext3: Fix false EIO errors Jan Kara
2009-03-17 17:33 ` Jan Kara [this message]
2009-03-17 17:33 ` [PATCH 3/4] fs: Avoid data corruption with blocksize < pagesize Jan Kara
2009-03-17 17:33 ` [PATCH 4/4] fs: Warn about writing !uptodate buffers Jan Kara
2009-03-18 12:07 ` Nick Piggin
2009-03-18 12:00 ` [PATCH 3/4] fs: Avoid data corruption with blocksize < pagesize Nick Piggin
2009-03-18 14:13 ` Jan Kara
2009-03-18 18:57 ` Jan Kara
2009-03-18 18:42 ` Aneesh Kumar K.V
2009-03-18 18:50 ` Jan Kara
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=1237311235-13623-3-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=linux-ext4@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).