aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd/journal.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2009-07-15 14:36:08 -0400
committerJan Kara <jack@suse.cz>2009-07-15 15:26:23 -0400
commit7447a668a3860b66b3c9db86fdea91e355ba59ac (patch)
treef27e2c1df19e6558bce053e8ffa12bd121a30947 /fs/jbd/journal.c
parente9e961c9a818a2f24711af493b907a8e40a69efc (diff)
jbd: Fail to load a journal if it is too short
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>
Diffstat (limited to 'fs/jbd/journal.c')
-rw-r--r--fs/jbd/journal.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 737f7246a4b5..94a64a199a63 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -848,6 +848,12 @@ static int journal_reset(journal_t *journal)
848 848
849 first = be32_to_cpu(sb->s_first); 849 first = be32_to_cpu(sb->s_first);
850 last = be32_to_cpu(sb->s_maxlen); 850 last = be32_to_cpu(sb->s_maxlen);
851 if (first + JFS_MIN_JOURNAL_BLOCKS > last + 1) {
852 printk(KERN_ERR "JBD: Journal too short (blocks %lu-%lu).\n",
853 first, last);
854 journal_fail_superblock(journal);
855 return -EINVAL;
856 }
851 857
852 journal->j_first = first; 858 journal->j_first = first;
853 journal->j_last = last; 859 journal->j_last = last;