Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1276097rdb; Tue, 30 Jan 2024 13:26:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8oZL7yzkz0x/GD5J0nbIN9Vc9hfSeo3JUvQFjpfKwUS7AW+NHU+YVWLDN9Q0IEDpfDKH1 X-Received: by 2002:a05:6512:2256:b0:50e:aac2:b883 with SMTP id i22-20020a056512225600b0050eaac2b883mr8143999lfu.4.1706649990820; Tue, 30 Jan 2024 13:26:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706649990; cv=pass; d=google.com; s=arc-20160816; b=R9RppCI8gnO8MSR5BQIh0LgUwlTXrr4RET4FwqtA52sidImvVokb12jmhEaNBCSCbn NQSmjmr8rxKVteHWYn358vT6D4cGDJqrqOQbCjKCPq1hu72hqNyiBhWkhARtXMCbHBnv f0iZXt6vQ4RcnGTiTAhm/qW6KvR4ADzyOE/lnvtq5qgUmu56YqA7cjvAtf/KYnzeSXwa qrIpLspoDzFC8uCxuEjVzfyWDSlNZxOCWnfUNFkjNOMiHKNJEAV/mfkLcwfML0EzfUCO E/pZzquOOTz8TeeRJPf3GgpxmG+x5GYHcyA29f3j7iZ/n5Z3fTKonMnFoDa+DVxMBiQo cysw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=t3zeWxpTXlcMmHgsJwUhUFjTUPL8sXxe4QEeKQvWmn4=; fh=G05NM076TjiXt6w9RRNCIxkmsqPFlLeJzkRrcO3q3bU=; b=TuxLOq+wF1rRBc+zqKY2FIoI4DB58AUIyTNRll61mgExU6JBAKxYZzs2BzsQYsjT7r FFb8p38kFGSYhTDQzFRyS0SveGcF3v3myCYP6AcJmDq+28YnXh+I9Ql4LKa+rjLtH31z VwYrqV+8pf4c8PebtsHx7CNw+lz91P7nhR6fQAQjTqDp9w9GPEfLLRUoKq0Xdw/T6jGv va7nf59tKFT7QFAzAUG6JhCurjfCb8lVjhT+09R/e9jJeor6ub0GMqNzdMKhfqg8l4Qd GCYJhL/V5131N1MBFF1aKIiExCyQtWiW475jAMu55fpi46ROBSdyY2tdpDGJAcwHkeUn Z5cw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tQoCLCiI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-45327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45327-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s24-20020a056402037800b0055f19d410cdsi1780966edw.377.2024.01.30.13.26.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 13:26:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tQoCLCiI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-45327-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45327-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 57B851F2678C for ; Tue, 30 Jan 2024 21:16:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F07CD762DE; Tue, 30 Jan 2024 21:16:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tQoCLCiI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21E46762C3; Tue, 30 Jan 2024 21:16:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706649371; cv=none; b=uaG/VsIZXuTVa1YSUQx7xDE9xzq6qQxsaiK5hcpy+/tbZSCuEETek7yRZDiNT8IMzgCvSzAs5JzfksJrHOVkIpckXBN34RYCKGlTSohcUa0AYZ2iYYBi9UFlOVCqUrxmqIxQoZqW4fi5iWmifmkQy4J8wcEGlk+DLVZqnj09PGE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706649371; c=relaxed/simple; bh=QEITiAA4fWnHv2p/4qhjdzmkLWUAM9VU7hpD8HwJ/Jo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IhaVly2g1hVoA/yk8xDj0Mv5atmRQOVsAuJQrnTpYqG8KhmdVvMcW0/w0Sj3n7ccco/Fu5JekNv2354iIQoKqm0hOxqhR8A8u4oYvGrdA4jRBdOVVyIvJObSYtxZBVg/IPAMsqB2AEAjG1BbsxzsLcHDHlWdDwv4fD0VR076ywQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tQoCLCiI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69782C433C7; Tue, 30 Jan 2024 21:16:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706649370; bh=QEITiAA4fWnHv2p/4qhjdzmkLWUAM9VU7hpD8HwJ/Jo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tQoCLCiIRs0madwA6Bf1jlvV8wCtLFch0d00Z3zjj5Yl+IERbCzF6BKSAZWlaWonK 7PPEqqo1zhdR1soCXIjN3+KCJ84LZHdxRg/TqvAgNtMf4XCnRRAflYAyiT2cDyTE74 gknj7zAUVf5DXtz0prmR2p+Jk/MUTLuCpjznRk7hM8yhl0ugvL8Ye0x9IUdwjydBBx 0zVcnzjm3huFtRFAsaX/F4xIr4Zs/8p9/MW79STbUGNHjja5GiahUSsEiGyhoJIs8w NdzHjYI++eZTdqj7mP3CQO3QtE2VTQ8FPURdfxbI3jMco9mMlrZa7JGJn1h+nMkxlh 0ZZCkTVmTXUsg== Date: Tue, 30 Jan 2024 16:16:09 -0500 From: Sasha Levin To: Andreas Gruenbacher Cc: Pavel Machek , linux-kernel@vger.kernel.org, stable@vger.kernel.org, gfs2@lists.linux.dev Subject: Re: [PATCH AUTOSEL 4.19 11/12] gfs2: Refcounting fix in gfs2_thaw_super Message-ID: References: <20240116002817.216837-1-sashal@kernel.org> <20240116002817.216837-11-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Jan 18, 2024 at 12:50:37PM +0100, Andreas Gruenbacher wrote: >On Tue, Jan 16, 2024 at 9:53 PM Pavel Machek wrote: >> Hi! >> >> > From: Andreas Gruenbacher >> > >> > [ Upstream commit 4e58543e7da4859c4ba61d15493e3522b6ad71fd ] >> > >> > It turns out that the .freeze_super and .thaw_super operations require >> > the filesystem to manage the superblock refcount itself. We are using >> > the freeze_super() and thaw_super() helpers to mostly take care of that >> > for us, but this means that the superblock may no longer be around by >> > when thaw_super() returns, and gfs2_thaw_super() will then access freed >> > memory. Take an extra superblock reference in gfs2_thaw_super() to fix >> > that. >> >> Patch was broken during backport. >> >> > +++ b/fs/gfs2/super.c >> > @@ -1013,6 +1013,7 @@ static int gfs2_freeze(struct super_block *sb) >> > goto out; >> > } >> > >> > + atomic_inc(&sb->s_active); >> > for (;;) { >> > error = gfs2_lock_fs_check_clean(sdp, &sdp->sd_freeze_gh); >> > if (!error) >> > @@ -1034,6 +1035,7 @@ static int gfs2_freeze(struct super_block *sb) >> > error = 0; >> > out: >> > mutex_unlock(&sdp->sd_freeze_mutex); >> > + deactivate_super(sb); >> > return error; >> > } >> >> Notice the goto out? That now jumps around the atomic_inc, but we >> still do decrease. This will break 4.19, please fix or drop. > >Thanks, Pavel. > >Sasha, you don't want that fix without "gfs2: Rework freeze / thaw >logic" and the follow-up fixes, and backporting that probably isn't >going to be worth it. I'll drop it, thanks! -- Thanks, Sasha