From: Andreas Dilger <adilger@sun.com>
To: Jayson King <dev@jaysonking.com>
Cc: linux-ext4@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>
Subject: Re: [Bug 9692] New: journal_data mount option causes filesystem
Date: Mon, 7 Jan 2008 16:14:07 -0700 [thread overview]
Message-ID: <20080107231407.GX3351@webber.adilger.int> (raw)
In-Reply-To: <478180BD.3050204@jaysonking.com>
On Jan 06, 2008 19:30 -0600, Jayson King wrote:
> This looks to be an off-by-one bug with e2fsck in the function
> check_blocks(), and there isn't any actual filesystem corruption
> (e2fsck causes the corruption).
This is actually a problem for cases where blocksize != pagesize.
We have a similar patch in our e2fsprogs, and I thought we sent
an equivalent patch to Ted previously...
- (pb.last_block / blkpg * blkpg != pb.last_block ||
+ ((pb.last_block+1) / blkpg * blkpg != (pb.last_block+1) ||
Signed-off-by: Kalpak Shah <kalpak.shah@sun.com>
Signed-off-by: Andreas Dilger <adilger@sun.com>
> >From 654f24814e7b80d3b16bec2a67c13c43cb20eb2f Mon Sep 17 00:00:00 2001
> From: Jayson R. King <dev@jaysonking.com>
> Date: Sun, 6 Jan 2008 18:14:18 -0600
> Subject: e2fsck: Fix off-by-one error in check_blocks()
>
> e2fsck allows extra blocks to be allocated to an inode up to the next
> multiple of page size iff the block size is not equal to page size. An
> off-by-one error in checking for this causes e2fsck to wrongly detect
> a bad i_size for such inodes and results in incorrectly adjusting the
> i_size to include those blocks.
>
> Signed-off-by: Jayson R. King <dev@jaysonking.com>
> ---
> e2fsck/pass1.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
> index 56218ae..7bf0686 100644
> --- a/e2fsck/pass1.c
> +++ b/e2fsck/pass1.c
> @@ -1593,7 +1593,7 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
> if ((pb.last_block >= 0) &&
> /* allow allocated blocks to end of PAGE_SIZE */
> (size < (__u64)pb.last_block * fs->blocksize) &&
> - (pb.last_block / blkpg * blkpg != pb.last_block ||
> + ((pb.last_block+1) & (blkpg-1) != 0 ||
> size < (__u64)(pb.last_block & ~(blkpg-1)) *fs->blocksize))
> bad_size = 3;
> else if (size > ext2_max_sizes[fs->super->s_log_block_size])
> --
> 1.5.3.3
>
>
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
prev parent reply other threads:[~2008-01-07 23:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-07 1:30 [Bug 9692] New: journal_data mount option causes filesystem Jayson King
2008-01-07 23:14 ` Andreas Dilger [this message]
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=20080107231407.GX3351@webber.adilger.int \
--to=adilger@sun.com \
--cc=dev@jaysonking.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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