Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp453354pxb; Thu, 9 Sep 2021 04:57:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynHxT43j1C4D5lM1eW78iC0Lq+gXaZYlO9wLFxK3zYLvBKouucR+fKLKRJLFVRFfuSLzzT X-Received: by 2002:a5e:db06:: with SMTP id q6mr2331958iop.24.1631188679525; Thu, 09 Sep 2021 04:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631188679; cv=none; d=google.com; s=arc-20160816; b=BxLsZHTEZJew9m0BXpqJEjYSYgnKbdCGROxNXbNpv0j/lcRLNyxPAodMh19xw1yQVl sGRHUa/CMNd2Ajb6BdEFdPhA1iBHi9Zlk6rJHf71U0B8rUrElDs6CXy650n771echx8r SemUJQ2rwHpLRR/7dLcQ064sVjottmbGqpBpWOIaHE3Gfb67y5ds9ven5oZCLqJYcEWY /KP3zMKwz8LTSfKOYmX2SlXdvrJhEuGO2DAKy3fFzV6M9BFQ1x/XZNxdmOgA++1n7BOd epCY3uvihks1J7feEldqkm/2ADt6EsxD4WmsSSyJmSgduCEumB77edGTG0PQFj81jga0 ft5g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=j/pEqNYwoJrMwuJKW2tLDot0/9GiOtVLQyy4LX27do4=; b=nE92la4umBzAmTzpVx/sIM66OWTZ1X9XtpOBXgPBzQ9BikyZe4G1C1mnf82Fgd/noK m/eT8kRTz7QwNnb91M646kh8wvX23ujw+buLtePCyw54b+Gbyr99F1chrFD8IMJIsEsI s45oDaHZiLQCktV9RRvOoh4eHNNUlszZn8Zr693UCQ346AvwvjFTh6GnyzO7mgFLUOtw WPfKAPva10km6Xw4kgnNrIy8aBlHBK1zeekqz7k+mM3kzApq0CTVY2W48CPA8evarKDE lN4oR7I4mVTSc/V7b5mVZJgVxigtelTFwuq+O9XpV/xrefkLs0fSNqaQW6OZ9qHR4ghW zG/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rfNqHeCu; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a21si1511881iot.52.2021.09.09.04.57.48; Thu, 09 Sep 2021 04:57:59 -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=@kernel.org header.s=k20201202 header.b=rfNqHeCu; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245686AbhIIL6Q (ORCPT + 99 others); Thu, 9 Sep 2021 07:58:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:33084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245395AbhIILzB (ORCPT ); Thu, 9 Sep 2021 07:55:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AEED4613AC; Thu, 9 Sep 2021 11:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187901; bh=aaidjrucUKnmG5VQ3F5mQ4dXhXB0XltpnQ3cCWjebso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rfNqHeCuhK/TmTNp9aR3ZPvnlW+TNwwejoHNxgh1P6kgDFnToJ/LQ1C3JVqPzEsEP 4mKZGWD+7vbc6TAXUCdesX22xKpB08WCBg63akUnCSqkVkBSEUm+KaYXdttCKT5+0u S1OJbFAiSJ7w5FOyDmrIV68U9SojI4QrJnISxYJ6fONbZEYK2ivkWL+oZtOzpCwZPl Huuwe9h862tYwOi3/mSUETDqaM/SmhnMIslSIl0/8wDFwYDrvEnKiCxHEFCP9LtFhX oXRwV1jkLnHVDsdNJPPy8RZyVUIVMLwG908Xp8ZLG/nmzVpGhI5qx+WgkNuNAlmRLz 0NY7QUpNspPXw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Bob Peterson , Sasha Levin , cluster-devel@redhat.com Subject: [PATCH AUTOSEL 5.14 180/252] gfs2: Don't call dlm after protocol is unmounted Date: Thu, 9 Sep 2021 07:39:54 -0400 Message-Id: <20210909114106.141462-180-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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