[Ocfs2-tools-devel] [PATCH 2/9] libocfs2: Check for unsupported features in the journal superblock.

Joel Becker joel.becker at oracle.com
Tue Sep 9 17:57:09 PDT 2008


ocfs2_read_journal_superblock() should fail if it finds unsupported
features.

Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
 libocfs2/mkjournal.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/libocfs2/mkjournal.c b/libocfs2/mkjournal.c
index 3812690..71bdfa4 100644
--- a/libocfs2/mkjournal.c
+++ b/libocfs2/mkjournal.c
@@ -165,6 +165,16 @@ errcode_t ocfs2_read_journal_superblock(ocfs2_filesys *fs, uint64_t blkno,
 	memcpy(jsb_buf, blk, fs->fs_blocksize);
 	ocfs2_swap_journal_superblock(jsb);
 
+	if (JBD2_HAS_INCOMPAT_FEATURE(jsb, ~JBD2_KNOWN_INCOMPAT_FEATURES)) {
+		ret = OCFS2_ET_UNSUPP_FEATURE;
+		goto out;
+	}
+
+	if (JBD2_HAS_RO_COMPAT_FEATURE(jsb, ~JBD2_KNOWN_ROCOMPAT_FEATURES)) {
+		ret = OCFS2_ET_RO_UNSUPP_FEATURE;
+		goto out;
+	}
+
 	ret = 0;
 out:
 	ocfs2_free(&blk);
-- 
1.5.6.3




More information about the Ocfs2-tools-devel mailing list