aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/super.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2008-12-11 18:04:14 -0500
committerMark Fasheh <mfasheh@suse.com>2009-01-05 11:40:34 -0500
commitd030cc978e9e636dc39ce9a9e8282d48698a3b30 (patch)
tree0d9053e2968eba3505c8333b96869b9d2a16cccc /fs/ocfs2/super.c
parentc175a518b4a1d514483abf61813ce5d855917164 (diff)
ocfs2: Validate superblock with checksum and ecc.
The superblock is read via a raw call. Validate it after we find it from its signature. Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/super.c')
-rw-r--r--fs/ocfs2/super.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 2eb657c3e7a8..43ed11345b59 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -52,6 +52,7 @@
52#include "ocfs1_fs_compat.h" 52#include "ocfs1_fs_compat.h"
53 53
54#include "alloc.h" 54#include "alloc.h"
55#include "blockcheck.h"
55#include "dlmglue.h" 56#include "dlmglue.h"
56#include "export.h" 57#include "export.h"
57#include "extent_map.h" 58#include "extent_map.h"
@@ -1989,6 +1990,15 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di,
1989 1990
1990 if (memcmp(di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE, 1991 if (memcmp(di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE,
1991 strlen(OCFS2_SUPER_BLOCK_SIGNATURE)) == 0) { 1992 strlen(OCFS2_SUPER_BLOCK_SIGNATURE)) == 0) {
1993 /* We have to do a raw check of the feature here */
1994 if (le32_to_cpu(di->id2.i_super.s_feature_incompat) &
1995 OCFS2_FEATURE_INCOMPAT_META_ECC) {
1996 status = ocfs2_block_check_validate(bh->b_data,
1997 bh->b_size,
1998 &di->i_check);
1999 if (status)
2000 goto out;
2001 }
1992 status = -EINVAL; 2002 status = -EINVAL;
1993 if ((1 << le32_to_cpu(di->id2.i_super.s_blocksize_bits)) != blksz) { 2003 if ((1 << le32_to_cpu(di->id2.i_super.s_blocksize_bits)) != blksz) {
1994 mlog(ML_ERROR, "found superblock with incorrect block " 2004 mlog(ML_ERROR, "found superblock with incorrect block "
@@ -2030,6 +2040,7 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di,
2030 } 2040 }
2031 } 2041 }
2032 2042
2043out:
2033 mlog_exit(status); 2044 mlog_exit(status);
2034 return status; 2045 return status;
2035} 2046}