1. 07 6月, 2014 1 次提交
    • J
      f2fs: avoid not to call remove_dirty_inode · 86928f98
      Jaegeuk Kim 提交于
      There is an errorneous case during the recovery like below.
      
      In recovery_dentry,
       1) dir = f2fs_iget();
       2) mark the dir with FI_DELAY_IPUT
       3) goto unmap_out
      
      After the end of recovery routine, there is no dirty dentries so the dir cannot
      be released by iput in remove_dirty_dir_inode.
      
      This patch fixes such the bug case by handling the iget and iput in the
      recovery_dentry procedure.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      86928f98
  2. 07 5月, 2014 3 次提交
  3. 02 4月, 2014 1 次提交
  4. 20 3月, 2014 1 次提交
  5. 10 3月, 2014 1 次提交
  6. 27 2月, 2014 1 次提交
  7. 17 2月, 2014 3 次提交
    • J
      f2fs: fix a build warning · f6517cfc
      Jaegeuk Kim 提交于
      This patch modifies flow a little bit to avoid the following build warnings.
      
      src/fs/f2fs/recovery.c: In function ‘check_index_in_prev_nodes’:
      src/fs/f2fs/recovery.c:288:51: warning: ‘sum.<U5390>.<U52f8>.ofs_in_node’ may
      	be used uninitialized in this function [-Wmaybe-uninitialized]
      src/fs/f2fs/recovery.c:260:23: warning: ‘sum.nid’ may be used uninitialized
      	in this function [-Wmaybe-uninitialized]
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      f6517cfc
    • J
      f2fs: clean up with a macro · 491c0854
      Jaegeuk Kim 提交于
      This patch adds GET_BLKOFF_FROM_SEG0 to clean up some codes.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      491c0854
    • J
      f2fs: fix to recover xattr node block · abb2366c
      Jaegeuk Kim 提交于
      If a new xattr node page was allocated and its inode is fsynced, we should
      recover the xattr node page during the roll-forward process after power-cut.
      But, previously, f2fs didn't handle that case, resulting in kernel panic as
      follows reported by Tom Li.
      
      BUG: unable to handle kernel paging request at ffffc9001c861a98
      IP: [<ffffffffa0295236>] check_index_in_prev_nodes+0x86/0x2d0 [f2fs]
      Call Trace:
       [<ffffffff815ece9b>] ? printk+0x48/0x4a
       [<ffffffffa029626a>] recover_fsync_data+0xdca/0xf50 [f2fs]
       [<ffffffffa02873ae>] f2fs_fill_super+0x92e/0x970 [f2fs]
       [<ffffffff8112c9f8>] mount_bdev+0x1b8/0x200
       [<ffffffffa0286a80>] ? f2fs_remount+0x130/0x130 [f2fs]
       [<ffffffffa0285e40>] f2fs_mount+0x10/0x20 [f2fs]
       [<ffffffff8112d4de>] mount_fs+0x3e/0x1b0
       [<ffffffff810ef4eb>] ? __alloc_percpu+0xb/0x10
       [<ffffffff8114761f>] vfs_kern_mount+0x6f/0x120
       [<ffffffff811497b9>] do_mount+0x259/0xa90
       [<ffffffff810ead1d>] ? memdup_user+0x3d/0x80
       [<ffffffff810eadb3>] ? strndup_user+0x53/0x70
       [<ffffffff8114a2c9>] SyS_mount+0x89/0xd0
       [<ffffffff815feae2>] system_call_fastpath+0x16/0x1b
      
      This patch adds a recovery function of xattr node pages.
      Reported-by: NTom Li <biergaizi@members.fsf.org>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      abb2366c
  8. 20 1月, 2014 1 次提交
  9. 06 1月, 2014 1 次提交
    • J
      f2fs: add inline_data recovery routine · 1e1bb4ba
      Jaegeuk Kim 提交于
      This patch adds a inline_data recovery routine with the following policy.
      
      [prev.] [next] of inline_data flag
         o       o  -> recover inline_data
         o       x  -> remove inline_data, and then recover data blocks
         x       o  -> remove inline_data, and then recover inline_data
         x       x  -> recover data blocks
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      1e1bb4ba
  10. 26 12月, 2013 2 次提交
  11. 23 12月, 2013 4 次提交
  12. 29 10月, 2013 1 次提交
  13. 25 10月, 2013 1 次提交
  14. 07 10月, 2013 1 次提交
    • G
      f2fs: use rw_sem instead of fs_lock(locks mutex) · e479556b
      Gu Zheng 提交于
      The fs_locks is used to block other ops(ex, recovery) when doing checkpoint.
      And each other operate routine(besides checkpoint) needs to acquire a fs_lock,
      there is a terrible problem here, if these are too many concurrency threads acquiring
      fs_lock, so that they will block each other and may lead to some performance problem,
      but this is not the phenomenon we want to see.
      Though there are some optimization patches introduced to enhance the usage of fs_lock,
      but the thorough solution is using a *rw_sem* to replace the fs_lock.
      Checkpoint routine takes write_sem, and other ops take read_sem, so that we can block
      other ops(ex, recovery) when doing checkpoint, and other ops will not disturb each other,
      this can avoid the problem described above completely.
      Because of the weakness of rw_sem, the above change may introduce a potential problem
      that the checkpoint thread might get starved if other threads are intensively locking
      the read semaphore for I/O.(Pointed out by Xu Jin)
      In order to avoid this, a wait_list is introduced, the appending read semaphore ops
      will be dropped into the wait_list if checkpoint thread is waiting for write semaphore,
      and will be waked up when checkpoint thread gives up write semaphore.
      Thanks to Kim's previous review and test, and will be very glad to see other guys'
      performance tests about this patch.
      
      V2:
        -fix the potential starvation problem.
        -use more suitable func name suggested by Xu Jin.
      Signed-off-by: NGu Zheng <guz.fnst@cn.fujitsu.com>
      [Jaegeuk Kim: adjust minor coding standard]
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      e479556b
  15. 25 9月, 2013 2 次提交
  16. 26 8月, 2013 1 次提交
    • J
      f2fs: reserve the xattr space dynamically · de93653f
      Jaegeuk Kim 提交于
      This patch enables the number of direct pointers inside on-disk inode block to
      be changed dynamically according to the size of inline xattr space.
      
      The number of direct pointers, ADDRS_PER_INODE, can be changed only if the file
      has inline xattr flag.
      
      The number of direct pointers that will be used by inline xattrs is defined as
      F2FS_INLINE_XATTR_ADDRS.
      Current patch assigns F2FS_INLINE_XATTR_ADDRS to 0 temporarily.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      de93653f
  17. 19 8月, 2013 1 次提交
  18. 09 8月, 2013 1 次提交
  19. 30 7月, 2013 1 次提交
  20. 02 7月, 2013 2 次提交
  21. 07 6月, 2013 1 次提交
    • J
      f2fs: fix iget/iput of dir during recovery · 5deb8267
      Jaegeuk Kim 提交于
      It is possible that iput is skipped after iget during the recovery.
      
      In recover_dentry(),
       dir = f2fs_iget();
       ...
       if (de && inode->i_ino == le32_to_cpu(de->ino))
      	goto out;
      
      In this case, this dir is not able to be added in dirty_dir_inode_list.
      The actual linking is done only when set_page_dirty() is called.
      
      So let's add this newly got inode into the list explicitly, and put it at the
      end of the recovery routine.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      5deb8267
  22. 28 5月, 2013 9 次提交
    • J
      f2fs: fix dentry recovery routine · 6b8213d9
      Jaegeuk Kim 提交于
      The error scenario is:
      1. create /a
      (1.a link /a /b)
      2. sync
      3. unlinke /a
      4. create /a
      5. fsync /a
      6. Sudden power-off
      
      When the f2fs recovers the fsynced dentry, /a, we discover an exsiting dentry at
      f2fs_find_entry() in recover_dentry().
      
      In such the case, we should unlink the existing dentry and its inode
      and then recover newly created dentry.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      6b8213d9
    • D
      f2fs: dereferencing an ERR_PTR · f28c06fa
      Dan Carpenter 提交于
      There is an error path where "dir" is an ERR_PTR.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      f28c06fa
    • J
      f2fs: fix to handle do_recover_data errors · 39cf72cf
      Jaegeuk Kim 提交于
      This patch adds error handling codes of check_index_in_prev_nodes and its
      caller, do_recover_data.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      39cf72cf
    • J
      f2fs: reuse the locked dnode page and its inode · b292dcab
      Jaegeuk Kim 提交于
      This patch fixes the following deadlock bug during the recovery.
      
      INFO: task mount:1322 blocked for more than 120 seconds.
      "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      mount           D ffffffff81125870     0  1322   1266 0x00000000
       ffff8801207e39d8 0000000000000046 ffff88012ab1dee0 0000000000000046
       ffff8801207e3a08 ffff880115903f40 ffff8801207e3fd8 ffff8801207e3fd8
       ffff8801207e3fd8 ffff880115903f40 ffff8801207e39d8 ffff88012fc94520
      Call Trace:
      [<ffffffff81125870>] ? __lock_page+0x70/0x70
      [<ffffffff816a92d9>] schedule+0x29/0x70
      [<ffffffff816a93af>] io_schedule+0x8f/0xd0
      [<ffffffff8112587e>] sleep_on_page+0xe/0x20
      [<ffffffff816a649a>] __wait_on_bit_lock+0x5a/0xc0
      [<ffffffff81125867>] __lock_page+0x67/0x70
      [<ffffffff8106c7b0>] ? autoremove_wake_function+0x40/0x40
      [<ffffffff81126857>] find_lock_page+0x67/0x80
      [<ffffffff8112698f>] find_or_create_page+0x3f/0xb0
      [<ffffffffa03901a8>] ? sync_inode_page+0xa8/0xd0 [f2fs]
      [<ffffffffa038fdf7>] get_node_page+0x67/0x180 [f2fs]
      [<ffffffffa039818b>] recover_fsync_data+0xacb/0xff0 [f2fs]
      [<ffffffff816aaa1e>] ? _raw_spin_unlock+0x3e/0x40
      [<ffffffffa0389634>] f2fs_fill_super+0x7d4/0x850 [f2fs]
      [<ffffffff81184cf9>] mount_bdev+0x1c9/0x210
      [<ffffffffa0388e60>] ? validate_superblock+0x180/0x180 [f2fs]
      [<ffffffffa0387635>] f2fs_mount+0x15/0x20 [f2fs]
      [<ffffffff81185a13>] mount_fs+0x43/0x1b0
      [<ffffffff81145ba0>] ? __alloc_percpu+0x10/0x20
      [<ffffffff811a0796>] vfs_kern_mount+0x76/0x120
      [<ffffffff811a2cb7>] do_mount+0x237/0xa10
      [<ffffffff81140b9b>] ? strndup_user+0x5b/0x80
      [<ffffffff811a3520>] SyS_mount+0x90/0xe0
      [<ffffffff816b3502>] system_call_fastpath+0x16/0x1b
      
      The bug is triggered when check_index_in_prev_nodes tries to get the direct
      node page by calling get_node_page.
      At this point, if the direct node page is already locked by get_dnode_of_data,
      its caller, we got a deadlock condition.
      
      This patch adds additional condition check for the reuse of locked direct node
      pages prior to the get_node_page call.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      b292dcab
    • J
      f2fs: don't do checkpoint if error is occurred · 2c2c149f
      Jaegeuk Kim 提交于
      If we met an error during the dentry recovery, we should not conduct checkpoint.
      Otherwise, some errorneous dentry blocks overwrites the existing blocks that
      contain the remaining recovery information.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      2c2c149f
    • J
      f2fs: fix to unlock page before exit · 45856aff
      Jaegeuk Kim 提交于
      If we got an error after lock_page, we should unlock it before exit.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      45856aff
    • J
      f2fs: remove unnecessary kmap/kunmap operations · 9a55ed65
      Jaegeuk Kim 提交于
      The allocated page used by the recovery is not on HIGHMEM, so that we don't
      need to use kmap/kunmap.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      9a55ed65
    • J
      f2fs: add debug msgs in the recovery routine · f356fe0c
      Jaegeuk Kim 提交于
      This patch adds some trivial debugging messages in the recovery process.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      f356fe0c
    • J
      f2fs: fix BUG_ON during f2fs_evict_inode(dir) · 74d0b917
      Jaegeuk Kim 提交于
      During the dentry recovery routine, recover_inode() triggers __f2fs_add_link
      with its directory inode.
      
      In the following scenario, a bug is captured.
       1. dir = f2fs_iget(pino)
       2. __f2fs_add_link(dir, name)
       3. iput(dir)
        -> f2fs_evict_inode() faces with BUG_ON(atomic_read(fi->dirty_dents))
      
      Kernel BUG at ffffffffa01c0676 [verbose debug info unavailable]
      [<ffffffffa01c0676>] f2fs_evict_inode+0x276/0x300 [f2fs]
      Call Trace:
       [<ffffffff8118ea00>] evict+0xb0/0x1b0
       [<ffffffff8118f1c5>] iput+0x105/0x190
       [<ffffffffa01d2dac>] recover_fsync_data+0x3bc/0x1070 [f2fs]
       [<ffffffff81692e8a>] ? io_schedule+0xaa/0xd0
       [<ffffffff81690acb>] ? __wait_on_bit_lock+0x7b/0xc0
       [<ffffffff8111a0e7>] ? __lock_page+0x67/0x70
       [<ffffffff81165e21>] ? kmem_cache_alloc+0x31/0x140
       [<ffffffff8118a502>] ? __d_instantiate+0x92/0xf0
       [<ffffffff812a949b>] ? security_d_instantiate+0x1b/0x30
       [<ffffffff8118a5b4>] ? d_instantiate+0x54/0x70
      
      This means that we should flush all the dentry pages between iget and iput().
      But, during the recovery routine, it is unallowed due to consistency, so we
      have to wait the whole recovery process.
      And then, write_checkpoint flushes all the dirty dentry blocks, and nicely we
      can put the stale dir inodes from the dirty_dir_inode_list.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      74d0b917