From 7fed0a366d5b81c2ab4af1f56eb5b278c8e297ff Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Tue, 24 Feb 2015 14:43:10 -0800 Subject: [PATCH] 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 --- src/librbd/internal.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 95ea2926627d7..3731e72282f99 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; } -- 2.39.5