On 3.07.2018 12:07, Anand Jain wrote: > > > On 07/03/2018 01:56 PM, Nikolay Borisov wrote: >> >> >> On 3.07.2018 08:12, Anand Jain wrote: >>> When a device is deleted, the btrfs_super_block::number_devices is >>> reduced by 1, but we do that after the commit transaction, so this >>> change did not made it to the disk and waits for the next commit >>> transaction whenever it happens. >>> >>> This can be easily demonstrated using the following test case where I >>> use the btrfs device ready cli to read the disk and report. >>> >>> mkfs.btrfs -fq -dsingle -msingle $dev1 $dev2 >>> mount $dev1 /btrfs >>> btrfs dev del $dev2 /btrfs >>> btrfs dev ready $dev1; echo RESULT=$? <-- 1 >>> Without this patch RESULT returns 1, indicating not ready! >>> >>> Testing with a seed device: >>> >>> mkfs.btrfs -fq $dev1 >>> btrfstune -S1 $dev1 >>> mount $dev1 /btrfs >>> btrfs dev add -f $dev2 /btrfs >>> umount /btrfs >>> mount $dev2 /btrfs >>> btrfs dev del $dev1 /btrfs >>> btrfs dev ready $dev2; echo RESULT=$? <-- 1 >> >> Turn those into fully fledged xfstests > > Thanks for the review. Though that popped-up in my mind I > didn't do it as because its one off bug test. Anyway as you > think its a good idea I sent one in the ML. IMO every bug which can be tested should be tested for. This enables having a wide range of regressions tests and future changes passing those regressions test will bear higher confidence of correctness. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
