Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1568263pxb; Thu, 16 Sep 2021 10:05:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzb7e6pbk2J1XD0OSxIz1KHjWdR6ntOLtmNRWabQsTur/+FqApMzsJvu+oeklTVt4SCHiiT X-Received: by 2002:a05:6402:2061:: with SMTP id bd1mr7669876edb.186.1631811901225; Thu, 16 Sep 2021 10:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631811901; cv=none; d=google.com; s=arc-20160816; b=gMCH75kusMlfICabLDZD6VuTcRsqw56+wPF+vttTT6icT7uFYIfmr96QcuaviTYV6P muEBvOXYpNjXafvm8ywi2/9NzoXgmVfTDxok1yK/csEqtpoUEVrIE8S5fsshkJHpqXU8 3dSZnSx/V1SpEZwaKqnjC0U/6vdWHShP/n2iJF0o94p19+Vt/zbVEnYiYA93U12SFPja l+VFXvUpV1ZzMrw/zLNgJpxY5e9l7wauHNMgMV2c0k/h+ABtW4c8v7U+rpnkz6xXXbUy 0PD2TMwJ2OfElWOOqxNJL2haoaVXhdRHyyXzzlge3XP6UpihMsAowUTmOYdQH6mRtDyX PpuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=j/pEqNYwoJrMwuJKW2tLDot0/9GiOtVLQyy4LX27do4=; b=pKlbRITVe+7Nx39g2DxMeXVYCjuZQev7twcCw4/V0yPurbGfjTURvrY6V5n9WDBJkG xVeH7vOzOIrIRjqQAhGpF01WssJZzJi0z0y2/s1loLkHl9G0k40P+QdCekfLDtbMUZIQ vP8XSmfi58BrLUzKIgqEDa5AqsRekJm4IeRWfqO286fgs+79NQfPUtlYTQ76Ps3sHG8h ModIGR82ZiTyAR5XPKC896ro4QHjHxYnZEnfhRj7wdRAk/stV1eM7GPLDLuoTwmL1ODL PBGprSkdVAQ1t4EYFNHprf9UKaMWEXY6r/rJWBICs0SIdtgkT5jKkrmYAD74SqQnnAz1 P+TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v2A6JLoQ; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i11si5634630edb.418.2021.09.16.10.04.36; Thu, 16 Sep 2021 10:05:01 -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=@linuxfoundation.org header.s=korg header.b=v2A6JLoQ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348461AbhIPRCx (ORCPT + 99 others); Thu, 16 Sep 2021 13:02:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:51636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346322AbhIPQyn (ORCPT ); Thu, 16 Sep 2021 12:54:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D79806137B; Thu, 16 Sep 2021 16:30:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809807; bh=aaidjrucUKnmG5VQ3F5mQ4dXhXB0XltpnQ3cCWjebso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v2A6JLoQ6hnBeKlh/qdY14i9klLzP3THSUFZRKPc8QhnpQWbqEb8/AU0KpoJyEuq8 yrhHb8MtnURJiV/KMI++SbJyH4eHQWC+jUgmfQX7GbuJlxVp2TYw8vczUROzw2JNA5 vLjZdCpPe7g0GbDFZFLPlwogwXqyFQPIonNXcSkY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Peterson , Sasha Levin Subject: [PATCH 5.13 291/380] gfs2: Dont call dlm after protocol is unmounted Date: Thu, 16 Sep 2021 18:00:48 +0200 Message-Id: <20210916155813.969528600@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bob Peterson [ Upstream commit d1340f80f0b8066321b499a376780da00560e857 ] In the gfs2 withdraw sequence, the dlm protocol is unmounted with a call to lm_unmount. After a withdraw, users are allowed to unmount the withdrawn file system. But at that point we may still have glocks left over that we need to free via unmount's call to gfs2_gl_hash_clear. These glocks may have never been completed because of whatever problem caused the withdraw (IO errors or whatever). Before this patch, function gdlm_put_lock would still try to call into dlm to unlock these leftover glocks, which resulted in dlm returning -EINVAL because the lock space was abandoned. These glocks were never freed because there was no mechanism after that to free them. This patch adds a check to gdlm_put_lock to see if the locking protocol was inactive (DFL_UNMOUNT flag) and if so, free the glock and not make the invalid call into dlm. I could have combined this "if" with the one that follows, related to leftover glock LVBs, but I felt the code was more readable with its own if clause. Signed-off-by: Bob Peterson Signed-off-by: Sasha Levin --- fs/gfs2/lock_dlm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index dac040162ecc..50578f881e6d 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c @@ -299,6 +299,11 @@ static void gdlm_put_lock(struct gfs2_glock *gl) gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT); gfs2_update_request_times(gl); + /* don't want to call dlm if we've unmounted the lock protocol */ + if (test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) { + gfs2_glock_free(gl); + return; + } /* don't want to skip dlm_unlock writing the lvb when lock has one */ if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) && -- 2.30.2