Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3647852ybz; Mon, 27 Apr 2020 20:31:49 -0700 (PDT) X-Google-Smtp-Source: APiQypLHV/kUtHtW2d/+aBHpO2JfhmUTUhiVmyLxB8a+5SJw3iVvr4mRz1FbjL5zla7ALTxLm/Il X-Received: by 2002:a17:906:72c8:: with SMTP id m8mr23554719ejl.318.1588044709627; Mon, 27 Apr 2020 20:31:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588044709; cv=none; d=google.com; s=arc-20160816; b=EQZVdiVLD7ZijyCE1QcEkx2ujECmaoTSCjuEYZSyyrlUn91NlZ0J2H3RwLGBWl0BfE ZyHM2C56qZGxvFtZgA9QNoUc5uobxBxM3efK+I4zrzIEZk9Wvvx/kzs+61nOSIFInI3p 2FmjLrR32/eXMwhw45Rj2Yk1+EMLlSI67RNyuplmXQdbgwgxLWzynfottlnYeyeMXBhD V9+ySW6I4KQbKWprOLjeaRoPDO2FuP3MwAQEIvOyLpsjMP0Mq9AYy9uhbiZUTM3tNtnQ tr3X44MrjlVHGVUJG+FsWnUSX9KgGuk6o7f5yv6tev135vPPKz4NMCjTyvgu2D+uolVZ pYnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=VPdKwqHvdRjB9W8pLZbsUot58AgAYYmvKvKCnZPieQY=; b=0y4x3iNMv0IW6XETgVcteShsPIdy97cuZgEitcfgmilQAjislokNRRZlN8M2lwY6Mm ZCnEwtz3aev7lC12CUiBdTP8vSv9Z1uf2lLmNH8cJr4FvjP8b0irMxLCzdxudD6AJKho iY5nBhPwvI6xZvz/l8Dgd2CUWTVs18BATBOhAJsYcovkobtWfV0f/jv0XfWcrtWtkl0K 1X1OpL8uo0PsaN13GSaEvHXyyGw5SwTQj3gMpovlnUSg+0IJNzmKk4JhwxT1OHddeSrD wvEToAyorSx75ZJGm3TxRHsbQiQssQdNKWRqWIS+BvVCOn0srALADZKQUyc/YFUHPWFW HX8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh4si969087ejb.385.2020.04.27.20.31.27; Mon, 27 Apr 2020 20:31:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726284AbgD1DaL (ORCPT + 99 others); Mon, 27 Apr 2020 23:30:11 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3357 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726047AbgD1DaL (ORCPT ); Mon, 27 Apr 2020 23:30:11 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id D54AAEE4D4C2439DAFE6; Tue, 28 Apr 2020 11:30:05 +0800 (CST) Received: from huawei.com (10.175.105.27) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Tue, 28 Apr 2020 11:29:59 +0800 From: Wu Bo To: , CC: , , , , Subject: [PATCH] fs/gfs2:lock a spinlock always before returning from do_xmote() Date: Tue, 28 Apr 2020 11:29:05 +0800 Message-ID: <1588044545-59405-1-git-send-email-wubo40@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.105.27] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The call stack is as follows: finish_xmote() ... spin_lock(&gl->gl_lockref.lock); ... --> do_xmote() spin_unlock(&gl->gl_lockref.lock); ... return; ... spin_unlock(&gl->gl_lockref.lock); do_xmote function needs to be locked before returning, Otherwise, there will be a double release lock in finish_xmote() function. Signed-off-by: Wu Bo --- fs/gfs2/glock.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 29f9b66..7129d10 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -613,6 +613,7 @@ static void do_xmote(struct gfs2_glock *gl, struct gfs2_holder *gh, unsigned int fs_err(sdp, "Error %d syncing glock \n", ret); gfs2_dump_glock(NULL, gl, true); } + spin_lock(&gl->gl_lockref.lock); return; } } -- 1.8.3.1