Message ID | 1485248507-6079-2-git-send-email-borntraeger@de.ibm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show
Return-Path: <linux-btrfs-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9A41360434 for <patchwork-linux-btrfs@patchwork.kernel.org>; Tue, 24 Jan 2017 09:02:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B8EB24DA2 for <patchwork-linux-btrfs@patchwork.kernel.org>; Tue, 24 Jan 2017 09:02:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80224269A3; Tue, 24 Jan 2017 09:02:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C6F524DA2 for <patchwork-linux-btrfs@patchwork.kernel.org>; Tue, 24 Jan 2017 09:02:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750946AbdAXJB5 (ORCPT <rfc822;patchwork-linux-btrfs@patchwork.kernel.org>); Tue, 24 Jan 2017 04:01:57 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57966 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750831AbdAXJBz (ORCPT <rfc822;linux-btrfs@vger.kernel.org>); Tue, 24 Jan 2017 04:01:55 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v0O8wcIj068595 for <linux-btrfs@vger.kernel.org>; Tue, 24 Jan 2017 04:01:54 -0500 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 28612we5bw-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for <linux-btrfs@vger.kernel.org>; Tue, 24 Jan 2017 04:01:54 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for <linux-btrfs@vger.kernel.org> from <borntraeger@de.ibm.com>; Tue, 24 Jan 2017 09:01:53 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 24 Jan 2017 09:01:49 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 0A9CE219004D; Tue, 24 Jan 2017 09:00:55 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v0O91ncw5636532; Tue, 24 Jan 2017 09:01:49 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1F8F5A4055; Tue, 24 Jan 2017 09:01:49 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 18870A404D; Tue, 24 Jan 2017 09:01:49 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 24 Jan 2017 09:01:49 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id C458B20F5CF; Tue, 24 Jan 2017 10:01:48 +0100 (CET) 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 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485248507-6079-1-git-send-email-borntraeger@de.ibm.com> References: <20161126134638.GA79987@clm-mbp.masoncoding.com> <1485248507-6079-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17012409-0016-0000-0000-0000043057E9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17012409-0017-0000-0000-00002632A8C0 Message-Id: <1485248507-6079-2-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-01-24_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1701240078 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: <linux-btrfs.vger.kernel.org> X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
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
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(-)