From: Andrew Morton <akpm@linux-foundation.org>
To: Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/5] jbd: Fail to load a journal if it is too short
Date: Tue, 21 Jul 2009 09:19:46 -0700 [thread overview]
Message-ID: <20090721091946.06bcdef8.akpm@linux-foundation.org> (raw)
In-Reply-To: <1248170659-11771-2-git-send-email-jack@suse.cz>
On Tue, 21 Jul 2009 12:04:15 +0200 Jan Kara <jack@suse.cz> wrote:
> Due to on disk corruption, it can happen that journal is too short. Fail
> to load it in such case so that we don't oops somewhere later.
>
> Reported-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> fs/jbd/journal.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
> index 737f724..94a64a1 100644
> --- a/fs/jbd/journal.c
> +++ b/fs/jbd/journal.c
> @@ -848,6 +848,12 @@ static int journal_reset(journal_t *journal)
>
> first = be32_to_cpu(sb->s_first);
> last = be32_to_cpu(sb->s_maxlen);
> + if (first + JFS_MIN_JOURNAL_BLOCKS > last + 1) {
> + printk(KERN_ERR "JBD: Journal too short (blocks %lu-%lu).\n",
> + first, last);
> + journal_fail_superblock(journal);
> + return -EINVAL;
> + }
>
> journal->j_first = first;
> journal->j_last = last;
It's odd that sb->s_first/s_maxlen are 32-bit and
journal->j_first/j_last are unsigned long.
These things will only ever be 32-bit unless we change the journal
superblock.
next prev parent reply other threads:[~2009-07-21 16:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-21 10:04 [PATCH 0/5] ext3/jbd patches in my patch queue Jan Kara
2009-07-21 10:04 ` [PATCH 1/5] jbd: Fail to load a journal if it is too short Jan Kara
2009-07-21 16:19 ` Andrew Morton [this message]
2009-07-21 16:50 ` Andreas Dilger
2009-07-21 21:35 ` Theodore Tso
2009-07-22 9:52 ` Jan Kara
2009-07-21 10:04 ` [PATCH 2/5] ext3: Fix truncation of symlinks after failed write Jan Kara
2009-07-21 10:04 ` [PATCH 3/5] jbd: Fix a race between checkpointing code and journal_get_write_access() Jan Kara
2009-07-21 10:04 ` [PATCH 4/5] ext3: Get rid of extenddisksize parameter of ext3_get_blocks_handle() Jan Kara
2009-07-21 10:04 ` [PATCH 5/5] jbd: fix race between write_metadata_buffer and get_write_access 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=20090721091946.06bcdef8.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=jack@suse.cz \
--cc=linux-ext4@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.