From 04d360a4c1e7b29bafe4aa4a9e91e98360932d31 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Mon, 23 Feb 2015 19:50:55 -0800 Subject: [PATCH] librbd: take ImageCtx->snap_lock for write in add_snap() add_snap() updates the ImageCtx snapshot metadata in memory, as well as reading the flags as part of the object map snapshot. Both of these require holding snap_lock. Signed-off-by: Josh Durgin --- src/librbd/internal.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 6db4eba4985..d3ee11696a5 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -1783,6 +1783,7 @@ reprotect_and_return_err: return r; } + RWLock::WLocker l(ictx->snap_lock); if (!ictx->old_format) { if (ictx->object_map != NULL) { ictx->object_map->snapshot(snap_id);