]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
ocfs2: Validate superblock with checksum and ecc.
authorJoel Becker <joel.becker@oracle.com>
Thu, 11 Dec 2008 23:04:14 +0000 (15:04 -0800)
committerMark Fasheh <mfasheh@suse.com>
Mon, 5 Jan 2009 16:40:34 +0000 (08:40 -0800)
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>
fs/ocfs2/super.c

index 2eb657c3e7a8f6694c419fea0787dba800d9e781..43ed11345b59fdf7ac8c00596b14491a4e89eb20 100644 (file)
@@ -52,6 +52,7 @@
 #include "ocfs1_fs_compat.h"
 
 #include "alloc.h"
+#include "blockcheck.h"
 #include "dlmglue.h"
 #include "export.h"
 #include "extent_map.h"
@@ -1989,6 +1990,15 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di,
 
        if (memcmp(di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE,
                   strlen(OCFS2_SUPER_BLOCK_SIGNATURE)) == 0) {
+               /* We have to do a raw check of the feature here */
+               if (le32_to_cpu(di->id2.i_super.s_feature_incompat) &
+                   OCFS2_FEATURE_INCOMPAT_META_ECC) {
+                       status = ocfs2_block_check_validate(bh->b_data,
+                                                           bh->b_size,
+                                                           &di->i_check);
+                       if (status)
+                               goto out;
+               }
                status = -EINVAL;
                if ((1 << le32_to_cpu(di->id2.i_super.s_blocksize_bits)) != blksz) {
                        mlog(ML_ERROR, "found superblock with incorrect block "
@@ -2030,6 +2040,7 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di,
                }
        }
 
+out:
        mlog_exit(status);
        return status;
 }