All of lore.kernel.org
 help / color / mirror / Atom feed
* can "rbd unmap" detect if device is mounted?
@ 2012-07-16 19:59 Travis Rhoden
  2012-07-16 22:43 ` Josh Durgin
  0 siblings, 1 reply; 6+ messages in thread
From: Travis Rhoden @ 2012-07-16 19:59 UTC (permalink / raw)
  To: ceph-devel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-07-17  3:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-16 19:59 can "rbd unmap" detect if device is mounted? Travis Rhoden
2012-07-16 22:43 ` Josh Durgin
2012-07-16 23:00   ` Travis Rhoden
2012-07-16 23:37   ` Tommi Virtanen
2012-07-17  0:43     ` Josh Durgin
2012-07-17  3:34     ` Travis Rhoden

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.