rbd: drop dev reference on error in rbd_open()
authorAlex Elder <elder@inktank.com>
Fri, 10 Aug 2012 20:12:07 +0000 (13:12 -0700)
committerSage Weil <sage@inktank.com>
Sat, 22 Sep 2012 03:48:54 +0000 (20:48 -0700)
commit340c7a2b2c9a2da640af28a8c196356484ac8b50
tree4bd52ff7fc913c1b9bcb35e13c4df3edbb8067df
parent5698bd757d55b1bb87edd1a9744ab09c142abfc2
rbd: drop dev reference on error in rbd_open()

If a read-only rbd device is opened for writing in rbd_open(), it
returns without dropping the just-acquired device reference.

Fix this by moving the read-only check before getting the reference.

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