diff --git a/fs/jfs/jfs_imap.h b/fs/jfs/jfs_imap.h index dd7409febe28..025d72890dac 100644 --- a/fs/jfs/jfs_imap.h +++ b/fs/jfs/jfs_imap.h @@ -35,6 +35,8 @@ #define INOPBLK(pxd,ino,l2nbperpg) (addressPXD((pxd)) + \ ((((ino) & (INOSPEREXT-1)) >> L2INOSPERPAGE) << (l2nbperpg))) +#define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */ + /* * inode allocation map: * diff --git a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c index 98f9a432c336..5f921ab5923b 100644 --- a/fs/jfs/jfs_mount.c +++ b/fs/jfs/jfs_mount.c @@ -52,6 +52,7 @@ * forward references */ static int chkSuper(struct super_block *); +static int chkImap(struct jfs_sb_info *sbi); static int logMOUNT(struct super_block *sb); /* @@ -153,6 +154,12 @@ int jfs_mount(struct super_block *sb) rc); goto err_ipaimap2; } + + if ((rc = chkImap(sbi))) { + jfs_err("jfs_mount: AG control data mismatch, rc = %d", + rc); + goto err_ipaimap2; + } } else /* Secondary aggregate inode table is not valid */ sbi->ipaimap2 = NULL; @@ -393,6 +400,16 @@ static int chkSuper(struct super_block *sb) return rc; } +static int chkImap(struct jfs_sb_info *sbi) +{ + struct dinomap *imap, *imap2; + + imap = &JFS_IP(sbi->ipaimap)->i_imap->im_imap; + imap2 = &JFS_IP(sbi->ipaimap2)->i_imap->im_imap; + + return (memcmp(imap->in_agctl, imap2->in_agctl, + sizeof(struct iagctl) * MAXAG) ? -EFSCORRUPTED : 0); +} /* * updateSuper()