From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [PATCH 1/3] f2fs: avoid to trigger writepage during POR
Date: Tue, 3 Mar 2015 10:02:47 -0800 [thread overview]
Message-ID: <1425405769-92563-1-git-send-email-jaegeuk@kernel.org> (raw)
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>
---
fs/f2fs/data.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 389fda7..0057d4b 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1408,6 +1408,10 @@ static int f2fs_write_data_pages(struct address_space *mapping,
available_free_memory(sbi, DIRTY_DENTS))
goto skip_write;
+ /* during POR, we don't need to trigger writepage at all. */
+ if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
+ goto skip_write;
+
diff = nr_pages_to_write(sbi, DATA, wbc);
if (!S_ISDIR(inode->i_mode)) {
--
2.1.1
next reply other threads:[~2015-03-03 18:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-03 18:02 Jaegeuk Kim [this message]
2015-03-03 18:02 ` [PATCH 2/3] f2fs: clear append/update flags once fsync is done Jaegeuk Kim
2015-03-03 18:02 ` [PATCH 3/3] f2fs: report -ENOENT for unreached data indices Jaegeuk Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425405769-92563-1-git-send-email-jaegeuk@kernel.org \
--to=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).