f2fs: restrict inline_xattr_size configuration
authorChao Yu <yuchao0@huawei.com>
Sat, 27 Jan 2018 09:29:48 +0000 (17:29 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Sun, 8 Apr 2018 11:07:44 +0000 (04:07 -0700)
This patch limits to enable inline_xattr_size mount option only if
both extra_attr and flexible_inline_xattr feature is on in current
image.

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

index 80847f9411b21d0a3843ba026f24181f90c221bd..8d0a41ad21016a9973c853dc8e61eb70329b9025 100644 (file)
@@ -699,6 +699,13 @@ static int parse_options(struct super_block *sb, char *options)
        }
 
        if (test_opt(sbi, INLINE_XATTR_SIZE)) {
+               if (!f2fs_sb_has_extra_attr(sb) ||
+                       !f2fs_sb_has_flexible_inline_xattr(sb)) {
+                       f2fs_msg(sb, KERN_ERR,
+                                       "extra_attr or flexible_inline_xattr "
+                                       "feature is off");
+                       return -EINVAL;
+               }
                if (!test_opt(sbi, INLINE_XATTR)) {
                        f2fs_msg(sb, KERN_ERR,
                                        "inline_xattr_size option should be "