linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@sun.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jan Kara <jack@suse.cz>, 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 10:50:14 -0600	[thread overview]
Message-ID: <20090721165014.GI4231@webber.adilger.int> (raw)
In-Reply-To: <20090721091946.06bcdef8.akpm@linux-foundation.org>

On Jul 21, 2009  09:19 -0700, Andrew Morton wrote:
> 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.

The jbd on disk structure and APIs cannot handle 64-bit block numbers.
That is one of the first changes we made for jbd2 so that it is possible
to store either 32-bit or 64-bit block numbers in a transaction.  I don't
think that needs to be fixed for the jbd code.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.


  reply	other threads:[~2009-07-21 16:50 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
2009-07-21 16:50     ` Andreas Dilger [this message]
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=20090721165014.GI4231@webber.adilger.int \
    --to=adilger@sun.com \
    --cc=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 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).