Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2157989iof; Tue, 7 Jun 2022 21:41:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD8G133dpy+S4hcKIjzDlTbWVqzB/7IrJqyVRF2RhDjBOcB9Hp31HEvV14Oz//FKyqRy9m X-Received: by 2002:a17:903:2348:b0:163:fc70:a4cd with SMTP id c8-20020a170903234800b00163fc70a4cdmr32431621plh.89.1654663297744; Tue, 07 Jun 2022 21:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654663297; cv=none; d=google.com; s=arc-20160816; b=gegm+XQFwJTxhXNfoea5m3dZbIfQG4FulSJyuAvBuLhFDFZnwv3j1dbIKdTZmBYMu3 SAE9T98/08w5Y5UNwp3pPzvx6Ckz3aZSiqwO3jI230jPgO84+fuJHpnA2RFxhstnKTpg z9fvFP33aeC/v83I19ApqFE4TfYEVGa7K+Ir6z+HBPQcxQYjKb8Z8nEtxj9dPPedmtLa Kvg+upf+YqhSe4VGqMtr+Aam+2LDBS7OHJNEe6dqK2Ud2eM2lFg7n32YsWjhxJi3Mcdh mESaXMFfBh5gtySlYrWkI140zNCRH71Thz0X7B6biCsgXIwoBlTZT5zjAXiNcEVqV6jv YKLQ== 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=n8+OD3pnTT1617LoQ1cPmUiUM674bJp3vV/ZWaOuppE=; b=mf1bvK1JfK9Db81R7YRaiX17Mf6eRDkfRf+OkukmNNsKkw2zgKtM4CTAtOHDd8ObmX umZcW9Qep2LjQD6NygZ9s10iDN+rntvegeR4vmWiPjAzkp6HJ5tTm39bKaR8F2frJlVS p2PPKubTbFjpjQ8C9pe5Y9P97ozlzWrDC3e6h39LGGgsP6ZHPy1MAoAB8gZgMrG8KBmB +0xH+eY1D9blHczLI3i0ccENYTuS03J2ivpIL4RFXlAp50qhUCB/u9DUQso93T8yumwy pIzRR6wrR3E2GNdJLBvC3t3VCc9M1a+YK1rB8IG3zYP+tH7gTupVUi0Ag6mKt9qsKQm9 dGzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tazklCE7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h10-20020a170902f2ca00b001631214cc97si8157078plc.350.2022.06.07.21.41.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:41:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tazklCE7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8BFBB2B2F6D; Tue, 7 Jun 2022 21:12:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382927AbiFGV65 (ORCPT + 99 others); Tue, 7 Jun 2022 17:58:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379395AbiFGVCZ (ORCPT ); Tue, 7 Jun 2022 17:02:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EFAAAF1F5; Tue, 7 Jun 2022 11:48:01 -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 8F1386157E; Tue, 7 Jun 2022 18:48:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C257C385A2; Tue, 7 Jun 2022 18:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627680; bh=xf9XcbXTutHEaP8Ja6L4CnA04pALN4aTf1DHiUc7ZXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tazklCE7QNm9pWR7g1EDFOr6t5sp06H4DpPEIJIiINbT9BiicWyKSnmQVBnDuLD3z P6LWWpmd5axd5zQHU0zlWKmbTybgdxJr19fLSOYyq9NTlXXBW6ZoQQIamLMjbREtb+ aDhy42rTmEEPZE43JGI2b9amWUm4ygaH52dgqJgQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , David Sterba Subject: [PATCH 5.18 053/879] btrfs: zoned: fix comparison of alloc_offset vs meta_write_pointer Date: Tue, 7 Jun 2022 18:52:51 +0200 Message-Id: <20220607165004.227971390@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Naohiro Aota commit aa9ffadfcae33e611d8c2d476bcc2aa0d273b587 upstream. The block_group->alloc_offset is an offset from the start of the block group. OTOH, the ->meta_write_pointer is an address in the logical space. So, we should compare the alloc_offset shifted with the block_group->start. Fixes: afba2bc036b0 ("btrfs: zoned: implement active zone tracking") CC: stable@vger.kernel.org # 5.16+ Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/zoned.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1896,7 +1896,7 @@ int btrfs_zone_finish(struct btrfs_block /* Check if we have unwritten allocated space */ if ((block_group->flags & (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM)) && - block_group->alloc_offset > block_group->meta_write_pointer) { + block_group->start + block_group->alloc_offset > block_group->meta_write_pointer) { spin_unlock(&block_group->lock); return -EAGAIN; }