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 <jdurgin@redhat.com>
This commit is contained in:
Josh Durgin 2015-02-23 19:50:55 -08:00
parent 40c2abb08a
commit 04d360a4c1

View 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);