From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4F73C433F5 for ; Thu, 7 Apr 2022 01:14:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236865AbiDGBQH (ORCPT ); Wed, 6 Apr 2022 21:16:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236391AbiDGBPH (ORCPT ); Wed, 6 Apr 2022 21:15:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4482218B79E; Wed, 6 Apr 2022 18:11:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D259861DB6; Thu, 7 Apr 2022 01:11:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DF84C385A1; Thu, 7 Apr 2022 01:11:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649293904; bh=OGXDnjSv/Z8qV6JPXoCrwuLS8j7UjPE3K1VbZyL6+7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pWYTnN5pYIu6pCWBy265wHXBjEwwM7dxZHrTYTBipwiUVX/DHHbbad7JYkVrQ8DmT mg+KJJ47RPpKv7rE/RGvbLXBQmE2g5Ilwoy5G8FdieFxkdo0v1g6gmQ9Kcb40+YS0k b6unqR5+5FpMSzdjv3XGoZ0bKR5vtmIedAK2v5nsH6mjuBhS0WaurxrRos3RvRfxFc F1J0VifNS8mns5by4oJQ8bycNV+LGIXV6pz0Tu43gYlT5qfc1FLNbdIeZJVX6htNNM 9d2Wntyl4ntBu5gnhyPtr++gR3Va0CPUDTYQxLGmhtsRTTTxp/nKdHhaIkMROzGSAj /svPpcOvCXoOQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Andreas Gruenbacher , Bob Peterson , Sasha Levin , cluster-devel@redhat.com Subject: [PATCH AUTOSEL 5.16 02/30] gfs2: cancel timed-out glock requests Date: Wed, 6 Apr 2022 21:11:12 -0400 Message-Id: <20220407011140.113856-2-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407011140.113856-1-sashal@kernel.org> References: <20220407011140.113856-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: Andreas Gruenbacher [ Upstream commit 1fc05c8d8426d4085a219c23f8855c4aaf9e3ffb ] The gfs2 evict code tries to upgrade the iopen glock from SH to EX. If the attempt to upgrade times out, gfs2 needs to tell dlm to cancel the lock request or it can deadlock. We also need to wake up the process waiting for the lock when dlm sends its AST back to gfs2. Signed-off-by: Andreas Gruenbacher Signed-off-by: Bob Peterson Signed-off-by: Sasha Levin --- fs/gfs2/glock.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index e946ccba384c..20f2df1ac4d7 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -669,6 +669,8 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret) /* Check for state != intended state */ if (unlikely(state != gl->gl_target)) { + if (gh && (ret & LM_OUT_CANCELED)) + gfs2_holder_wake(gh); if (gh && !test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)) { /* move to back of queue and try next entry */ if (ret & LM_OUT_CANCELED) { @@ -1691,6 +1693,14 @@ void gfs2_glock_dq(struct gfs2_holder *gh) struct gfs2_glock *gl = gh->gh_gl; spin_lock(&gl->gl_lockref.lock); + if (list_is_first(&gh->gh_list, &gl->gl_holders) && + !test_bit(HIF_HOLDER, &gh->gh_iflags)) { + spin_unlock(&gl->gl_lockref.lock); + gl->gl_name.ln_sbd->sd_lockstruct.ls_ops->lm_cancel(gl); + wait_on_bit(&gh->gh_iflags, HIF_WAIT, TASK_UNINTERRUPTIBLE); + spin_lock(&gl->gl_lockref.lock); + } + __gfs2_glock_dq(gh); spin_unlock(&gl->gl_lockref.lock); } -- 2.35.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Date: Wed, 6 Apr 2022 21:11:12 -0400 Subject: [Cluster-devel] [PATCH AUTOSEL 5.16 02/30] gfs2: cancel timed-out glock requests In-Reply-To: <20220407011140.113856-1-sashal@kernel.org> References: <20220407011140.113856-1-sashal@kernel.org> Message-ID: <20220407011140.113856-2-sashal@kernel.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit A non-text attachment was scrubbed... Name: not available Type: application/octet-stream Size: 1643 bytes Desc: not available URL: