]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commit
rbd: do not allow remove of mounted-on image
authorAlex Elder <elder@inktank.com>
Fri, 16 Nov 2012 15:29:16 +0000 (09:29 -0600)
committerAlex Elder <elder@inktank.com>
Wed, 28 Nov 2012 16:07:07 +0000 (10:07 -0600)
commitd5705202cfcecd766292c97f4f5735b3bef68f5f
tree34aebdb5c22e24b04f4fdc197aea3a35f0fdb050
parentea8ce771ad65c18aaba626a88ba792c81e8b9356
rbd: do not allow remove of mounted-on image

There is no check in rbd_remove() to see if anybody holds open the
image being removed.  That's not cool.

Add a simple open count that goes up and down with opens and closes
(releases) of the device, and don't allow an rbd image to be removed
if the count is non-zero.

Protect the updates of the open count value with ctl_mutex to ensure
the underlying rbd device doesn't get removed while concurrently
being opened.

Signed-off-by: Alex Elder <elder@inktank.com>
drivers/block/rbd.c