rbd: define rbd_dev_unprobe()
authorAlex Elder <elder@inktank.com>
Mon, 29 Apr 2013 04:32:34 +0000 (23:32 -0500)
committerSage Weil <sage@inktank.com>
Thu, 2 May 2013 04:20:04 +0000 (21:20 -0700)
commit6fd48b3be9f6d195a970b92040d097b5b886a99b
treeb298c92859155d17366b03a546c5b1bdfc4299c3
parent200a6a8be5dba96df121f3d2363964dd77ee7e1b
rbd: define rbd_dev_unprobe()

Define a new function rbd_dev_unprobe() which undoes state changes
that occur from calling rbd_dev_v1_probe() or rbd_dev_v2_probe().
Note that this is a superset of rbd_header_free(), which is now
getting removed (it seems to have been used improperly anyway).

Flesh out rbd_dev_image_release() so it undoes exactly what
rbd_dev_image_probe() does.

This means that:
    - rbd_dev_device_release() gets called when the last device
      reference gets dropped;
    - that undoes everything done by the rbd_dev_device_setup() call
      at the end of rbd_dev_image_probe() (and nothing more), ending
      by calling rbd_dev_image_release(); and
    - rbd_dev_image_release() undoes everything else done by
      rbd_dev_image_probe() (and this includes a call to
      rbd_dev_unprobe().

This means the image and device portions of an rbd device are fairly
cleanly separated now, so error paths should be a little easier to
verify than they used to be.

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
drivers/block/rbd.c