]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: hold snap_lock while reading parent info in diff_iterate
authorJosh Durgin <jdurgin@redhat.com>
Tue, 24 Feb 2015 22:43:10 +0000 (14:43 -0800)
committerJosh Durgin <jdurgin@redhat.com>
Thu, 26 Feb 2015 01:27:34 +0000 (17:27 -0800)
Caught be the re-added assertions in ImageCtx::get_parent_info()

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
src/librbd/internal.cc

index 95ea2926627d7c8738fba4b9a16bdd894cfb2796..3731e72282f99fe9b7939ed57f337d579c83305f 100644 (file)
@@ -2824,7 +2824,8 @@ reprotect_and_return_err:
     // check parent overlap only if we are comparing to the beginning of time
     interval_set<uint64_t> parent_diff;
     if (from_snap_id == 0) {
-      ictx->parent_lock.get_read();
+      RWLock::RLocker l(ictx->snap_lock);
+      RWLock::RLocker l2(ictx->parent_lock);
       uint64_t overlap = end_size;
       ictx->get_parent_overlap(from_snap_id, &overlap);
       r = 0;
@@ -2832,7 +2833,6 @@ reprotect_and_return_err:
        ldout(ictx->cct, 10) << " first getting parent diff" << dendl;
        r = diff_iterate(ictx->parent, NULL, 0, overlap, simple_diff_cb, &parent_diff);
       }
-      ictx->parent_lock.put_read();
       if (r < 0)
        return r;
     }