aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoern Engel <joern@logfs.org>2010-03-05 10:07:04 -0500
committerJoern Engel <joern@logfs.org>2010-03-05 10:07:04 -0500
commit6a08ab846cefc82a328cbf9abd96c2e58a6c3664 (patch)
tree28aca16fc73f9b413d1ae9e67d97cdab39e869b6
parentc6d3830140f1d56b07d8ab56a6e14ca3c492a39a (diff)
[LogFS] Check feature flags
-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 5d3782ddecc8..8d4dd3de551e 100644
--- a/fs/logfs/logfs_abi.h
+++ b/fs/logfs/logfs_abi.h
@@ -193,6 +193,10 @@ struct logfs_segment_header {
193 193
194SIZE_CHECK(logfs_segment_header, LOGFS_SEGMENT_HEADERSIZE); 194SIZE_CHECK(logfs_segment_header, LOGFS_SEGMENT_HEADERSIZE);
195 195
196#define LOGFS_FEATURES_INCOMPAT (0ull)
197#define LOGFS_FEATURES_RO_COMPAT (0ull)
198#define LOGFS_FEATURES_COMPAT (0ull)
199
196/** 200/**
197 * struct logfs_disk_super - on-medium superblock 201 * struct logfs_disk_super - on-medium superblock
198 * 202 *
diff --git a/fs/logfs/super.c b/fs/logfs/super.c
index 1d081b7ede5a..c66beab78dee 100644
--- a/fs/logfs/super.c
+++ b/fs/logfs/super.c
@@ -440,7 +440,7 @@ static int __logfs_read_sb(struct super_block *sb)
440 return 0; 440 return 0;
441} 441}
442 442
443static int logfs_read_sb(struct super_block *sb) 443static int logfs_read_sb(struct super_block *sb, int read_only)
444{ 444{
445 struct logfs_super *super = logfs_super(sb); 445 struct logfs_super *super = logfs_super(sb);
446 int ret; 446 int ret;
@@ -460,6 +460,12 @@ static int logfs_read_sb(struct super_block *sb)
460 if (ret) 460 if (ret)
461 return ret; 461 return ret;
462 462
463 if (super->s_feature_incompat & ~LOGFS_FEATURES_INCOMPAT)
464 return -EIO;
465 if ((super->s_feature_ro_compat & ~LOGFS_FEATURES_RO_COMPAT) &&
466 !read_only)
467 return -EIO;
468
463 mutex_init(&super->s_dirop_mutex); 469 mutex_init(&super->s_dirop_mutex);
464 mutex_init(&super->s_object_alias_mutex); 470 mutex_init(&super->s_object_alias_mutex);
465 INIT_LIST_HEAD(&super->s_freeing_list); 471 INIT_LIST_HEAD(&super->s_freeing_list);
@@ -555,7 +561,7 @@ int logfs_get_sb_device(struct file_system_type *type, int flags,
555 sb->s_op = &logfs_super_operations; 561 sb->s_op = &logfs_super_operations;
556 sb->s_flags = flags | MS_NOATIME; 562 sb->s_flags = flags | MS_NOATIME;
557 563
558 err = logfs_read_sb(sb); 564 err = logfs_read_sb(sb, sb->s_flags & MS_RDONLY);
559 if (err) 565 if (err)
560 goto err1; 566 goto err1;
561 567