f2fs: avoid wrong f2fs_bug_on when truncating inline_data
authorJaegeuk Kim <jaegeuk@kernel.org>
Mon, 16 Mar 2015 23:54:52 +0000 (16:54 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 10 Apr 2015 22:08:46 +0000 (15:08 -0700)
This patch removes wrong f2fs_bug_on in truncate_inline_inode.

When there is no space, it can happen a corner case where i_isze is over
MAX_INLINE_SIZE while its inode is still inline_data.

The scenario is
 1. write small data into file #A.
 2. fill the whole partition to 100%.
 3. truncate 4096 on file #A.
 4. write data at 8192 offset.
  --> f2fs_write_begin
    -> -ENOSPC = f2fs_convert_inline_page
    -> f2fs_write_failed
      -> truncate_blocks
        -> truncate_inline_inode
  BUG_ON, since i_size is 4096.

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

index 153c5e7a0bef5b956ebc517f9adab57fa6729bb7..d3e0599ffab7b0cd1ae48ace8a0e581e7fb0b299 100644 (file)
@@ -54,13 +54,6 @@ bool truncate_inline_inode(struct page *ipage, u64 from)
 {
        void *addr;
 
-       /*
-        * we should never truncate inline data past max inline data size,
-        * because we always convert inline inode to normal one before
-        * truncating real data if new size is past max inline data size.
-        */
-       f2fs_bug_on(F2FS_P_SB(ipage), from > MAX_INLINE_DATA);
-
        if (from >= MAX_INLINE_DATA)
                return false;