Revert "f2fs: fix to check inline_xattr_size boundary correctly"

This reverts commit 802a643228.
This commit is contained in:
Jaegeuk Kim
2019-02-15 20:57:53 -08:00
parent 437584796d
commit 2af2f3bc0f
3 changed files with 12 additions and 12 deletions

View File

@@ -459,6 +459,7 @@ struct f2fs_flush_device {
/* for inline stuff */ /* for inline stuff */
#define DEF_INLINE_RESERVED_SIZE 1 #define DEF_INLINE_RESERVED_SIZE 1
#define DEF_MIN_INLINE_SIZE 1
static inline int get_extra_isize(struct inode *inode); static inline int get_extra_isize(struct inode *inode);
static inline int get_inline_xattr_addrs(struct inode *inode); static inline int get_inline_xattr_addrs(struct inode *inode);
#define MAX_INLINE_DATA(inode) (sizeof(__le32) * \ #define MAX_INLINE_DATA(inode) (sizeof(__le32) * \

View File

@@ -835,11 +835,11 @@ static int parse_options(struct super_block *sb, char *options)
return -EINVAL; return -EINVAL;
} }
if (!F2FS_OPTION(sbi).inline_xattr_size || if (!F2FS_OPTION(sbi).inline_xattr_size ||
F2FS_OPTION(sbi).inline_xattr_size > F2FS_OPTION(sbi).inline_xattr_size >=
DEF_ADDRS_PER_INODE - DEF_ADDRS_PER_INODE -
F2FS_TOTAL_EXTRA_ATTR_SIZE / sizeof(__le32) - F2FS_TOTAL_EXTRA_ATTR_SIZE -
DEF_INLINE_RESERVED_SIZE - DEF_INLINE_RESERVED_SIZE -
MIN_INLINE_DENTRY_SIZE / sizeof(__le32)) { DEF_MIN_INLINE_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");
return -EINVAL; return -EINVAL;

View File

@@ -490,12 +490,12 @@ typedef __le32 f2fs_hash_t;
/* /*
* space utilization of regular dentry and inline dentry (w/o extra reservation) * space utilization of regular dentry and inline dentry (w/o extra reservation)
* regular dentry inline dentry (def) inline dentry (min) * regular dentry inline dentry
* bitmap 1 * 27 = 27 1 * 23 = 23 1 * 1 = 1 * bitmap 1 * 27 = 27 1 * 23 = 23
* reserved 1 * 3 = 3 1 * 7 = 7 1 * 1 = 1 * reserved 1 * 3 = 3 1 * 7 = 7
* dentry 11 * 214 = 2354 11 * 182 = 2002 11 * 2 = 22 * dentry 11 * 214 = 2354 11 * 182 = 2002
* filename 8 * 214 = 1712 8 * 182 = 1456 8 * 2 = 16 * filename 8 * 214 = 1712 8 * 182 = 1456
* total 4096 3488 40 * total 4096 3488
* *
* Note: there are more reserved space in inline dentry than in regular * Note: there are more reserved space in inline dentry than in regular
* dentry, when converting inline dentry we should handle this carefully. * dentry, when converting inline dentry we should handle this carefully.
@@ -507,7 +507,6 @@ typedef __le32 f2fs_hash_t;
#define SIZE_OF_RESERVED (PAGE_SIZE - ((SIZE_OF_DIR_ENTRY + \ #define SIZE_OF_RESERVED (PAGE_SIZE - ((SIZE_OF_DIR_ENTRY + \
F2FS_SLOT_LEN) * \ F2FS_SLOT_LEN) * \
NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP)) NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP))
#define MIN_INLINE_DENTRY_SIZE 40 /* just include '.' and '..' entries */
/* One directory entry slot representing F2FS_SLOT_LEN-sized file name */ /* One directory entry slot representing F2FS_SLOT_LEN-sized file name */
struct f2fs_dir_entry { struct f2fs_dir_entry {