linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mkfs.btrfs reports Device or resource busy for unmounted device
@ 2019-01-31 17:36 Karollil, Anoop (GE Digital)
  0 siblings, 0 replies; only message in thread
From: Karollil, Anoop (GE Digital) @ 2019-01-31 17:36 UTC (permalink / raw)
  To: linux-btrfs

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-31 18:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-31 17:36 mkfs.btrfs reports Device or resource busy for unmounted device Karollil, Anoop (GE Digital)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).