Hi folks,

I've made this mistake a couple of times now (completely my fault,
when will I learn?), and am wondering if a bit of protection can be
put in place against user errors.

I mapped a device "rbd map", then formatted and and mounted the device
("mkfs.extf /dev/rbd0..., mount /dev/rbd0...").  Then sometime later,
I want to remove the RBD device.  Stupidly, I do the "rbd unmap"
command before I unmount the device.  The kernel doesn't really care
for this.  Or more accurately, I can't remap that same RBD because I
run into:

kernel: [2248653.941688] sysfs: cannot create duplicate filename
'/devices/virtual/block/rbd0'
....
kernel: [2248653.941833] kobject_add_internal failed for rbd0 with
-EEXIST, don't try to register things with the same name in the same
directory.

At this point, the "rbd map" command hangs indefinitely (producing the
logs from above).  Ctrl-C does exit out, though.  But if I try to fix
my mistake by doing the unmount now, I get the error:

umount: device is busy.

So really I get stuck.  I can't unmount without the device, and I
can't remap the device to the old block device.  I have to reboot to
clean up and move on.

I imagine other bad things can happen with the block device goes away
out from under the mount point.  Any way the "rbd unmap" command can
detect when the device is in use or mounted and inform the user?

Thanks,

 - Travis
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" 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