From: Josh Durgin Date: Tue, 24 Feb 2015 22:43:10 +0000 (-0800) Subject: librbd: hold snap_lock while reading parent info in diff_iterate X-Git-Tag: v0.93~6^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7fed0a366d5b81c2ab4af1f56eb5b278c8e297ff;p=ceph.git librbd: hold snap_lock while reading parent info in diff_iterate Caught be the re-added assertions in ImageCtx::get_parent_info() Signed-off-by: Josh Durgin --- diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 95ea2926627d..3731e72282f9 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -2824,7 +2824,8 @@ reprotect_and_return_err: // check parent overlap only if we are comparing to the beginning of time interval_set 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; }