Message ID | 20240611073443.1207998-1-srivathsa.d.dara@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] btrfs-progs: tests: add convert test case for block number overflow | expand |
在 2024/6/11 17:04, Srivathsa Dara 写道: > This test case will test whether btrfs-convert can handle ext4 > filesystems that are largerthan or equal to 16TiB. > > At 16TiB block numbers overflow 32 bits, btrfs-convert either fails or > corrupts fs if 64 bit block numbers are not supported. > > Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > --- > .../018-fs-size-overflow/test.sh | 22 ++++++++++++------- > 1 file changed, 14 insertions(+), 8 deletions(-) > > diff --git a/tests/convert-tests/018-fs-size-overflow/test.sh b/tests/convert-tests/018-fs-size-overflow/test.sh > index 1c2860fa..202e9039 100755 > --- a/tests/convert-tests/018-fs-size-overflow/test.sh > +++ b/tests/convert-tests/018-fs-size-overflow/test.sh > @@ -1,6 +1,6 @@ > #!/bin/bash > -# Check if btrfs-convert can handle an ext4 fs whose size is 64G. > -# That fs size could trigger a multiply overflow and screw up free space > +# Check if btrfs-convert can handle an ext4 fs whose size is 64G and 16T. > +# These fs sizes could trigger overflows and screw up free space > # calculation > > source "$TEST_TOP/common" || exit > @@ -10,11 +10,17 @@ check_prereq btrfs-convert > check_global_prereq mke2fs > > setup_root_helper > -prepare_test_dev 64g > > -convert_test_prep_fs ext4 mke2fs -t ext4 -b 4096 > -run_check_umount_test_dev > +for size in '64g' '16t'; do > + prepare_test_dev $size > > -# Unpatched btrfs-convert would fail half way due to corrupted free space > -# cache tree > -convert_test_do_convert > + convert_test_prep_fs ext4 mke2fs -t ext4 -b 4096 > + run_check_umount_test_dev > + > + # Unpatched btrfs-convert would fail half way due to corrupted > + # free space cache tree > + convert_test_do_convert > + > + run_check_mount_test_dev > + run_check_umount_test_dev > +done
On Tue, Jun 11, 2024 at 07:34:43AM +0000, Srivathsa Dara wrote: > This test case will test whether btrfs-convert can handle ext4 > filesystems that are largerthan or equal to 16TiB. > > At 16TiB block numbers overflow 32 bits, btrfs-convert either fails or > corrupts fs if 64 bit block numbers are not supported. > > Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com> Added to devel, thanks.
> From: David Sterba <dsterba@suse.cz> > Sent: Thursday, June 13, 2024 2:14 AM > To: Srivathsa Dara <srivathsa.d.dara@oracle.com> > Cc: linux-btrfs@vger.kernel.org; Rajesh Sivaramasubramaniom <rajesh.sivaramasubramaniom@oracle.com>; > Junxiao Bi <junxiao.bi@oracle.com>; clm@fb.com; josef@toxicpanda.com; dsterba@suse.com; wqu@suse.com > Subject: [External] : Re: [PATCH v2] btrfs-progs: tests: add convert test case for block number overflow > > On Tue, Jun 11, 2024 at 07:34:43AM +0000, Srivathsa Dara wrote: > > This test case will test whether btrfs-convert can handle ext4 > > filesystems that are largerthan or equal to 16TiB. > > > > At 16TiB block numbers overflow 32 bits, btrfs-convert either fails or > > corrupts fs if 64 bit block numbers are not supported. > > > > Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com> > > Added to devel, thanks. Hi David, I don't see this patch in the devel branch. Is there any issue?
On Mon, Jul 08, 2024 at 10:27:48AM +0000, Srivathsa Dara wrote: > > From: David Sterba <dsterba@suse.cz> > > Sent: Thursday, June 13, 2024 2:14 AM > > To: Srivathsa Dara <srivathsa.d.dara@oracle.com> > > Cc: linux-btrfs@vger.kernel.org; Rajesh Sivaramasubramaniom <rajesh.sivaramasubramaniom@oracle.com>; > > Junxiao Bi <junxiao.bi@oracle.com>; clm@fb.com; josef@toxicpanda.com; dsterba@suse.com; wqu@suse.com > > Subject: [External] : Re: [PATCH v2] btrfs-progs: tests: add convert test case for block number overflow > > > > On Tue, Jun 11, 2024 at 07:34:43AM +0000, Srivathsa Dara wrote: > > > This test case will test whether btrfs-convert can handle ext4 > > > filesystems that are largerthan or equal to 16TiB. > > > > > > At 16TiB block numbers overflow 32 bits, btrfs-convert either fails or > > > corrupts fs if 64 bit block numbers are not supported. > > > > > > Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com> > > > > Added to devel, thanks. > > Hi David, > > I don't see this patch in the devel branch. Is there any issue? Sorry, I don't remember why it was not merged back then. I see some issues with test: 'prepare_test_dev' cannot be used in a loop like that, besides it can be an external block device that won't change its size A temporary file needs to be created instead, I vaguely remember that there could be a problem with underlying filesystem not able to create such large files, eg. when run in the CI. The workaround is to create another btrfs filesystem (can be on the default test image) and then use it for convert.
diff --git a/tests/convert-tests/018-fs-size-overflow/test.sh b/tests/convert-tests/018-fs-size-overflow/test.sh index 1c2860fa..202e9039 100755 --- a/tests/convert-tests/018-fs-size-overflow/test.sh +++ b/tests/convert-tests/018-fs-size-overflow/test.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Check if btrfs-convert can handle an ext4 fs whose size is 64G. -# That fs size could trigger a multiply overflow and screw up free space +# Check if btrfs-convert can handle an ext4 fs whose size is 64G and 16T. +# These fs sizes could trigger overflows and screw up free space # calculation source "$TEST_TOP/common" || exit @@ -10,11 +10,17 @@ check_prereq btrfs-convert check_global_prereq mke2fs setup_root_helper -prepare_test_dev 64g -convert_test_prep_fs ext4 mke2fs -t ext4 -b 4096 -run_check_umount_test_dev +for size in '64g' '16t'; do + prepare_test_dev $size -# Unpatched btrfs-convert would fail half way due to corrupted free space -# cache tree -convert_test_do_convert + convert_test_prep_fs ext4 mke2fs -t ext4 -b 4096 + run_check_umount_test_dev + + # Unpatched btrfs-convert would fail half way due to corrupted + # free space cache tree + convert_test_do_convert + + run_check_mount_test_dev + run_check_umount_test_dev +done
This test case will test whether btrfs-convert can handle ext4 filesystems that are largerthan or equal to 16TiB. At 16TiB block numbers overflow 32 bits, btrfs-convert either fails or corrupts fs if 64 bit block numbers are not supported. Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com> --- .../018-fs-size-overflow/test.sh | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-)