On Wed, Jul 31, 2024 at 01:41:24PM +0100, fdmanana@xxxxxxxxxx wrote: > From: Filipe Manana <fdmanana@xxxxxxxx> > > The test deletes the subvolume and then immediately calls the logical > resolve ioctl to confirm the extent is not referenced by the subvolume > anymore. This however may often fail because the subvolume delete only > makes the subvolume not accessible to user space anymore, but the actual > deletion of the subvolume tree, and all its data references, happens in > the background in the cleaner kthread running in kernel space. > > So if by the time we do the query the cleaner kthread has not yet deleted > the subvolume tree, the test fails like this: > > $ ./check btrfs/287 > FSTYP -- btrfs > PLATFORM -- Linux/x86_64 debian0 5.14.0-btrfs-next-22 #1 SMP Tue Jul 30 16:31:55 WEST 2024 > MKFS_OPTIONS -- /dev/sdc > MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1 > > btrfs/287 0s ... - output mismatch (see /home/fdmanana/git/hub/xfstests/results//btrfs/287.out.bad) > --- tests/btrfs/287.out 2024-07-30 17:40:49.037599612 +0100 > +++ /home/fdmanana/git/hub/xfstests/results//btrfs/287.out.bad 2024-07-31 13:06:28.275728352 +0100 > @@ -82,12 +82,18 @@ > inode 257 offset 20971520 snap2 > inode 257 offset 12582912 snap2 > inode 257 offset 4194304 snap2 > +inode 257 offset 20971520 snap1 > +inode 257 offset 12582912 snap1 > +inode 257 offset 4194304 snap1 > inode 257 offset 20971520 root 5 > ... > (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/btrfs/287.out /home/fdmanana/git/hub/xfstests/results//btrfs/287.out.bad' to see the entire diff) > > HINT: You _MAY_ be missing kernel fix: > 0cad8f14d70c btrfs: fix backref walking not returning all inode refs > > Fix this by using the "subvolume sync" command to wait for the subvolume > to be deleted by the cleaner kthread before doing logical resolve queries. > > Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx> Reviewed-by: David Sterba <dsterba@xxxxxxxx>