summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJoern Engel <joern@logfs.org>2010-03-05 16:07:04 +0100
committerJoern Engel <joern@logfs.org>2010-03-05 16:07:04 +0100
commit6a08ab846cefc82a328cbf9abd96c2e58a6c3664 (patch)
tree28aca16fc73f9b413d1ae9e67d97cdab39e869b6 /fs
parentc6d3830140f1d56b07d8ab56a6e14ca3c492a39a (diff)
downloadop-kernel-dev-6a08ab846cefc82a328cbf9abd96c2e58a6c3664.zip
op-kernel-dev-6a08ab846cefc82a328cbf9abd96c2e58a6c3664.tar.gz
[LogFS] Check feature flags
Diffstat (limited to 'fs')
-rw-r--r--fs/logfs/logfs_abi.h4
-rw-r--r--fs/logfs/super.c10
2 files changed, 12 insertions, 2 deletions
diff --git a/fs/logfs/logfs_abi.h b/fs/logfs/logfs_abi.h
index 5d3782dd..8d4dd3d 100644
--- a/fs/logfs/logfs_abi.h
+++ b/fs/logfs/logfs_abi.h
@@ -193,6 +193,10 @@ struct logfs_segment_header {
SIZE_CHECK(logfs_segment_header, LOGFS_SEGMENT_HEADERSIZE);
+#define LOGFS_FEATURES_INCOMPAT (0ull)
+#define LOGFS_FEATURES_RO_COMPAT (0ull)
+#define LOGFS_FEATURES_COMPAT (0ull)
+
/**
* struct logfs_disk_super - on-medium superblock
*
diff --git a/fs/logfs/super.c b/fs/logfs/super.c
index 1d081b7..c66beab 100644
--- a/fs/logfs/super.c
+++ b/fs/logfs/super.c
@@ -440,7 +440,7 @@ static int __logfs_read_sb(struct super_block *sb)
return 0;
}
-static int logfs_read_sb(struct super_block *sb)
+static int logfs_read_sb(struct super_block *sb, int read_only)
{
struct logfs_super *super = logfs_super(sb);
int ret;
@@ -460,6 +460,12 @@ static int logfs_read_sb(struct super_block *sb)
if (ret)
return ret;
+ if (super->s_feature_incompat & ~LOGFS_FEATURES_INCOMPAT)
+ return -EIO;
+ if ((super->s_feature_ro_compat & ~LOGFS_FEATURES_RO_COMPAT) &&
+ !read_only)
+ return -EIO;
+
mutex_init(&super->s_dirop_mutex);
mutex_init(&super->s_object_alias_mutex);
INIT_LIST_HEAD(&super->s_freeing_list);
@@ -555,7 +561,7 @@ int logfs_get_sb_device(struct file_system_type *type, int flags,
sb->s_op = &logfs_super_operations;
sb->s_flags = flags | MS_NOATIME;
- err = logfs_read_sb(sb);
+ err = logfs_read_sb(sb, sb->s_flags & MS_RDONLY);
if (err)
goto err1;
OpenPOWER on IntegriCloud