On Fri, Mar 08, 2013 at 10:23:01PM -0700, Eric Sandeen wrote:
> Doing this would reliably fail with -EBUSY for me:
> 
> # mount /dev/sdb2 /mnt/scratch; umount /mnt/scratch; mkfs.btrfs -f /dev/sdb2
> ...
> unable to open /dev/sdb2: Device or resource busy
> 
> because mkfs.btrfs tries to open the device O_EXCL, and somebody still has it.
> 
> Using systemtap to track bdev gets & puts shows a kworker thread doing a
> blkdev put after mkfs attempts a get; this is left over from the unmount.
> 
> Adding an rcu_barrier() to btrfs_close_devices() causes unmount to wait
> until all blkdev_put()s are done, and the device is truly free once
> unmount completes.

Thanks for tracking this down Eric.  Is this kworker triggered by btrfs
or is this something we should be doing for the other filesystems too?

I'd move it down to close_ctree, but I don't really have a good reason.

-chris
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to