Message ID | 20230213054724.35714-1-wqu@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs-progs: tests: misc: fix failure on misc/034 | expand |
On Mon, Feb 13, 2023 at 01:47:24PM +0800, Qu Wenruo wrote: > [BUG] > Test case misc/034 can fail like this: > > ====== RUN CHECK mount /dev/loop16 /home/adam/btrfs-progs/tests/mnt > mount: /home/adam/btrfs-progs/tests/mnt: wrong fs type, bad option, bad superblock on /dev/loop16, missing codepage or helper program, or other error. > dmesg(1) may have more information after failed mount system call. > failed: mount /dev/loop16 /home/adam/btrfs-progs/tests/mnt > > And the dmesg looks like this: > > loop16: detected capacity change from 0 to 1024000 > loop17: detected capacity change from 0 to 1024000 > BTRFS: device fsid 593e23af-a7e6-4360-b16a-229f415de697 devid 1 transid 6 /dev/loop16 scanned by mount (79348) > BTRFS info (device loop16): using crc32c (crc32c-intel) checksum algorithm > BTRFS info (device loop16): found metadata UUID change in progress flag, clearing > BTRFS info (device loop16): disk space caching is enabled > BTRFS error (device loop16): devid 2 uuid cde07de6-db7e-4b34-909e-d3db6e7c0b06 is missing > BTRFS error (device loop16): failed to read the system array: -2 > BTRFS error (device loop16): open_ctree failed > > [CAUSE] > >From the dmesg, it shows that although both loopback devices are > properly registered, only one is properly scanned by mount. > > Thus the other device is missing, and without "-o degraded" the > filesystem failed to be mounted. > > [FIX] > Before we mount the filesystem, also scan them in their passed in order > to properly assemble the device list for mount. > > Signed-off-by: Qu Wenruo <wqu@suse.com> Added to devel, thanks.
diff --git a/tests/misc-tests/034-metadata-uuid/test.sh b/tests/misc-tests/034-metadata-uuid/test.sh index b7cb546b..b62cdc10 100755 --- a/tests/misc-tests/034-metadata-uuid/test.sh +++ b/tests/misc-tests/034-metadata-uuid/test.sh @@ -191,6 +191,10 @@ failure_recovery() { run_check $SUDO_HELPER udevadm settle + # Scan to make sure btrfs detects both devices before trying to mount + run_check $SUDO_HELPER "$TOP/btrfs" device scan $loop1 + run_check $SUDO_HELPER "$TOP/btrfs" device scan $loop2 + # Mount and unmount, on trans commit all disks should be consistent run_check $SUDO_HELPER mount "$loop1" "$TEST_MNT" run_check $SUDO_HELPER umount "$TEST_MNT"
[BUG] Test case misc/034 can fail like this: ====== RUN CHECK mount /dev/loop16 /home/adam/btrfs-progs/tests/mnt mount: /home/adam/btrfs-progs/tests/mnt: wrong fs type, bad option, bad superblock on /dev/loop16, missing codepage or helper program, or other error. dmesg(1) may have more information after failed mount system call. failed: mount /dev/loop16 /home/adam/btrfs-progs/tests/mnt And the dmesg looks like this: loop16: detected capacity change from 0 to 1024000 loop17: detected capacity change from 0 to 1024000 BTRFS: device fsid 593e23af-a7e6-4360-b16a-229f415de697 devid 1 transid 6 /dev/loop16 scanned by mount (79348) BTRFS info (device loop16): using crc32c (crc32c-intel) checksum algorithm BTRFS info (device loop16): found metadata UUID change in progress flag, clearing BTRFS info (device loop16): disk space caching is enabled BTRFS error (device loop16): devid 2 uuid cde07de6-db7e-4b34-909e-d3db6e7c0b06 is missing BTRFS error (device loop16): failed to read the system array: -2 BTRFS error (device loop16): open_ctree failed [CAUSE] From the dmesg, it shows that although both loopback devices are properly registered, only one is properly scanned by mount. Thus the other device is missing, and without "-o degraded" the filesystem failed to be mounted. [FIX] Before we mount the filesystem, also scan them in their passed in order to properly assemble the device list for mount. Signed-off-by: Qu Wenruo <wqu@suse.com> --- tests/misc-tests/034-metadata-uuid/test.sh | 4 ++++ 1 file changed, 4 insertions(+)