Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs: parent bytenr must be aligned to sector size
@ 2023-04-26 11:53 Анастасия Белова
  2023-04-26 12:25 ` Qu Wenruo
  2023-04-28 16:42 ` David Sterba
  0 siblings, 2 replies; 4+ messages in thread
From: Анастасия Белова @ 2023-04-26 11:53 UTC (permalink / raw)
  To: Chris Mason
  Cc: Anastasia Belova, Josef Bacik, David Sterba, Qu Wenruo,
	linux-btrfs, linux-kernel, lvc-project

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(-)

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);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: parent bytenr must be aligned to sector size
  2023-04-26 11:53 [PATCH] btrfs: parent bytenr must be aligned to sector size Анастасия Белова
@ 2023-04-26 12:25 ` Qu Wenruo
  2023-04-28 16:44   ` David Sterba
  2023-04-28 16:42 ` David Sterba
  1 sibling, 1 reply; 4+ messages in thread
From: Qu Wenruo @ 2023-04-26 12:25 UTC (permalink / raw)
  To: Анастасия Белова,
	Chris Mason
  Cc: Josef Bacik, David Sterba, linux-btrfs, linux-kernel, lvc-project



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);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: parent bytenr must be aligned to sector size
  2023-04-26 11:53 [PATCH] btrfs: parent bytenr must be aligned to sector size Анастасия Белова
  2023-04-26 12:25 ` Qu Wenruo
@ 2023-04-28 16:42 ` David Sterba
  1 sibling, 0 replies; 4+ messages in thread
From: David Sterba @ 2023-04-28 16:42 UTC (permalink / raw)
  To: Анастасия Белова
  Cc: Chris Mason, Josef Bacik, David Sterba, Qu Wenruo, linux-btrfs,
	linux-kernel, lvc-project

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: parent bytenr must be aligned to sector size
  2023-04-26 12:25 ` Qu Wenruo
@ 2023-04-28 16:44   ` David Sterba
  0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2023-04-28 16:44 UTC (permalink / raw)
  To: Qu Wenruo
  Cc: Анастасия Белова,
	Chris Mason, Josef Bacik, David Sterba, linux-btrfs, linux-kernel,
	lvc-project

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-28 16:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-26 11:53 [PATCH] btrfs: parent bytenr must be aligned to sector size Анастасия Белова
2023-04-26 12:25 ` Qu Wenruo
2023-04-28 16:44   ` David Sterba
2023-04-28 16:42 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox