Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3199988pxb; Mon, 9 Nov 2020 05:26:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuBagK2yjrig8sh2ZISaS1zUJl4qVs40bHqf4ZUDV371EIfQWkdjFmMNVF9CLY5X5pgjkU X-Received: by 2002:a50:9fc1:: with SMTP id c59mr14699668edf.59.1604928390293; Mon, 09 Nov 2020 05:26:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604928390; cv=none; d=google.com; s=arc-20160816; b=EAjqKLrf4GpOI1Ea8E/IKTL7H8M6qljyIWbh9oV3HJF2/GlkG8Peqboif9MNT5FCyZ t/hzdHPyRulHc3OOqdw/GOPjzLESCvccelOeHdorG7ADAaTL4pToXKHyl1LDoGinHg8M kUTiYBTVEvITNBwS/9OUMIIZ8tobGjkZA5OeFT+yNCKcLFNPV7bv1ZJ22j+ciBK0DRwA 7VszYWkoIgjoku76Sa+y/gvoTbc2MSvWZSzVD8REpPMLj7/vbaGJmWht+HYSVQt882rs TWWz5qtGCIoGhYSt47b37KaXnrOLGwYSBxZDXpIpqDuJdK13Avk1rAkvaf+zGMV1Eum6 TnoQ== 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=DGYw0KSGjjoArXFykWFu+h0rt91b51vIJJfqa9wWBpw=; b=ttTIcMB1mAiyLvf3RtA1ZcKJbRxNSwrcHN1tQJs877n5u5op6lnu5GnFdwmLTKiir0 YTqIVNP6/0rR52Kq8ivrFeY2vGpvK6VCNHXO7s5j7tvbn2Np/7+sBQfU19U7AaV65tzd fs4b42jTJ2ZiupKnuevaPRkHptth4AmtuCC0gCDOMcG1T21koHVwE4whsqHPqS2vOmIY SRZafD28N+IsZHR+quZ6GToS8ljgISqVXo5ZbvUB1N9n86PfhjL1LqnanlEsZehKjG+w atFriPqdbs+AWvR0NtUdY44a8FZZslf3BW2683saTDT0Lfx2Ic0J2m25ShMeVoZ5mb7Z BN+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=e4buvlAr; 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=fail (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 r19si7061802edb.489.2020.11.09.05.26.07; Mon, 09 Nov 2020 05:26:30 -0800 (PST) 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=default header.b=e4buvlAr; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387722AbgKINSi (ORCPT + 99 others); Mon, 9 Nov 2020 08:18:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:45732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732513AbgKINSX (ORCPT ); Mon, 9 Nov 2020 08:18:23 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4104D2083B; Mon, 9 Nov 2020 13:18:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927902; bh=HLMcZg+OeZn1+X+Sra4sGuFNXd1r46df3zQ3GoFXdLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e4buvlArklwCS3XcD8CnIF3fDv5zeLUtuIkSq+4GOwWAPBGusQRS0mM3DTLgfA1Sn ozjX2qZKkD+0ynPSFW/kx0fqsPjrUpfnoauFe3FzSqeeU/je+RpQGbbliWw49b91P2 rXiUTd83soYpF1MKHKgrCXEvoFtDNqbULiq3l3jI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Ahring Oder Aring , Andreas Gruenbacher Subject: [PATCH 5.9 059/133] gfs2: Dont call cancel_delayed_work_sync from within delete work function Date: Mon, 9 Nov 2020 13:55:21 +0100 Message-Id: <20201109125033.568736123@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125030.706496283@linuxfoundation.org> References: <20201109125030.706496283@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: Andreas Gruenbacher commit 6bd1c7bd4ee7b17980cdc347522dcb76feac9b98 upstream. Right now, we can end up calling cancel_delayed_work_sync from within delete_work_func via gfs2_lookup_by_inum -> gfs2_inode_lookup -> gfs2_cancel_delete_work. When that happens, it will result in a deadlock. Instead, gfs2_inode_lookup should skip the call to gfs2_cancel_delete_work when called from delete_work_func (blktype == GFS2_BLKST_UNLINKED). Reported-by: Alexander Ahring Oder Aring Fixes: a0e3cc65fa29 ("gfs2: Turn gl_delete into a delayed work") Cc: stable@vger.kernel.org # v5.8+ Signed-off-by: Andreas Gruenbacher Signed-off-by: Greg Kroah-Hartman --- fs/gfs2/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -180,7 +180,8 @@ struct inode *gfs2_inode_lookup(struct s error = gfs2_glock_nq_init(io_gl, LM_ST_SHARED, GL_EXACT, &ip->i_iopen_gh); if (unlikely(error)) goto fail; - gfs2_cancel_delete_work(ip->i_iopen_gh.gh_gl); + if (blktype != GFS2_BLKST_UNLINKED) + gfs2_cancel_delete_work(ip->i_iopen_gh.gh_gl); glock_set_object(ip->i_iopen_gh.gh_gl, ip); gfs2_glock_put(io_gl); io_gl = NULL;