Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1017144pxb; Thu, 9 Sep 2021 18:06:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwr8sFmIu3/Zf4MBW/YZT+rF4HH4Ew7F+/9daoK3ikrPZc8BCHjX/RbDPwmkzN5i0P11RCb X-Received: by 2002:a17:906:7847:: with SMTP id p7mr6401734ejm.335.1631235992036; Thu, 09 Sep 2021 18:06:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631235992; cv=none; d=google.com; s=arc-20160816; b=y8U+/0ynC7wmzKNCVNTHY6JfTUdmC9nHo0LWUcV413zlUsKH8eqjVKaEj+V8KQWM6t 4VHgHetPUhH7l6QmxQPgclfrLsV7fiNbSFON1uhWKPND19ohlVmlsEaxI2zFqiUn1Jfr YmXg8Qnt/YKuuuQy9ydyzj2N/vZMFnuJ8Jn9Ro2VpfRgHbSRKARsOut7l23adFhpm/4D APEfv2hVOtQVVDdDbcFGnwsGkB1CjFf7TGMXFFsa73bNWl9ojJiUswKyvM73MLZttkbH nCJVXAMsV7mCW0ah0DN3Sop9gGf45ecRwxgAEoKTg7v0HPrOpHDIE3C1gJIDjpCmrtly J0Dg== 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=2wKjk7L13Urzl98LME1ApSnPMg+mwuDx+a4lzh8NQ8E=; b=AwiuMWHs0VgZUFejRND8ardNMb1GAxOVGJOC5APx4GSi9uGZJru3nXDdF+R/dkMeV9 tJily/+n2nPLizfvbOY//wwpaB1HM+VVvnNWmbCH9GL5jn2K+nsTV1H8icbHNjup7SAg W4RZrSkHUHqtHZXDGP5vzX5KLOe57YqAyCVpqMUnp7+zrEpJFaqw4ungYm9kZxAVDP+P cdgUYmKj3ik65YkhSy+cSko8x9VziiFRy661KXS+b07iNYMK5DEzhpaIgArgQ766RndD WG3dMQHWUf9NszSSoa5LSWUoQxlaiW4mhP7DlacxwnpuwlQ2SLYbH/vtWqC8VYusJ81u Kw4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="DLJVS/M/"; 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 bh21si3466060ejb.428.2021.09.09.18.06.08; Thu, 09 Sep 2021 18:06:32 -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="DLJVS/M/"; 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 S235628AbhIJBBj (ORCPT + 99 others); Thu, 9 Sep 2021 21:01:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:49092 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234580AbhIJAXn (ORCPT ); Thu, 9 Sep 2021 20:23:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B47AA6103E; Fri, 10 Sep 2021 00:22:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631233353; bh=nfZcZfMndzPM5mHE2ZHlY1bfXb9A1B361MXkBXNqWIA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DLJVS/M/XBDpArMb+Xa7R4tPEezD9JfqKTJyfl2S9kKxXLd69+inb72Q7ry+KpdwE dmu3BZ9mON6ELcaD9wkx0m2UmzqNihM93q8Mc5U6UqQiTw68quBgpHrbHYvzE1CzrT f7TX156HD8w8znRspJ4gepIoU6zzI96F/3vKmaQcKIpLriTswm6oFD5uVb2dsepJR/ KA8NBn105ydsvTI3OPHYv33rTWGOGR4n+72tF6ttZkUQ1YXGNBnLDhxP8OWgq2CRb2 BhyZ7Bn9BpYCaURWiR0ad4jZCRm25f52xAfxbMVialtHOLLsJ7jOJD37LTsmlI4MKA NZWR6w9o/uSBg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Gang He , Joseph Qi , Mark Fasheh , Joel Becker , Junxiao Bi , Changwei Ge , Jun Piao , Andrew Morton , Linus Torvalds , Sasha Levin , ocfs2-devel@oss.oracle.com Subject: [PATCH AUTOSEL 5.4 37/37] ocfs2: ocfs2_downconvert_lock failure results in deadlock Date: Thu, 9 Sep 2021 20:21:42 -0400 Message-Id: <20210910002143.175731-37-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210910002143.175731-1-sashal@kernel.org> References: <20210910002143.175731-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: Gang He [ Upstream commit 9673e0050c39b0534d0e2ca431223f52089f4959 ] Usually, ocfs2_downconvert_lock() function always downconverts dlm lock to the expected level for satisfy dlm bast requests from the other nodes. But there is a rare situation. When dlm lock conversion is being canceled, ocfs2_downconvert_lock() function will return -EBUSY. You need to be aware that ocfs2_cancel_convert() function is asynchronous in fsdlm implementation. If we does not requeue this lockres entry, ocfs2 downconvert thread no longer handles this dlm lock bast request. Then, the other nodes will not get the dlm lock again, the current node's process will be blocked when acquire this dlm lock again. Link: https://lkml.kernel.org/r/20210830044621.12544-1-ghe@suse.com Signed-off-by: Gang He Reviewed-by: Joseph Qi Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Cc: Changwei Ge Cc: Gang He Cc: Jun Piao Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/ocfs2/dlmglue.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 50a863fc1779..7b27379abe02 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -3906,6 +3907,17 @@ static int ocfs2_unblock_lock(struct ocfs2_super *osb, spin_unlock_irqrestore(&lockres->l_lock, flags); ret = ocfs2_downconvert_lock(osb, lockres, new_level, set_lvb, gen); + /* The dlm lock convert is being cancelled in background, + * ocfs2_cancel_convert() is asynchronous in fs/dlm, + * requeue it, try again later. + */ + if (ret == -EBUSY) { + ctl->requeue = 1; + mlog(ML_BASTS, "lockres %s, ReQ: Downconvert busy\n", + lockres->l_name); + ret = 0; + msleep(20); + } leave: if (ret) -- 2.30.2