linux-stable/fs/f2fs
Jaegeuk Kim d5669f7b9b f2fs: avoid to trigger writepage during POR
This patch doesn't make any effect on previous behavior, since
f2fs_write_data_page bypasses writing the page during POR.

But, the difference is that this patch avoids holding writepages mutex.
This is to avoid the following false warning, since this can happen only
when mount and shutdown are triggered at the same time.

 ======================================================
 [ INFO: possible circular locking dependency detected ]
 4.0.0-rc1+ #3 Tainted: G           O
 -------------------------------------------------------
 kworker/u8:0/2270 is trying to acquire lock:
  (&sbi->gc_mutex){+.+.+.}, at: [<ffffffffa02bdd33>] f2fs_balance_fs+0x73/0x90 [f2fs]

 but task is already holding lock:
  (&sbi->writepages){+.+...}, at: [<ffffffffa02b261b>] f2fs_write_data_pages+0xcb/0x3a0 [f2fs]

 which lock already depends on the new lock.

 the existing dependency chain (in reverse order) is:

 -> #2 (&sbi->writepages){+.+...}:
        [<ffffffff810e2b11>] lock_acquire+0xe1/0x2f0
        [<ffffffff8185e1b3>] mutex_lock_nested+0x63/0x530
        [<ffffffffa02b261b>] f2fs_write_data_pages+0xcb/0x3a0 [f2fs]
        [<ffffffff811c38c1>] do_writepages+0x21/0x50
        [<ffffffff8126c5a6>] __writeback_single_inode+0x76/0xbf0
        [<ffffffff8126e23a>] writeback_single_inode+0xea/0x1c0
        [<ffffffff8126e425>] write_inode_now+0x95/0xa0
        [<ffffffff81259dab>] iput+0x20b/0x3f0
        [<ffffffffa02c1c8b>] recover_data.constprop.14+0x26b/0xa80 [f2fs]
        [<ffffffffa02c2776>] recover_fsync_data+0x2b6/0x5e0 [f2fs]
        [<ffffffffa02a9744>] f2fs_fill_super+0xb24/0xb90 [f2fs]
        [<ffffffff8123d7f4>] mount_bdev+0x1a4/0x1e0
        [<ffffffffa02a3c85>] f2fs_mount+0x15/0x20 [f2fs]
        [<ffffffff8123e159>] mount_fs+0x39/0x180
        [<ffffffff8125e51b>] vfs_kern_mount+0x6b/0x160
        [<ffffffff81261554>] do_mount+0x204/0xbe0
        [<ffffffff8126223b>] SyS_mount+0x8b/0xe0
        [<ffffffff81863e6d>] system_call_fastpath+0x16/0x1b

 -> #1 (&sbi->cp_mutex){+.+...}:
        [<ffffffff810e2b11>] lock_acquire+0xe1/0x2f0
        [<ffffffff8185e1b3>] mutex_lock_nested+0x63/0x530
        [<ffffffffa02acbf2>] write_checkpoint+0x42/0x1230 [f2fs]
        [<ffffffffa02a847d>] f2fs_sync_fs+0x9d/0x2a0 [f2fs]
        [<ffffffff81272f82>] sync_filesystem+0x82/0xb0
        [<ffffffff8123c214>] generic_shutdown_super+0x34/0x100
        [<ffffffff8123c5f7>] kill_block_super+0x27/0x70
        [<ffffffffa02a3c60>] kill_f2fs_super+0x20/0x30 [f2fs]
        [<ffffffff8123ca49>] deactivate_locked_super+0x49/0x80
        [<ffffffff8123d05e>] deactivate_super+0x4e/0x70
        [<ffffffff8125df63>] cleanup_mnt+0x43/0x90
        [<ffffffff8125e002>] __cleanup_mnt+0x12/0x20
        [<ffffffff810a82e4>] task_work_run+0xc4/0xf0
        [<ffffffff8101f0bd>] do_notify_resume+0x8d/0xa0
        [<ffffffff81864141>] int_signal+0x12/0x17

 -> #0 (&sbi->gc_mutex){+.+.+.}:
        [<ffffffff810e2866>] __lock_acquire+0x1ac6/0x1c90
        [<ffffffff810e2b11>] lock_acquire+0xe1/0x2f0
        [<ffffffff8185e1b3>] mutex_lock_nested+0x63/0x530
        [<ffffffffa02bdd33>] f2fs_balance_fs+0x73/0x90 [f2fs]
        [<ffffffffa02b5938>] f2fs_write_data_page+0x348/0x5b0 [f2fs]
        [<ffffffffa02af9da>] __f2fs_writepage+0x1a/0x50 [f2fs]
        [<ffffffff811c1b54>] write_cache_pages+0x274/0x6f0
        [<ffffffffa02b2630>] f2fs_write_data_pages+0xe0/0x3a0 [f2fs]
        [<ffffffff811c38c1>] do_writepages+0x21/0x50
        [<ffffffff8126c5a6>] __writeback_single_inode+0x76/0xbf0
        [<ffffffff8126d44a>] writeback_sb_inodes+0x32a/0x710
        [<ffffffff8126d8cf>] __writeback_inodes_wb+0x9f/0xd0
        [<ffffffff8126dcdb>] wb_writeback+0x3db/0x850
        [<ffffffff8126e848>] bdi_writeback_workfn+0x148/0x980
        [<ffffffff810a3782>] process_one_work+0x1e2/0x840
        [<ffffffff810a3f01>] worker_thread+0x121/0x460
        [<ffffffff810a9dc8>] kthread+0xf8/0x110
        [<ffffffff81863dbc>] ret_from_fork+0x7c/0xb0

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-04-10 15:08:32 -07:00
..
acl.c f2fs: fix a bug of inheriting default ACL from parent 2015-02-11 17:04:36 -08:00
acl.h f2fs: avoid deadlock on init_inode_metadata 2014-11-03 16:07:33 -08:00
checkpoint.c f2fs: add cond_resched() to sync_dirty_dir_inodes() 2015-04-10 15:08:30 -07:00
data.c f2fs: avoid to trigger writepage during POR 2015-04-10 15:08:32 -07:00
debug.c f2fs: add stat info for moved blocks by background gc 2015-04-10 15:08:32 -07:00
dir.c f2fs: clear page's up-to-date if block was deallocated 2015-04-10 15:08:26 -07:00
f2fs.h f2fs: add stat info for moved blocks by background gc 2015-04-10 15:08:32 -07:00
file.c f2fs: support fs shutdown 2015-04-10 15:07:57 -07:00
gc.c f2fs: add stat info for moved blocks by background gc 2015-04-10 15:08:32 -07:00
gc.h f2fs: fix sparse warnings 2015-02-11 17:04:49 -08:00
hash.c f2fs: fix wrong casting for dentry name 2014-08-29 00:26:50 -07:00
inline.c f2fs: introduce universal lookup/update interface for extent cache 2015-03-03 09:58:46 -08:00
inode.c f2fs: enable rb-tree extent cache 2015-03-03 09:58:47 -08:00
Kconfig f2fs: add f2fs_io_tracer support 2015-01-09 17:02:24 -08:00
Makefile f2fs: add f2fs_io_tracer support 2015-01-09 17:02:24 -08:00
namei.c f2fs: fix incorrectly stat number of inline data inode 2015-03-03 09:58:45 -08:00
node.c f2fs: clear page's up-to-date if block was deallocated 2015-04-10 15:08:26 -07:00
node.h f2fs: introduce infra macro and data structure of rb-tree extent cache 2015-03-03 09:58:46 -08:00
recovery.c f2fs: avoid wrong error during recovery 2015-03-03 09:58:48 -08:00
segment.c f2fs: fix to issue small discard in real-time mode discard 2015-04-10 15:08:31 -07:00
segment.h f2fs: use spinlock for segmap_lock instead of rwlock 2015-02-11 17:04:51 -08:00
super.c f2fs: enable rb-tree extent cache 2015-03-03 09:58:47 -08:00
trace.c f2fs: fix sparse warnings 2015-02-11 17:04:49 -08:00
trace.h f2fs: add f2fs_destroy_trace_ios to free radix tree 2015-01-09 17:02:28 -08:00
xattr.c f2fs: avoid deadlock on init_inode_metadata 2014-11-03 16:07:33 -08:00
xattr.h f2fs: avoid deadlock on init_inode_metadata 2014-11-03 16:07:33 -08:00