1. 04 11月, 2014 10 次提交
  2. 16 9月, 2014 1 次提交
  3. 10 9月, 2014 1 次提交
  4. 04 9月, 2014 1 次提交
  5. 22 8月, 2014 1 次提交
  6. 20 8月, 2014 1 次提交
  7. 11 7月, 2014 1 次提交
    • C
      f2fs: check name_len of dir entry to prevent from deadloop · 81e366f8
      Chao Yu 提交于
      We assume that modification of some special application could result in zeroed
      name_len, or it is consciously made by somebody. We will deadloop in
      find_in_block when name_len of dir entry is zero.
      
      This patch is added for preventing deadloop in above scenario.
      
      change log from v1:
       o use f2fs_bug_on rather than break out from searching dir entry suggested by
      Jaegeuk Kim.
      
      Jaegeuk describe:
      "Well, IMO, it would be good to add f2fs_bug_on() here with a specific comment.
      In the current phase of f2fs, it is more important to investigate the file
      system bugs, rather than workarounds for any corrupted images.
      And, definitely it needs to stop the kernel if any corrupted image was mounted,
      so that we can figure out where the bugs are occurred."
      Suggested-by: NJaegeuk Kim <jaegeuk@kernel.org>
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      81e366f8
  8. 10 7月, 2014 5 次提交
  9. 09 7月, 2014 1 次提交
    • C
      f2fs: fix error path in init_inode_metadata · 90d72459
      Chao Yu 提交于
      If we fail in this path:
      ->init_inode_metadata
        ->make_empty_dir
          ->get_new_data_page
            ->grab_cache_page return -ENOMEM
      
      We will bug on in error path of init_inode_metadata when call remove_inode_page
      because i_block = 2 (one inode block will be released later & one dentry block).
      
      We should release the dentry block in init_inode_metadata to avoid this BUG_ON,
      and avoid leak of dentry block resource, because we never have second chance to
      release that block in ->evict_inode as in upper error path we make this inode
      'bad'.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      90d72459
  10. 04 6月, 2014 1 次提交
  11. 07 5月, 2014 2 次提交
  12. 20 3月, 2014 2 次提交
  13. 05 3月, 2014 1 次提交
  14. 27 2月, 2014 2 次提交
    • J
      f2fs: introduce large directory support · 38431545
      Jaegeuk Kim 提交于
      This patch introduces an i_dir_level field to support large directory.
      
      Previously, f2fs maintains multi-level hash tables to find a dentry quickly
      from a bunch of chiild dentries in a directory, and the hash tables consist of
      the following tree structure as below.
      
      In Documentation/filesystems/f2fs.txt,
      
      ----------------------
      A : bucket
      B : block
      N : MAX_DIR_HASH_DEPTH
      ----------------------
      
      level #0   | A(2B)
                 |
      level #1   | A(2B) - A(2B)
                 |
      level #2   | A(2B) - A(2B) - A(2B) - A(2B)
           .     |   .       .       .       .
      level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
           .     |   .       .       .       .
      level #N   | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)
      
      But, if we can guess that a directory will handle a number of child files,
      we don't need to traverse the tree from level #0 to #N all the time.
      Since the lower level tables contain relatively small number of dentries,
      the miss ratio of the target dentry is likely to be high.
      
      In order to avoid that, we can configure the hash tables sparsely from level #0
      like this.
      
      level #0   | A(2B) - A(2B) - A(2B) - A(2B)
      
      level #1   | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
           .     |   .       .       .       .
      level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
           .     |   .       .       .       .
      level #N   | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)
      
      With this structure, we can skip the ineffective tree searches in lower level
      hash tables.
      
      This patch adds just a facility for this by introducing i_dir_level in
      f2fs_inode.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      38431545
    • J
      f2fs: remove costly bit operations for f2fs_find_entry · 5d0c6671
      Jaegeuk Kim 提交于
      It turns out that a bit operation like find_next_bit is not always fast enough
      for f2fs_find_entry.
      Instead, it is pretty much simple and fast to traverse each dentries.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      5d0c6671
  15. 17 2月, 2014 3 次提交
    • J
      f2fs: clean up redundant function call · 1fe54f9d
      Jaegeuk Kim 提交于
      This patch integrates inode_[inc|dec]_dirty_dents with inc_page_count to remove
      redundant calls.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      1fe54f9d
    • J
      f2fs: fix to truncate dentry pages in the error case · bd859c65
      Jaegeuk Kim 提交于
      When a new directory is allocated, if an error is occurred, we should truncate
      preallocated dentry pages too.
      
      This bug was reported by Andrey Tsyvarev after a while as follows.
      
      mkdir()->
       f2fs_add_link()->
        init_inode_metadata()->
          f2fs_init_acl()->
            f2fs_get_acl()->
              f2fs_getxattr()->
                read_all_xattrs() fails.
      
      Also there was a BUG_ON triggered after the fault in
      mkdir()->
       f2fs_add_link()->
         init_inode_metadata()->
          remove_inode_page() ->
            f2fs_bug_on(inode->i_blocks != 0 && inode->i_blocks != 1);
      
      But, previous patch wasn't perfect to resolve that bug, so the following bug
      report was also submitted.
      
      kernel BUG at fs/f2fs/inode.c:274!
      Call Trace:
       [<ffffffff811fde03>] evict+0xa3/0x1a0
       [<ffffffff811fe615>] iput+0xf5/0x180
       [<ffffffffa01c7f63>] f2fs_mkdir+0xf3/0x150 [f2fs]
       [<ffffffff811f2a77>] vfs_mkdir+0xb7/0x160
       [<ffffffff811f36bf>] SyS_mkdir+0x5f/0xc0
       [<ffffffff81680769>] system_call_fastpath+0x16/0x1b
      
      Finally, this patch resolves all the issues like below.
      
      If an error is occurred after make_empty_dir(),
       1. truncate_inode_pages()
         The make_bad_inode() prior to iput() will change i_mode to S_IFREG, which
         means that f2fs will not decrement fi->dirty_dents during f2fs_evict_inode.
         But, by calling it here, we can do that.
      
       2. truncate_blocks()
         Preallocated dentry pages are trucated here to sync i_blocks.
      
       3. remove_dirty_dir_inode()
         Remove this directory inode from the list.
      Reported-and-Tested-by: NAndrey Tsyvarev <tsyvarev@ispras.ru>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      bd859c65
    • J
      f2fs: fix the potential mismatch between dir's i_size and i_blocks · 924a2ddb
      Jaegeuk Kim 提交于
      This is the erroneous scenario.
      
                                   i_size    on-disk i_size    i_blocks
      __f2fs_add_link()             4096           4096           2
       get_new_data_page            8192           4096           3
       -ENOSPC = init_inode_metadata
       checkpoint                     -            4096           3
       POR and reboot
      
      __f2fs_add_link()             4096           4096           3
       page = get_new_data_page (page->index = 1 by NEW_ADDR)
       add a dentry to the page successfully
      
      f2fs_rmdir()
       f2fs_empty_dir()             4096           4096           3
       f2fs_unlink() goes, since there is no valid dentry due to i_size = 4096.
       But, still there is one dentry in page->index = 1.
      
      So this patch moves the code to write dir->i_size into on-disk i_size in order
      to sync dir's i_size, on-disk i_size, and its i_blocks.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      924a2ddb
  16. 22 1月, 2014 2 次提交
  17. 20 1月, 2014 1 次提交
  18. 06 1月, 2014 1 次提交
    • J
      f2fs: handle errors correctly during f2fs_reserve_block · a8865372
      Jaegeuk Kim 提交于
      The get_dnode_of_data nullifies inode and node page when error is occurred.
      
      There are two cases that passes inode page into get_dnode_of_data().
      
      1. make_empty_dir()
          -> get_new_data_page()
            -> f2fs_reserve_block(ipage)
      	-> get_dnode_of_data()
      
      2. f2fs_convert_inline_data()
          -> __f2fs_convert_inline_data()
            -> f2fs_reserve_block(ipage)
      	-> get_dnode_of_data()
      
      This patch adds correct error handling codes when get_dnode_of_data() returns
      an error.
      
      At first, f2fs_reserve_block() calls f2fs_put_dnode() whenever reserve_new_block
      returns an error.
      So, the rule of f2fs_reserve_block() is to nullify inode page when there is any
      error internally.
      
      Finally, two callers of f2fs_reserve_block() should call f2fs_put_dnode()
      appropriately if they got an error since successful f2fs_reserve_block().
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      a8865372
  19. 26 12月, 2013 2 次提交
  20. 23 12月, 2013 1 次提交