Linux-BTRFS Archive on lore.kernel.org
 help / color / 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, back to index

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)

Linux-BTRFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \
		linux-btrfs@vger.kernel.org linux-btrfs@archiver.kernel.org
	public-inbox-index linux-btrfs


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs


AGPL code for this site: git clone https://public-inbox.org/ public-inbox