]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
f2fs: disallow switch extent_cache option dynamically
authorChao Yu <chao2.yu@samsung.com>
Fri, 18 Sep 2015 08:55:26 +0000 (16:55 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 9 Oct 2015 23:20:53 +0000 (16:20 -0700)
Swith extent_cache option dynamically when remount may casue consistency
issue between extent cache and dnode page. Fix in this patch to avoid
that condition.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/super.c

index f79478115d379f87a1ac21fe884c27ddae0988b1..16442ec89489ba23bd8d0ac70794c270f2a9e6aa 100644 (file)
@@ -742,6 +742,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
        int err, active_logs;
        bool need_restart_gc = false;
        bool need_stop_gc = false;
+       bool no_extent_cache = !test_opt(sbi, EXTENT_CACHE);
 
        sync_filesystem(sb);
 
@@ -767,6 +768,14 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
        if (f2fs_readonly(sb) && (*flags & MS_RDONLY))
                goto skip;
 
+       /* disallow enable/disable extent_cache dynamically */
+       if (no_extent_cache == !!test_opt(sbi, EXTENT_CACHE)) {
+               err = -EINVAL;
+               f2fs_msg(sbi->sb, KERN_WARNING,
+                               "switch extent_cache option is not allowed");
+               goto restore_opts;
+       }
+
        /*
         * We stop the GC thread if FS is mounted as RO
         * or if background_gc = off is passed in mount