From patchwork Wed Oct 18 04:18:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junxiao Bi X-Patchwork-Id: 10013429 Return-Path: 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 504F5602C8 for ; Wed, 18 Oct 2017 04:18:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36E6528A8D for ; Wed, 18 Oct 2017 04:18:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29E6628A9C; Wed, 18 Oct 2017 04:18:49 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2120C28A8D for ; Wed, 18 Oct 2017 04:18:46 +0000 (UTC) Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v9I4Hvxq015340 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Oct 2017 04:17:58 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v9I4HmuF024955 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 18 Oct 2017 04:17:48 GMT Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1e4fng-0005of-FT; Tue, 17 Oct 2017 21:17:48 -0700 Received: from aserv0022.oracle.com ([141.146.126.234]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1e4fnf-0005oV-7y for ocfs2-devel@oss.oracle.com; Tue, 17 Oct 2017 21:17:47 -0700 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v9I4HkDO024909 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Oct 2017 04:17:46 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v9I4Hkl7025180; Wed, 18 Oct 2017 04:17:46 GMT Received: from bijx-OptiPlex-780.cn.oracle.com (/10.182.64.189) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 17 Oct 2017 21:17:45 -0700 From: Junxiao Bi To: akpm@linux-foundation.org, mfasheh@versity.com Date: Wed, 18 Oct 2017 12:18:22 +0800 Message-Id: <1508300302-5155-1-git-send-email-junxiao.bi@oracle.com> X-Mailer: git-send-email 1.7.9.5 Cc: ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH] ocfs2: mknod: fix recursive locking hung X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-Virus-Scanned: ClamAV using ClamSMTP Here another recursive lock caught and it caused the cluster hung. #0 [ffff88008e3935a8] __schedule at ffffffff816e4722 #1 [ffff88008e393600] schedule at ffffffff816e4dee #2 [ffff88008e393620] schedule_timeout at ffffffff816e7cd5 #3 [ffff88008e3936c0] wait_for_completion at ffffffff816e631f #4 [ffff88008e393740] __ocfs2_cluster_lock at ffffffffa05a9111 [ocfs2] #5 [ffff88008e393890] ocfs2_inode_lock_full_nested at ffffffffa05aec14 [ocfs2] #6 [ffff88008e393910] ocfs2_inode_lock_tracker at ffffffffa05af02f [ocfs2] #7 [ffff88008e393970] ocfs2_iop_get_acl at ffffffffa0620c92 [ocfs2] #8 [ffff88008e3939d0] get_acl at ffffffff8126ae79 #9 [ffff88008e3939f0] posix_acl_create at ffffffff8126b27a #10 [ffff88008e393a20] ocfs2_mknod at ffffffffa05cedcc [ocfs2] #11 [ffff88008e393b60] ocfs2_create at ffffffffa05cfb13 [ocfs2] #12 [ffff88008e393bd0] vfs_create at ffffffff81217338 #13 [ffff88008e393c10] lookup_open at ffffffff81217a85 #14 [ffff88008e393ca0] do_last at ffffffff8121ac6d #15 [ffff88008e393d30] path_openat at ffffffff8121b112 #16 [ffff88008e393df0] do_filp_open at ffffffff8121b53a #17 [ffff88008e393ed0] do_sys_open at ffffffff81209a5a #18 [ffff88008e393f40] sys_open at ffffffff81209bae #19 [ffff88008e393f50] system_call_fastpath at ffffffff816e902e inode lock is got by ocfs2_mknod() before call into posix_acl_create(). Signed-off-by: Junxiao Bi Cc: --- fs/ocfs2/namei.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 3b0a10d9b36f..f0ee52e600ff 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c @@ -260,6 +260,8 @@ static int ocfs2_mknod(struct inode *dir, sigset_t oldset; int did_block_signals = 0; struct ocfs2_dentry_lock *dl = NULL; + int locked; + struct ocfs2_lock_holder oh; trace_ocfs2_mknod(dir, dentry, dentry->d_name.len, dentry->d_name.name, (unsigned long long)OCFS2_I(dir)->ip_blkno, @@ -274,11 +276,11 @@ static int ocfs2_mknod(struct inode *dir, /* get our super block */ osb = OCFS2_SB(dir->i_sb); - status = ocfs2_inode_lock(dir, &parent_fe_bh, 1); - if (status < 0) { - if (status != -ENOENT) - mlog_errno(status); - return status; + locked = ocfs2_inode_lock_tracker(dir, &parent_fe_bh, 1, &oh); + if (locked < 0) { + if (locked != -ENOENT) + mlog_errno(locked); + return locked; } if (S_ISDIR(mode) && (dir->i_nlink >= ocfs2_link_max(osb))) { @@ -462,7 +464,7 @@ static int ocfs2_mknod(struct inode *dir, if (handle) ocfs2_commit_trans(osb, handle); - ocfs2_inode_unlock(dir, 1); + ocfs2_inode_unlock_tracker(dir, 1, &oh, locked); if (did_block_signals) ocfs2_unblock_signals(&oldset);