Move the calls to get the header semaphore out of
rbd_header_set_snap() and into its caller.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
{
int ret;
- down_write(&rbd_dev->header_rwsem);
-
if (!memcmp(snap_name, RBD_SNAP_HEAD_NAME,
sizeof (RBD_SNAP_HEAD_NAME))) {
rbd_dev->mapping.snap_id = CEPH_NOSNAP;
ret = 0;
done:
- up_write(&rbd_dev->header_rwsem);
return ret;
}
if (rc)
goto err_out_bus;
+ down_write(&rbd_dev->header_rwsem);
rc = rbd_header_set_snap(rbd_dev, snap_name);
+ up_write(&rbd_dev->header_rwsem);
if (rc)
goto err_out_bus;