Hello, I faced an issue with mkfs.btrfs reporting “Device or resource busy” for an unmounted device. Maybe the umount should have failed as a process listed the btrfs filesystem in its /proc/PID/mountinfo after the umount. A subsequent mkfs.btrfs did fail when it tried to open the device with O_EXCL. I think I am seeing the same thing by doing the following on Ubuntu 18.04.1 x86_64 with btrfs-progs v4.15.1-1build1 and kernel v4.15.0-43-generic:
Initial setup based on https://btrfs.wiki.kernel.org/index.php/Debugging_Btrfs_with_GDB: dd if=/dev/zero of=btrfs.img bs=4k count=100000 mkfs.btrfs btrfs.img losetup /dev/loop1 btrfs.img mkdir /mnt/test mount -t btrfs /dev/loop1 /mnt/test Then run the following in one terminal: sudo sh -c "while true; do mount -t btrfs /dev/loop1 /mnt/test; echo "foobar" > /mnt/test/foobar; umount /mnt/test; sleep 1; done" And run the following in another terminal: while true; do sudo mkfs.btrfs -f /dev/loop1;sleep 1;done You should see the mkfs.btrfs fail occasionally with “ERROR: unable to open /dev/loop1: Device or resource busy”. Something similar seems to have been fixed by this patch: https://patchwork.kernel.org/patch/2241081/ but I couldn’t reproduce this problem with the steps mentioned there. Thanks, Anoop Unsubscribe from GE's commercial electronic messages: http://sc.ge.com/*casl-unsubscribe Désabonner des messages électroniques commerciaux de GE: http://sc.ge.com/*lcap-desabonnement