From: Chris Mason <mason@suse.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Andrea Arcangeli <andrea@suse.de>,
linux-kernel@vger.kernel.org, torvalds@osdl.org
Subject: Re: writepage fs corruption fixes
Date: Fri, 09 Jul 2004 08:43:17 -0400 [thread overview]
Message-ID: <1089376996.3956.141.camel@watt.suse.com> (raw)
In-Reply-To: <20040708215645.16d0f227.akpm@osdl.org>
On Fri, 2004-07-09 at 00:56, Andrew Morton wrote:
> Andrea Arcangeli <andrea@suse.de> wrote:
> >
> > BTW, the new mpage code looks great,
>
> You should have seen the first version! But after all the bugs were fixed
> and the real world hit it, some spaghetti got in there.
>
> > it's a pity that reiserfs and ext3 don't use it yet.
>
> JFS, hfs, hfsplus and ext2 are using it.
>
> Unfortunately it's hard to use mpage_writepages() even in ext3's writeback
> mode, because ext3_get_block() assumes that it is called with a transaction
> open. Not impossible though I guess - use a different get_block() which
> opens a transaction for itself... But only open it if the page isn't
> already mapped to disk. (/me gets itchy fingers)
Thanks Andrea!
The real problem for ext3 and reiserfs using writepages isn't the
transaction I thought, but the data=ordered buffer based writeback. The
page lock and page writeback bit are critical to the writepages locking,
which we don't take when doing data=ordered writes.
Since we're fixing writepages, here's a much more minor fix. When the
page has buffers, and fs blocksize is < then the page size, and file eof
falls in the second to last buffer in the page, we will goto
page_is_mapped, which doesn't zero the bytes past eof.
The fix is to move up page_is_mapped slightly.
-chris
Index: linux.t/fs/mpage.c
===================================================================
--- linux.t.orig/fs/mpage.c 2004-07-01 11:07:17.000000000 -0400
+++ linux.t/fs/mpage.c 2004-07-08 12:51:44.915892528 -0400
@@ -490,6 +489,8 @@ mpage_writepage(struct bio *bio, struct
first_unmapped = page_block;
+page_is_mapped:
+
end_index = i_size_read(inode) >> PAGE_CACHE_SHIFT;
if (page->index >= end_index) {
unsigned offset = i_size_read(inode) & (PAGE_CACHE_SIZE - 1);
@@ -503,8 +504,6 @@ mpage_writepage(struct bio *bio, struct
kunmap_atomic(kaddr, KM_USER0);
}
-page_is_mapped:
-
/*
* This page will go to BIO. Do we need to send this BIO off first?
*/
next prev parent reply other threads:[~2004-07-09 12:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-09 4:01 Andrea Arcangeli
2004-07-09 4:06 ` Andrea Arcangeli
2004-07-09 4:19 ` Andrea Arcangeli
2004-07-09 4:29 ` Andrew Morton
2004-07-09 4:42 ` Andrea Arcangeli
2004-07-09 4:56 ` Andrew Morton
2004-07-09 12:43 ` Chris Mason [this message]
2004-07-10 0:16 ` Andrea Arcangeli
2004-07-10 1:07 ` Andrea Arcangeli
2004-07-10 4:30 ` Andrew Morton
2004-07-10 4:59 ` Andrea Arcangeli
2004-07-10 5:56 ` Andrew Morton
2004-07-10 6:11 ` Andrea Arcangeli
2004-07-10 6:13 ` Andrew Morton
2004-07-14 16:14 ` Andrea Arcangeli
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=1089376996.3956.141.camel@watt.suse.com \
--to=mason@suse.com \
--cc=akpm@osdl.org \
--cc=andrea@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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
all inboxes | Powered by JetHome®