From patchwork Sat Sep 23 03:39:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: piaojun X-Patchwork-Id: 9967377 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 27146602CB for ; Sat, 23 Sep 2017 03:41:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E98D29AA5 for ; Sat, 23 Sep 2017 03:41:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 137E729AA7; Sat, 23 Sep 2017 03:41:50 +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 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 6F26029AA5 for ; Sat, 23 Sep 2017 03:41:49 +0000 (UTC) Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v8N3f5Qj006549 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 23 Sep 2017 03:41:05 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v8N3eskj026150 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 23 Sep 2017 03:40:55 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 1dvbJG-0008TR-Bo; Fri, 22 Sep 2017 20:40:54 -0700 Received: from userv0022.oracle.com ([156.151.31.74]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1dvbIY-0008RG-Gw for ocfs2-devel@oss.oracle.com; Fri, 22 Sep 2017 20:40:12 -0700 Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v8N3eATC024948 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Sat, 23 Sep 2017 03:40:10 GMT Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.21/8.16.0.21) with SMTP id v8N3decB013835 for ; Sat, 23 Sep 2017 03:40:10 GMT Authentication-Results: oracle.com; spf=pass smtp.mailfrom=piaojun@huawei.com Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by userp2030.oracle.com with ESMTP id 2d57122s07-1 (version=TLSv1 cipher=RC4-SHA bits=128 verify=NOT) for ; Sat, 23 Sep 2017 03:40:04 +0000 Received: from 172.30.72.59 (EHLO DGGEMS403-HUB.china.huawei.com) ([172.30.72.59]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DHU10546; Sat, 23 Sep 2017 11:39:57 +0800 (CST) Received: from [10.177.253.249] (10.177.253.249) by smtp.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.301.0; Sat, 23 Sep 2017 11:39:50 +0800 To: , From: piaojun Message-ID: <59C5D77F.2030303@huawei.com> Date: Sat, 23 Sep 2017 11:39:43 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 X-Originating-IP: [10.177.253.249] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.59C5D78D.007B, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: e292bde063e8eb9d3a610cc463d33f7b X-CLX-Shades: MLX X-CLX-Response: 1TFkXGRoaEQpMehcZGhEKWU0XZ2ZyEQpZSRcacRsGGncGGBoaBhoGGgYbGho GGnEaEBp3BhoGGgYaBhoGGgYacRoQGncGGhEKWV4XaG55EQpJRhdFWEtJRk91WlhFTl9JXkNFRB 4RCkNOF3hzenh1fmxmUFpfTxJDZBNpbBpMWEYfTGB4bBJAX1BIEQpYXBcfBBoEGxsdB0wZS0kZS xwbBRsaBBsbGgQeEgQbEBseGh8aEQpeWRd7ARldGhEKTVwXGRwdEQpMWhdoaU1rexEKQ1oXHh8E GB4TBBgbGAQbExoRCkJeFxsRCkReFxgRCkRJFxgRCkJGF2B5R25JQ2ZGZ3J9EQpCXBcaEQpCRRd mXGx7cGRiehJ8QxEKQk4XbEJIWVMaTWV4eB0RCkJMF29LGRISRFl5WxtfEQpCbBdjBUJSZkBiXl p7UhEKQkAXekl9bxt4RV5wBVARCkJYF2J9b3kBTxgZcHB7EQpNXhcHGxEKWlgXGxEKcGgXZGtcb 25FE0kBYX8QBxkaEQpwaBdiX1NTbEkaf1x7SBAHGRoRCnBoF2RGX2N8YmhMHGlsEAcZGhEKcGgX aHxvRRoTemdrGEwQBxkaEQpwaBdnHRhQb0ZDTX9aZhAHGRoRCnBsF2FJeUN6c0l4Z2xiEAcZGhE KbX4XBxsRClhNF0sRIA== X-PDR: PASS X-ServerName: szxga04-in.huawei.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 ip4:45.249.212.32 ip4:45.249.212.35 ip4:119.145.14.93 ip4:58.251.152.93 ip4:194.213.3.17 ip4:206.16.17.72 ip4:45.249.212.255 ip4:45.249.212.187/29 ip4:45.249.212.191 ~all X-Proofpoint-Virus-Version: vendor=nai engine=5800 definitions=8662 signatures=668562 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=30 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=300 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709230054 Cc: ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [patch 1/2] ocfs2/dlm: protect 'tracking_list' by 'track_lock' 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: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Source-IP: userv0021.oracle.com [156.151.31.71] X-Virus-Scanned: ClamAV using ClamSMTP 'dlm->tracking_list' need to be protected by 'dlm->track_lock'. Signed-off-by: Jun Piao Reviewed-by: Alex Chen --- fs/ocfs2/dlm/dlmdomain.c | 7 ++++++- fs/ocfs2/dlm/dlmmaster.c | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index a2b19fb..b118525 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c @@ -726,12 +726,17 @@ void dlm_unregister_domain(struct dlm_ctxt *dlm) } /* This list should be empty. If not, print remaining lockres */ + spin_lock(&dlm->track_lock); if (!list_empty(&dlm->tracking_list)) { mlog(ML_ERROR, "Following lockres' are still on the " "tracking list:\n"); - list_for_each_entry(res, &dlm->tracking_list, tracking) + list_for_each_entry(res, &dlm->tracking_list, tracking) { + spin_unlock(&dlm->track_lock); dlm_print_one_lock_resource(res); + spin_lock(&dlm->track_lock); + } } + spin_unlock(&dlm->track_lock); dlm_mark_domain_leaving(dlm); dlm_leave_domain(dlm); diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 3e04279..44e7d18 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c @@ -589,9 +589,9 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm, res->last_used = 0; - spin_lock(&dlm->spinlock); + spin_lock(&dlm->track_lock); list_add_tail(&res->tracking, &dlm->tracking_list); - spin_unlock(&dlm->spinlock); + spin_unlock(&dlm->track_lock); memset(res->lvb, 0, DLM_LVB_LEN); memset(res->refmap, 0, sizeof(res->refmap));