Message ID | 20230426115323.9455-1-abelova@astralinux.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp202692vqo; Wed, 26 Apr 2023 05:29:14 -0700 (PDT) X-Google-Smtp-Source: AKy350bkdJm7blPkcH5uFuu/jPowqL55hRw0ygsLTofTwHH4AMzKeA16wP/pdJDzT1nkHXR1ncOp X-Received: by 2002:a17:90a:eac4:b0:23c:ffbf:859e with SMTP id ev4-20020a17090aeac400b0023cffbf859emr19216231pjb.35.1682512153746; Wed, 26 Apr 2023 05:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682512153; cv=none; d=google.com; s=arc-20160816; b=BUGH7LFCr40dhFH9oCWN2RcbWIt4P2+Pb2MsTQvOeT/XpyddjPThyITKIo2mDFbrPl WxhqYyAwccwNpPr52iQSDaW7EkMQgpqURNaBdgnIJkJ+ketQqj0nezq2SXA9Nn+dhXc4 C15DefCpmWvJ50tYjpmG2Yj1L70Uqxc7K72mM3LAgb2eogxwptSj11H4LfUmhRA2rZlF 35DEhoYDE0BpXNqJ642yIrcQRKkRIpSr6sPsU6Lras1VsXVlv8YOyZfUiISXQj/2CHvl IG56gzmAJgIQMf47JYjva80kxxircxAk1sRbd11JxlwBB99hfCfgDieH8LqHWoAU+J4a /RnA== 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 :message-id:date:subject:cc:to:from; bh=p051oOFErQKnodZNcaf7FPBuK4FsweOUMZjW4BYDk2w=; b=WD66zbEPsMnnFi7vxAZ8Diy+WkswLwxoEkfyT+zA+AYD1Zyb7uTh/qR0STyHCMd4lc qzo2XzXWuPb6+ERZ1PCbmarOD3UZOTm7ExMt/z8bbM0iqlz8RsrT+vRjdYVBcKV2aqtV gV0SL0NSkVe+VRYfmRkzwFWzDSgayixrme2L4vNhzQlJ6aaEgJmRFFv88A0NtyfSlnB0 yErQNLLD3FCmyI0JUuFzFAd9ob19pXe+kEFZEC8xm8Q/UUoLOnIAXuKP6cnSmZmlR8Ao yGRCmf9WNvD9RufRCKMGprNm159BrrqczlFHyRWQqxYxE1I24s/5ez6Lz6i3JILYhi+5 Jz6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x14-20020a17090abc8e00b002474101aa7esi16430547pjr.163.2023.04.26.05.28.57; Wed, 26 Apr 2023 05:29:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240741AbjDZMBn (ORCPT <rfc822;zxc52fgh@gmail.com> + 99 others); Wed, 26 Apr 2023 08:01:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240555AbjDZMBm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 26 Apr 2023 08:01:42 -0400 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26519524B; Wed, 26 Apr 2023 05:01:41 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id A59581865397; Wed, 26 Apr 2023 14:53:32 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ETms406DFzkv; Wed, 26 Apr 2023 14:53:32 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 4669C186514B; Wed, 26 Apr 2023 14:53:32 +0300 (MSK) X-Virus-Scanned: amavisd-new at astralinux.ru Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id MRcqEvhIyWKF; Wed, 26 Apr 2023 14:53:32 +0300 (MSK) Received: from rbta-msk-lt-106062.astralinux.ru (unknown [10.177.20.23]) by mail.astralinux.ru (Postfix) with ESMTPSA id 83A841863E25; Wed, 26 Apr 2023 14:53:31 +0300 (MSK) From: =?utf-8?b?0JDQvdCw0YHRgtCw0YHQuNGPINCR0LXQu9C+0LLQsA==?= <abelova@astralinux.ru> To: Chris Mason <clm@fb.com> Cc: Anastasia Belova <abelova@astralinux.ru>, Josef Bacik <josef@toxicpanda.com>, David Sterba <dsterba@suse.com>, Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH] btrfs: parent bytenr must be aligned to sector size Date: Wed, 26 Apr 2023 14:53:23 +0300 Message-Id: <20230426115323.9455-1-abelova@astralinux.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764241864253704655?= X-GMAIL-MSGID: =?utf-8?q?1764241864253704655?= |
Series |
btrfs: parent bytenr must be aligned to sector size
|
|
Commit Message
Anastasia Belova
April 26, 2023, 11:53 a.m. UTC
From: Anastasia Belova <abelova@astralinux.ru> Change nodesize to sectorsize in alignment check in print_extent_item. Change requirement in comment. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: ea57788eb76d ("btrfs: require only sector size alignment for parent eb bytenr") Signed-off-by: Anastasia Belova <abelova@astralinux.ru> --- fs/btrfs/print-tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On 2023/4/26 19:53, Анастасия Белова wrote: > From: Anastasia Belova <abelova@astralinux.ru> > > Change nodesize to sectorsize in alignment check > in print_extent_item. Change requirement in comment. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Fixes: ea57788eb76d ("btrfs: require only sector size alignment for parent eb bytenr") > Signed-off-by: Anastasia Belova <abelova@astralinux.ru> Reviewed-by: Qu Wenruo <wqu@suse.com> A little surprised that a static checker can even find such hidden problem. Thanks, Qu > --- > fs/btrfs/print-tree.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c > index b93c96213304..cee005fb8209 100644 > --- a/fs/btrfs/print-tree.c > +++ b/fs/btrfs/print-tree.c > @@ -152,9 +152,9 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type) > offset, btrfs_shared_data_ref_count(eb, sref)); > /* > * offset is supposed to be a tree block which > - * must be aligned to nodesize. > + * must be aligned to sectorsize. > */ > - if (!IS_ALIGNED(offset, eb->fs_info->nodesize)) > + if (!IS_ALIGNED(offset, eb->fs_info->sectorsize)) > pr_info( > "\t\t\t(parent %llu not aligned to sectorsize %u)\n", > offset, eb->fs_info->sectorsize);
On Wed, Apr 26, 2023 at 02:53:23PM +0300, Анастасия Белова wrote: > From: Anastasia Belova <abelova@astralinux.ru> > > Change nodesize to sectorsize in alignment check > in print_extent_item. Change requirement in comment. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Fixes: ea57788eb76d ("btrfs: require only sector size alignment for parent eb bytenr") > Signed-off-by: Anastasia Belova <abelova@astralinux.ru> Added to misc-next, thanks.
On Wed, Apr 26, 2023 at 08:25:14PM +0800, Qu Wenruo wrote: > > > On 2023/4/26 19:53, Анастасия Белова wrote: > > From: Anastasia Belova <abelova@astralinux.ru> > > > > Change nodesize to sectorsize in alignment check > > in print_extent_item. Change requirement in comment. > > > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > > > Fixes: ea57788eb76d ("btrfs: require only sector size alignment for parent eb bytenr") > > Signed-off-by: Anastasia Belova <abelova@astralinux.ru> > > Reviewed-by: Qu Wenruo <wqu@suse.com> > > A little surprised that a static checker can even find such hidden problem. I've seen in Coverity a fuzzy report like "there are 8 cases that do thing X and this one does not, is it expected?" which is basically just pattern matching but can be caused by copy&paste mistakes.
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index b93c96213304..cee005fb8209 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c @@ -152,9 +152,9 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type) offset, btrfs_shared_data_ref_count(eb, sref)); /* * offset is supposed to be a tree block which - * must be aligned to nodesize. + * must be aligned to sectorsize. */ - if (!IS_ALIGNED(offset, eb->fs_info->nodesize)) + if (!IS_ALIGNED(offset, eb->fs_info->sectorsize)) pr_info( "\t\t\t(parent %llu not aligned to sectorsize %u)\n", offset, eb->fs_info->sectorsize);