From: <gregkh@linuxfoundation.org>
To: yuchao0@huawei.com, gregkh@linuxfoundation.org,
heyunlei@huawei.com, jaegeuk@kernel.org
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "f2fs: fix deadlock when flush inline data" has been added to the 4.6-stable tree
Date: Sat, 04 Jun 2016 10:06:51 -0700 [thread overview]
Message-ID: <1465060011198199@kroah.com> (raw)
This is a note to let you know that I've just added the patch titled
f2fs: fix deadlock when flush inline data
to the 4.6-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
f2fs-fix-deadlock-when-flush-inline-data.patch
and it can be found in the queue-4.6 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From ab47036d8f7227361cad7894adee8e66ab6f95b2 Mon Sep 17 00:00:00 2001
From: Chao Yu <yuchao0@huawei.com>
Date: Wed, 11 May 2016 19:48:44 +0800
Subject: f2fs: fix deadlock when flush inline data
From: Chao Yu <yuchao0@huawei.com>
commit ab47036d8f7227361cad7894adee8e66ab6f95b2 upstream.
Below backtrace info was reported by Yunlei He:
Call Trace:
[<ffffffff817a9395>] schedule+0x35/0x80
[<ffffffff817abb7d>] rwsem_down_read_failed+0xed/0x130
[<ffffffff813c12a8>] call_rwsem_down_read_failed+0x18/0x
[<ffffffff817ab1d0>] down_read+0x20/0x30
[<ffffffffa02a1a12>] f2fs_evict_inode+0x242/0x3a0 [f2fs]
[<ffffffff81217057>] evict+0xc7/0x1a0
[<ffffffff81217cd6>] iput+0x196/0x200
[<ffffffff812134f9>] __dentry_kill+0x179/0x1e0
[<ffffffff812136f9>] dput+0x199/0x1f0
[<ffffffff811fe77b>] __fput+0x18b/0x220
[<ffffffff811fe84e>] ____fput+0xe/0x10
[<ffffffff81097427>] task_work_run+0x77/0x90
[<ffffffff81074d62>] exit_to_usermode_loop+0x73/0xa2
[<ffffffff81003b7a>] do_syscall_64+0xfa/0x110
[<ffffffff817acf65>] entry_SYSCALL64_slow_path+0x25/0x25
Call Trace:
[<ffffffff817a9395>] schedule+0x35/0x80
[<ffffffff81216dc3>] __wait_on_freeing_inode+0xa3/0xd0
[<ffffffff810bc300>] ? autoremove_wake_function+0x40/0x4
[<ffffffff8121771d>] find_inode_fast+0x7d/0xb0
[<ffffffff8121794a>] ilookup+0x6a/0xd0
[<ffffffffa02bc740>] sync_node_pages+0x210/0x650 [f2fs]
[<ffffffff8122e690>] ? do_fsync+0x70/0x70
[<ffffffffa02b085e>] block_operations+0x9e/0xf0 [f2fs]
[<ffffffff8137b795>] ? bio_endio+0x55/0x60
[<ffffffffa02b0942>] write_checkpoint+0x92/0xba0 [f2fs]
[<ffffffff8117da57>] ? mempool_free_slab+0x17/0x20
[<ffffffff8117de8b>] ? mempool_free+0x2b/0x80
[<ffffffff8122e690>] ? do_fsync+0x70/0x70
[<ffffffffa02a53e3>] f2fs_sync_fs+0x63/0xd0 [f2fs]
[<ffffffff8129630f>] ? ext4_sync_fs+0xbf/0x190
[<ffffffff8122e6b0>] sync_fs_one_sb+0x20/0x30
[<ffffffff812002e9>] iterate_supers+0xb9/0x110
[<ffffffff8122e7b5>] sys_sync+0x55/0x90
[<ffffffff81003ae9>] do_syscall_64+0x69/0x110
[<ffffffff817acf65>] entry_SYSCALL64_slow_path+0x25/0x25
With following excuting serials, we will set inline_node in inode page
after inode was unlinked, result in a deadloop described as below:
1. open file
2. write file
3. unlink file
4. write file
5. close file
Thread A Thread B
- dput
- iput_final
- inode->i_state |= I_FREEING
- evict
- f2fs_evict_inode
- f2fs_sync_fs
- write_checkpoint
- block_operations
- f2fs_lock_all (down_write(cp_rwsem))
- f2fs_lock_op (down_read(cp_rwsem))
- sync_node_pages
- ilookup
- find_inode_fast
- __wait_on_freeing_inode
(wait on I_FREEING clear)
Here, we change to set inline_node flag only for linked inode for fixing.
Reported-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Tested-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/f2fs/data.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1480,7 +1480,8 @@ restart:
if (pos + len <= MAX_INLINE_DATA) {
read_inline_data(page, ipage);
set_inode_flag(F2FS_I(inode), FI_DATA_EXIST);
- set_inline_node(ipage);
+ if (inode->i_nlink)
+ set_inline_node(ipage);
} else {
err = f2fs_convert_inline_page(&dn, page);
if (err)
Patches currently in stable-queue which might be from yuchao0@huawei.com are
queue-4.6/f2fs-fix-deadlock-when-flush-inline-data.patch
reply other threads:[~2016-06-04 17:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1465060011198199@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=heyunlei@huawei.com \
--cc=jaegeuk@kernel.org \
--cc=stable-commits@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=yuchao0@huawei.com \
/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).