This inserts compatibility check in nilfs_open function so that it refuses to open the nilfs partition whose super block has incompatible features that nilfs-utils doesn't know about. It is verified only when NILFS_OPEN_RAW mode is specified. Moreover, only incompat feature set is tested because the current nilfs_open doesn't open the device in read/write mode. Programs that want to write to the nilfs partition not via io-control must confirm read-only compat feature set as well as the incompat feature set. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@xxxxxxxxxxxxx> --- lib/nilfs.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/lib/nilfs.c b/lib/nilfs.c index 982e874..44e368b 100644 --- a/lib/nilfs.c +++ b/lib/nilfs.c @@ -281,6 +281,7 @@ int nilfs_opt_test_mmap(struct nilfs *nilfs) struct nilfs *nilfs_open(const char *dev, const char *dir, int flags) { struct nilfs *nilfs; + __u64 features; int oflags; if (!(flags & (NILFS_OPEN_RAW | NILFS_OPEN_RDONLY | @@ -314,6 +315,13 @@ struct nilfs *nilfs_open(const char *dev, const char *dir, int flags) goto out_fd; if (nilfs_read_sb(nilfs) < 0) goto out_fd; + + features = le64_to_cpu(nilfs->n_sb->s_feature_incompat) & + ~NILFS_FEATURE_INCOMPAT_SUPP; + if (features) { + errno = ENOTSUP; + goto out_fd; + } } if (flags & -- 1.6.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html