Commit 70db5b04 authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: give some messages for inline_xattr_size

This patch adds some kernel messages when user sets wrong inline_xattr_size.

Fixes: 500e0b28 ("f2fs: fix to check inline_xattr_size boundary correctly")
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 86109c90
...@@ -821,6 +821,8 @@ static int parse_options(struct super_block *sb, char *options) ...@@ -821,6 +821,8 @@ static int parse_options(struct super_block *sb, char *options)
} }
if (test_opt(sbi, INLINE_XATTR_SIZE)) { if (test_opt(sbi, INLINE_XATTR_SIZE)) {
int min_size, max_size;
if (!f2fs_sb_has_extra_attr(sbi) || if (!f2fs_sb_has_extra_attr(sbi) ||
!f2fs_sb_has_flexible_inline_xattr(sbi)) { !f2fs_sb_has_flexible_inline_xattr(sbi)) {
f2fs_msg(sb, KERN_ERR, f2fs_msg(sb, KERN_ERR,
...@@ -834,15 +836,18 @@ static int parse_options(struct super_block *sb, char *options) ...@@ -834,15 +836,18 @@ static int parse_options(struct super_block *sb, char *options)
"set with inline_xattr option"); "set with inline_xattr option");
return -EINVAL; return -EINVAL;
} }
if (F2FS_OPTION(sbi).inline_xattr_size <
sizeof(struct f2fs_xattr_header) / sizeof(__le32) || min_size = sizeof(struct f2fs_xattr_header) / sizeof(__le32);
F2FS_OPTION(sbi).inline_xattr_size > max_size = DEF_ADDRS_PER_INODE -
DEF_ADDRS_PER_INODE -
F2FS_TOTAL_EXTRA_ATTR_SIZE / sizeof(__le32) - F2FS_TOTAL_EXTRA_ATTR_SIZE / sizeof(__le32) -
DEF_INLINE_RESERVED_SIZE - DEF_INLINE_RESERVED_SIZE -
MIN_INLINE_DENTRY_SIZE / sizeof(__le32)) { MIN_INLINE_DENTRY_SIZE / sizeof(__le32);
if (F2FS_OPTION(sbi).inline_xattr_size < min_size ||
F2FS_OPTION(sbi).inline_xattr_size > max_size) {
f2fs_msg(sb, KERN_ERR, f2fs_msg(sb, KERN_ERR,
"inline xattr size is out of range"); "inline xattr size is out of range: %d ~ %d",
min_size, max_size);
return -EINVAL; return -EINVAL;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment