WSL2-Linux-Kernel/fs/f2fs
Jaegeuk Kim d4686d56ec f2fs: avoid balanc_fs during evict_inode
1. Background

Previously, if f2fs tries to move data blocks of an *evicting* inode during the
cleaning process, it stops the process incompletely and then restarts the whole
process, since it needs a locked inode to grab victim data pages in its address
space. In order to get a locked inode, iget_locked() by f2fs_iget() is normally
used, but, it waits if the inode is on freeing.

So, here is a deadlock scenario.
1. f2fs_evict_inode()       <- inode "A"
  2. f2fs_balance_fs()
    3. f2fs_gc()
      4. gc_data_segment()
        5. f2fs_iget()      <- inode "A" too!

If step #1 and #5 treat a same inode "A", step #5 would fall into deadlock since
the inode "A" is on freeing. In order to resolve this, f2fs_iget_nowait() which
skips __wait_on_freeing_inode() was introduced in step #5, and stops f2fs_gc()
to complete f2fs_evict_inode().

1. f2fs_evict_inode()           <- inode "A"
  2. f2fs_balance_fs()
    3. f2fs_gc()
      4. gc_data_segment()
        5. f2fs_iget_nowait()   <- inode "A", then stop f2fs_gc() w/ -ENOENT

2. Problem and Solution

In the above scenario, however, f2fs cannot finish f2fs_evict_inode() only if:
 o there are not enough free sections, and
 o f2fs_gc() tries to move data blocks of the *evicting* inode repeatedly.

So, the final solution is to use f2fs_iget() and remove f2fs_balance_fs() in
f2fs_evict_inode().
The f2fs_evict_inode() actually truncates all the data and node blocks, which
means that it doesn't produce any dirty node pages accordingly.
So, we don't need to do f2fs_balance_fs() in practical.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2013-02-12 07:15:01 +09:00
..
Kconfig f2fs: resolve build failures 2012-12-11 13:43:43 +09:00
Makefile f2fs: update Kconfig and Makefile 2012-12-11 13:43:42 +09:00
acl.c f2fs: avoid null dereference in f2fs_acl_from_disk 2013-01-04 09:46:27 +09:00
acl.h f2fs: adjust kernel coding style 2012-12-11 13:43:42 +09:00
checkpoint.c f2fs: clean up the add_orphan_inode func 2013-02-12 07:15:00 +09:00
data.c f2fs: support swapfile 2013-01-22 10:48:58 +09:00
debug.c f2fs: fix the debugfs entry creation path 2013-01-15 20:19:15 +09:00
dir.c f2fs: avoid redundant time update for parent directory in f2fs_delete_entry 2013-01-14 09:43:27 +09:00
f2fs.h f2fs: avoid balanc_fs during evict_inode 2013-02-12 07:15:01 +09:00
file.c f2fs: avoid balanc_fs during evict_inode 2013-02-12 07:15:01 +09:00
gc.c f2fs: avoid balanc_fs during evict_inode 2013-02-12 07:15:01 +09:00
gc.h f2fs: adjust kernel coding style 2012-12-11 13:43:42 +09:00
hash.c f2fs: unify string length declarations and usage 2012-12-28 11:27:53 +09:00
inode.c f2fs: avoid balanc_fs during evict_inode 2013-02-12 07:15:01 +09:00
namei.c f2fs: unify string length declarations and usage 2012-12-28 11:27:53 +09:00
node.c f2fs: remove the use of page_cache_release 2013-02-12 07:15:01 +09:00
node.h f2fs: adjust kernel coding style 2012-12-11 13:43:42 +09:00
recovery.c f2fs: avoid balanc_fs during evict_inode 2013-02-12 07:15:01 +09:00
segment.c f2fs: prevent checkpoint once any IO failure is detected 2013-02-12 07:15:00 +09:00
segment.h f2fs: fix equation of has_not_enough_free_secs() 2012-12-28 11:24:10 +09:00
super.c f2fs: add un/freeze_fs into super_operations 2013-02-12 07:15:00 +09:00
xattr.c f2fs: add f2fs_balance_fs in several interfaces 2013-01-11 15:09:17 +09:00
xattr.h f2fs: adjust kernel coding style 2012-12-11 13:43:42 +09:00