Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3936840ybz; Tue, 28 Apr 2020 02:58:16 -0700 (PDT) X-Google-Smtp-Source: APiQypLFz4IkTEc5vBKYFEeCB1jirXjt7FawqnTm96WwmBbnkaCaqjRL45kWxlEeQV6gu8/DDXXq X-Received: by 2002:a17:906:6d90:: with SMTP id h16mr23256698ejt.117.1588067896548; Tue, 28 Apr 2020 02:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588067896; cv=none; d=google.com; s=arc-20160816; b=n/TJHyUI5CocxZSK4S/YiVu/HG+ybVtn9FKZw9QmGklWHGLfwdpNUvDvNq4pZa5M2t UolfGZhdkTh/9pZ7286up8y/tZv//ZXuTEb7qjHG54j21YMze3gBGVFnWeASuGwwev/r PNxfDcRoQBuUejD72/j5PjxUyoB6kBBoOaTpbqqz/MSxV6SXRYz88f8s651eO/EOjdNe st5zVrJX/m8kQbADfLEZ8dZRP159Gd0TlS66xvHO5RCsWSQY4lvog2Ai08fQxW45mCXr Wu8HUQzX5Hu98XX00nUzh1J+BNgATO7s2xQ/NToINaTjXGWysjwOBhlwKiPi+jV32Nxu Wg8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=G/W9aZ+NrlbasjS1nCPVX9FlfhgpXwkP8D2tIF11REs=; b=yzrDuIarD16ulGae6qhyqGnCmcloHu8aV9hgdcTs50vg0fhTDaKGtKv5njBRKtPEv0 l4t9D3V228+B8cGKhSV3D7lklONnhf9upTSv4EDe55NYR9xsoUAplzTHmFwRuc+/t7qg 2GhipCEdxOjgFAJzOl25mfhwOFDsEbjtSluOJA07MBctzC/IXRytfDx9Ggr5Vw81cbVx AlTsXxy2BgkOq/DMu4ryoLus51p952/pn0zEgyZ7vEYGZZD6jMETQBFEKQ34/palFwx3 rKjpiV6uevkmzVCkN2hbtnljtt1wdY5LRWBy9YddYQc9Net1uglRW1hkNXSwZ5GLkZm0 riLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DIaKxGUy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j10si1219508edq.88.2020.04.28.02.57.52; Tue, 28 Apr 2020 02:58:16 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DIaKxGUy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727082AbgD1J4P (ORCPT + 99 others); Tue, 28 Apr 2020 05:56:15 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:46167 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726971AbgD1J4P (ORCPT ); Tue, 28 Apr 2020 05:56:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588067774; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=G/W9aZ+NrlbasjS1nCPVX9FlfhgpXwkP8D2tIF11REs=; b=DIaKxGUyfEFwff/wQLHU/SyLoxGSXTuxg7LyGndqMt3NLFkL4zE1r784mBne0/k0/VJUM9 WSIvpJLF2IGx3zg96bZbrAzGujJ3ieIkOPRV4MUEPLD7GaB6YCwzFrh1SxDvna43p3YcaH KZWOQW0ikBS0SlKbaIi+BszVNSzr4Fs= Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-263-3QbeTpypM7qHfFvRno3P4Q-1; Tue, 28 Apr 2020 05:56:12 -0400 X-MC-Unique: 3QbeTpypM7qHfFvRno3P4Q-1 Received: by mail-oo1-f70.google.com with SMTP id h26so19114027oos.13 for ; Tue, 28 Apr 2020 02:56:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=G/W9aZ+NrlbasjS1nCPVX9FlfhgpXwkP8D2tIF11REs=; b=pS3YA3rKJH/mC+JvH+ngrW6qF+GQfuWE1p63QRWjukbZTGB2FCKLSfNxYIPS34QUv2 hAE3RkdYB60pu1IbK9PLdWYrIBWOAubXZneQ5h4Fl4IgU4xu3qZ+ujDC6WVC4JTMP8jO q23S5frwAu7Mnadi4IZYo7Jb/krlgS7lHKRx5j2tFDC7rWl9MLTcgVnVaYfu7jqNE2Hw WW838Plf9UKBaJCvjEzoyj6h0du8ylhigDA5pmBxw5nJhxvhvWYafONSEFcrvAJJ6B9b 89NQ22wJLT4/TwXE6V/F66avSFrtY7NyyfnwEp9aPOr6Cp0iDR4yXSlLObDmEOUi2AOc NLOg== X-Gm-Message-State: AGi0PuazJvFAmHzhQRzzrSuLYFNK5wjyB/0zI83NuG4oUj0I/bqtP3j+ xP2YmYI3k5PmE45X6EIwo96JekphCeS9nSGA2AUeQTE2dSld8R4o1sNUlZCxekVCg+rr1iSHDoB 1OT5ZL8AxE0gRN3kYub1Vdxri0f2NRMs5OPa5zKLP X-Received: by 2002:a05:6830:1da1:: with SMTP id z1mr21876594oti.58.1588067772161; Tue, 28 Apr 2020 02:56:12 -0700 (PDT) X-Received: by 2002:a05:6830:1da1:: with SMTP id z1mr21876580oti.58.1588067771926; Tue, 28 Apr 2020 02:56:11 -0700 (PDT) MIME-Version: 1.0 References: <1588044545-59405-1-git-send-email-wubo40@huawei.com> In-Reply-To: <1588044545-59405-1-git-send-email-wubo40@huawei.com> From: Andreas Gruenbacher Date: Tue, 28 Apr 2020 11:56:00 +0200 Message-ID: Subject: Re: [PATCH] fs/gfs2:lock a spinlock always before returning from do_xmote() To: Wu Bo Cc: Bob Peterson , cluster-devel , LKML , liuzhiqiang26@huawei.com, linfeilong@huawei.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tue, Apr 28, 2020 at 5:30 AM Wu Bo wrote: > 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 this patch looks correct. We've independently discovered this bug as well in the meantime, and we'll send the fix upstream. Thanks, Andreas