aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/rbd.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 634a16c40291..214c937a6de5 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -647,8 +647,6 @@ static int rbd_header_set_snap(struct rbd_device *rbd_dev, char *snap_name)
647{ 647{
648 int ret; 648 int ret;
649 649
650 down_write(&rbd_dev->header_rwsem);
651
652 if (!memcmp(snap_name, RBD_SNAP_HEAD_NAME, 650 if (!memcmp(snap_name, RBD_SNAP_HEAD_NAME,
653 sizeof (RBD_SNAP_HEAD_NAME))) { 651 sizeof (RBD_SNAP_HEAD_NAME))) {
654 rbd_dev->mapping.snap_id = CEPH_NOSNAP; 652 rbd_dev->mapping.snap_id = CEPH_NOSNAP;
@@ -666,7 +664,6 @@ static int rbd_header_set_snap(struct rbd_device *rbd_dev, char *snap_name)
666 664
667 ret = 0; 665 ret = 0;
668done: 666done:
669 up_write(&rbd_dev->header_rwsem);
670 return ret; 667 return ret;
671} 668}
672 669
@@ -2608,7 +2605,9 @@ static ssize_t rbd_add(struct bus_type *bus,
2608 if (rc) 2605 if (rc)
2609 goto err_out_bus; 2606 goto err_out_bus;
2610 2607
2608 down_write(&rbd_dev->header_rwsem);
2611 rc = rbd_header_set_snap(rbd_dev, snap_name); 2609 rc = rbd_header_set_snap(rbd_dev, snap_name);
2610 up_write(&rbd_dev->header_rwsem);
2612 if (rc) 2611 if (rc)
2613 goto err_out_bus; 2612 goto err_out_bus;
2614 2613