Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2567370lkm; Mon, 20 Sep 2021 18:54:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQOiomxs4mGwbq6AhXiGT4JkLa4nkOPP9uBkYRiwwiQynRMJv+39/DWe0fCp8bA86p52zy X-Received: by 2002:a02:2302:: with SMTP id u2mr4375015jau.32.1632188828444; Mon, 20 Sep 2021 18:47:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188828; cv=none; d=google.com; s=arc-20160816; b=YcXxgAkTazqqz7pKMe0NrcRAHgPgR04NDxB7fP4FiwCc9vmUoizA+ccrYMuYzmL3Jq pPBwlzJGGQJNFuzZJouZvviqM4uNeAwYcNAtd/Ddd8EiuFhSJFvbSxoJlILh/aISDZoO GgTnNkIDs2LMv7+BlNbTbwj4GUrb8e5Jkjmz5dloK2pEpXVZe9EUguplUBZwXNKSmHGe 7AZeIuDZFngrPk4ny5ScVSff+ANjssL8UrY7VqFX94vVIF1OHu3j1PzYLC531GmIw56J Ne1OsZERp51lwHjDenaxTU1d36aWKHGABBpNQTtHJoUL/Xqd9Uro7qWKByToeDSZZeZB vi1w== 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=u54xihXVLPYiJVkfh4FOsEpUTm4/I8UkQJV+VyAQd0I=; b=Q21McZbKUCBDV33AkcOkuwnZdmncEeXIs43RLD8QjfDtH4zGXxobz6s6oYWrMQVNSU hWca/hXnW96AjYd7B/6rOKmWAfsqGF8EZnReYD/mc/dF/gce6dC0EUuyE85QHo+ZKdj8 +vPlnPOXhQ0hoEzGGaobqxGPoawLqyPpWwLFDi7ICtADTI1V/7nYbqa66L1/EWzDpXYX zAwua8ochUH0Obbz8hlbXP/xPkJBxuRShERprH1TSwvRIBjIo43j5NQpMOmRVO1E6BIn 2Fgq3ywVXauKImwhQc8FFArbowJhWxI1mfAeGeytQeoyvUwZuy49C3U25ajzA058Mhti n7KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JTmcEGZ4; 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 g5si17369665jaj.5.2021.09.20.18.46.57; Mon, 20 Sep 2021 18:47:08 -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=JTmcEGZ4; 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 S1350356AbhITR2T (ORCPT + 99 others); Mon, 20 Sep 2021 13:28:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:56128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350048AbhITR0G (ORCPT ); Mon, 20 Sep 2021 13:26:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 475076135F; Mon, 20 Sep 2021 17:02:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632157352; bh=xhdoKSDHXdB+lWBA6Jjeu+jRei9dyhtrZCbnqD4y+DE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JTmcEGZ4t8QOlTmEXxvp6BkwBrSb96fwB3BJ4ejxbPrXzBz5Enj1ZuEkg0i8kN4nM /42HX5WGIu//XAbaZCLlc2ufc4rykcp/l5zVbWVb41JlD4yMs/7rvSvtUphvRUN8Rn +KcC+Ev6AWE5hpiDKiLm4I95fCPvH6QMSF6ulsDI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Peterson , Sasha Levin Subject: [PATCH 4.14 168/217] gfs2: Dont call dlm after protocol is unmounted Date: Mon, 20 Sep 2021 18:43:09 +0200 Message-Id: <20210920163930.329312854@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163924.591371269@linuxfoundation.org> References: <20210920163924.591371269@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 de733a6c30bb..f3c16a504c8d 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c @@ -295,6 +295,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