From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Chris Mason <clm@fb.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-btrfs <linux-btrfs@vger.kernel.org>,
Christian Borntraeger <borntraeger@de.ibm.com>
Subject: [PATCH 2/2] btrfs: add lockdep annotation for btrfs_log_inode
Date: Tue, 24 Jan 2017 10:01:47 +0100 [thread overview]
Message-ID: <1485248507-6079-2-git-send-email-borntraeger@de.ibm.com> (raw)
In-Reply-To: <1485248507-6079-1-git-send-email-borntraeger@de.ibm.com>
Add a proper subclass to get rid of the following lockdep
error.
[ INFO: possible recursive locking detected ]
4.9.0+ #279 Not tainted
---------------------------------------------
vim/4801 is trying to acquire lock:
(&ei->log_mutex){+.+...}, at: [<000003ff82057592>]
btrfs_log_inode+0x182/0xfa8 [btrfs]
(&ei->log_mutex){+.+...}, at: [<000003ff82057592>]
btrfs_log_inode+0x182/0xfa8 [btrfs]
Possible unsafe locking scenario:
CPU0
----
lock(&ei->log_mutex);
lock(&ei->log_mutex);
*** DEADLOCK ***
May be due to missing lock nesting notation
3 locks held by vim/4801:
#0: (&sb->s_type->i_mutex_key#15){+.+.+.}, at: [<000003ff81fc274c>]
btrfs_sync_file+0x204/0x728 [btrfs]
#1: (sb_internal#2){.+.+..}, at: [<000003ff81fa38e0>]
start_transaction+0x318/0x770 [btrfs]
#2: (&ei->log_mutex){+.+...}, at: [<000003ff82057592>]
[...]
Call Trace:
([<0000000000115ffc>] show_trace+0xe4/0x108)
[<00000000001160f8>] show_stack+0x68/0xe0
[<0000000000652d52>] dump_stack+0x9a/0xd8
[<0000000000209bb0>] __lock_acquire+0xac8/0x1bd0
[<000000000020b3c6>] lock_acquire+0x106/0x4a0
[<0000000000a1fb36>] mutex_lock_nested+0xa6/0x428
[<000003ff82057592>] btrfs_log_inode+0x182/0xfa8 [btrfs]
[<000003ff82057c76>] btrfs_log_inode+0x866/0xfa8 [btrfs]
[<000003ff81ffe278>] btrfs_log_inode_parent+0x218/0x988 [btrfs]
[<000003ff81ffffaa>] btrfs_log_dentry_safe+0x7a/0xa0 [btrfs]
[<000003ff81fc29b6>] btrfs_sync_file+0x46e/0x728 [btrfs]
[<000000000044aeee>] do_fsync+0x5e/0x90
[<000000000044b2ba>] SyS_fsync+0x32/0x40
[<0000000000a26786>] system_call+0xd6/0x288
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
fs/btrfs/tree-log.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 3d33c4e..a3ec717 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4648,7 +4648,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
return ret;
}
- mutex_lock(&BTRFS_I(inode)->log_mutex);
+ mutex_lock_nested(&BTRFS_I(inode)->log_mutex, inode_only);
/*
* a brute force approach to making sure we get the most uptodate
--
2.7.4
next prev parent reply other threads:[~2017-01-24 9:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-25 9:03 btrfs: still lockdep splat for 4.9-rc5+ (btrfs_log_inode) Christian Borntraeger
2016-11-26 13:46 ` Chris Mason
2016-11-28 20:12 ` Liu Bo
2017-01-24 9:01 ` [PATCH 0/1] btrfs lockdep annotation Christian Borntraeger
2017-01-24 9:01 ` Christian Borntraeger [this message]
2017-01-24 10:22 ` Filipe Manana
2017-01-24 11:27 ` Christian Borntraeger
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=1485248507-6079-2-git-send-email-borntraeger@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=clm@fb.com \
--cc=linux-btrfs@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).