]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: take ImageCtx->snap_lock for write in add_snap()
authorJosh Durgin <jdurgin@redhat.com>
Tue, 24 Feb 2015 03:50:55 +0000 (19:50 -0800)
committerJosh Durgin <jdurgin@redhat.com>
Wed, 25 Feb 2015 23:42:32 +0000 (15:42 -0800)
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 <jdurgin@redhat.com>
src/librbd/internal.cc

index 6db4eba49852f856fa5cce9b9b7f2f429ed379d7..d3ee11696a51df2606f8ebb7a60b9c933e460095 100644 (file)
@@ -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);