]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
librbd: renamed 'ImageCtx::snap_lock' to 'image_lock'
authorJason Dillaman <dillaman@redhat.com>
Fri, 19 Apr 2019 20:52:23 +0000 (16:52 -0400)
committerJason Dillaman <dillaman@redhat.com>
Sun, 28 Apr 2019 13:15:14 +0000 (09:15 -0400)
This is the first step in consolidating multiple locks under a single
reader/writer lock for simplicity.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
94 files changed:
src/librbd/DeepCopyRequest.cc
src/librbd/ImageCtx.cc
src/librbd/ImageCtx.h
src/librbd/ImageWatcher.cc
src/librbd/Journal.cc
src/librbd/ObjectMap.cc
src/librbd/Operations.cc
src/librbd/api/DiffIterate.cc
src/librbd/api/Group.cc
src/librbd/api/Image.cc
src/librbd/api/Migration.cc
src/librbd/api/Mirror.cc
src/librbd/api/Snapshot.cc
src/librbd/api/Trash.cc
src/librbd/cache/ObjectCacherObjectDispatch.cc
src/librbd/cache/ObjectCacherWriteback.cc
src/librbd/deep_copy/ImageCopyRequest.cc
src/librbd/deep_copy/ObjectCopyRequest.cc
src/librbd/deep_copy/SetHeadRequest.cc
src/librbd/deep_copy/SnapshotCopyRequest.cc
src/librbd/deep_copy/SnapshotCreateRequest.cc
src/librbd/exclusive_lock/PostAcquireRequest.cc
src/librbd/exclusive_lock/PreReleaseRequest.cc
src/librbd/image/AttachChildRequest.cc
src/librbd/image/CloneRequest.cc
src/librbd/image/CloseRequest.cc
src/librbd/image/DetachChildRequest.cc
src/librbd/image/OpenRequest.cc
src/librbd/image/PreRemoveRequest.cc
src/librbd/image/RefreshParentRequest.cc
src/librbd/image/RefreshRequest.cc
src/librbd/image/SetFlagsRequest.cc
src/librbd/image/SetSnapRequest.cc
src/librbd/internal.cc
src/librbd/io/CopyupRequest.cc
src/librbd/io/ImageRequest.cc
src/librbd/io/ImageRequestWQ.cc
src/librbd/io/ObjectRequest.cc
src/librbd/journal/Replay.cc
src/librbd/object_map/CreateRequest.cc
src/librbd/object_map/InvalidateRequest.cc
src/librbd/object_map/RefreshRequest.cc
src/librbd/object_map/RemoveRequest.cc
src/librbd/object_map/Request.cc
src/librbd/object_map/SnapshotCreateRequest.cc
src/librbd/object_map/SnapshotRemoveRequest.cc
src/librbd/object_map/SnapshotRollbackRequest.cc
src/librbd/object_map/UpdateRequest.cc
src/librbd/operation/DisableFeaturesRequest.h
src/librbd/operation/FlattenRequest.cc
src/librbd/operation/MigrateRequest.cc
src/librbd/operation/ObjectMapIterate.cc
src/librbd/operation/RebuildObjectMapRequest.cc
src/librbd/operation/RenameRequest.cc
src/librbd/operation/Request.cc
src/librbd/operation/Request.h
src/librbd/operation/ResizeRequest.cc
src/librbd/operation/SnapshotCreateRequest.cc
src/librbd/operation/SnapshotLimitRequest.cc
src/librbd/operation/SnapshotProtectRequest.cc
src/librbd/operation/SnapshotRemoveRequest.cc
src/librbd/operation/SnapshotRenameRequest.cc
src/librbd/operation/SnapshotRollbackRequest.cc
src/librbd/operation/SnapshotUnprotectRequest.cc
src/librbd/operation/SparsifyRequest.cc
src/librbd/operation/TrimRequest.cc
src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc
src/test/librbd/exclusive_lock/test_mock_PostAcquireRequest.cc
src/test/librbd/io/test_mock_CopyupRequest.cc
src/test/librbd/journal/test_Replay.cc
src/test/librbd/mock/MockImageCtx.h
src/test/librbd/object_map/test_mock_InvalidateRequest.cc
src/test/librbd/object_map/test_mock_SnapshotCreateRequest.cc
src/test/librbd/object_map/test_mock_SnapshotRemoveRequest.cc
src/test/librbd/object_map/test_mock_SnapshotRollbackRequest.cc
src/test/librbd/object_map/test_mock_UpdateRequest.cc
src/test/librbd/test_DeepCopy.cc
src/test/librbd/test_Migration.cc
src/test/librbd/test_ObjectMap.cc
src/test/librbd/test_internal.cc
src/test/librbd/test_mock_Journal.cc
src/test/librbd/test_mock_ObjectMap.cc
src/test/rbd_mirror/image_deleter/test_mock_SnapshotPurgeRequest.cc
src/test/rbd_mirror/test_ImageDeleter.cc
src/test/rbd_mirror/test_ImageSync.cc
src/tools/rbd_mirror/ImageReplayer.cc
src/tools/rbd_mirror/ImageSync.cc
src/tools/rbd_mirror/image_deleter/SnapshotPurgeRequest.cc
src/tools/rbd_mirror/image_deleter/TrashMoveRequest.cc
src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc
src/tools/rbd_mirror/image_replayer/CreateImageRequest.cc
src/tools/rbd_mirror/image_replayer/EventPreprocessor.cc
src/tools/rbd_mirror/image_replayer/OpenLocalImageRequest.cc
src/tools/rbd_mirror/image_sync/SyncPointPruneRequest.cc

index 45191158e38c4e50f218ad32b3b0d141a5914285..4939bcaac995fbd2a318b66980d3f5cba715d494 100644 (file)
@@ -180,17 +180,17 @@ void DeepCopyRequest<I>::handle_copy_image(int r) {
 template <typename I>
 void DeepCopyRequest<I>::send_copy_object_map() {
   m_dst_image_ctx->owner_lock.get_read();
-  m_dst_image_ctx->snap_lock.get_read();
+  m_dst_image_ctx->image_lock.get_read();
 
   if (!m_dst_image_ctx->test_features(RBD_FEATURE_OBJECT_MAP,
-                                      m_dst_image_ctx->snap_lock)) {
-    m_dst_image_ctx->snap_lock.put_read();
+                                      m_dst_image_ctx->image_lock)) {
+    m_dst_image_ctx->image_lock.put_read();
     m_dst_image_ctx->owner_lock.put_read();
     send_copy_metadata();
     return;
   }
   if (m_snap_id_end == CEPH_NOSNAP) {
-    m_dst_image_ctx->snap_lock.put_read();
+    m_dst_image_ctx->image_lock.put_read();
     m_dst_image_ctx->owner_lock.put_read();
     send_refresh_object_map();
     return;
@@ -207,7 +207,7 @@ void DeepCopyRequest<I>::send_copy_object_map() {
   }
   if (finish_op_ctx == nullptr) {
     lderr(m_cct) << "lost exclusive lock" << dendl;
-    m_dst_image_ctx->snap_lock.put_read();
+    m_dst_image_ctx->image_lock.put_read();
     m_dst_image_ctx->owner_lock.put_read();
     finish(r);
     return;
@@ -222,7 +222,7 @@ void DeepCopyRequest<I>::send_copy_object_map() {
   ceph_assert(m_snap_seqs->count(m_snap_id_end) > 0);
   librados::snap_t copy_snap_id = (*m_snap_seqs)[m_snap_id_end];
   m_dst_image_ctx->object_map->rollback(copy_snap_id, ctx);
-  m_dst_image_ctx->snap_lock.put_read();
+  m_dst_image_ctx->image_lock.put_read();
   m_dst_image_ctx->owner_lock.put_read();
 }
 
@@ -280,7 +280,7 @@ void DeepCopyRequest<I>::handle_refresh_object_map(int r) {
   }
 
   {
-    RWLock::WLocker snap_locker(m_dst_image_ctx->snap_lock);
+    RWLock::WLocker image_locker(m_dst_image_ctx->image_lock);
     RWLock::WLocker object_map_locker(m_dst_image_ctx->object_map_lock);
     std::swap(m_dst_image_ctx->object_map, m_object_map);
   }
@@ -315,7 +315,7 @@ void DeepCopyRequest<I>::handle_copy_metadata(int r) {
 
 template <typename I>
 int DeepCopyRequest<I>::validate_copy_points() {
-  RWLock::RLocker snap_locker(m_src_image_ctx->snap_lock);
+  RWLock::RLocker image_locker(m_src_image_ctx->image_lock);
 
   if (m_snap_id_start != 0 &&
       m_src_image_ctx->snap_info.find(m_snap_id_start) ==
index fad88ac8591e35fd41a336f33fc771ac4553bab5..45a7c1e7633af84beef717e5e8abd6b372199e35 100644 (file)
@@ -107,10 +107,10 @@ public:
       journal(NULL),
       owner_lock(util::unique_lock_name("librbd::ImageCtx::owner_lock", this)),
       md_lock(util::unique_lock_name("librbd::ImageCtx::md_lock", this)),
-      snap_lock(util::unique_lock_name("librbd::ImageCtx::snap_lock", this)),
-      timestamp_lock(util::unique_lock_name("librbd::ImageCtx::timestamp_lock", this)),
+      image_lock(util::unique_lock_name("librbd::ImageCtx::image_lock", this)),
       parent_lock(util::unique_lock_name("librbd::ImageCtx::parent_lock", this)),
       object_map_lock(util::unique_lock_name("librbd::ImageCtx::object_map_lock", this)),
+      timestamp_lock(util::unique_lock_name("librbd::ImageCtx::timestamp_lock", this)),
       async_ops_lock(util::unique_lock_name("librbd::ImageCtx::async_ops_lock", this)),
       copyup_list_lock(util::unique_lock_name("librbd::ImageCtx::copyup_list_lock", this)),
       completed_reqs_lock(util::unique_lock_name("librbd::ImageCtx::completed_reqs_lock", this)),
@@ -321,7 +321,7 @@ public:
   }
 
   int ImageCtx::snap_set(uint64_t in_snap_id) {
-    ceph_assert(snap_lock.is_wlocked());
+    ceph_assert(image_lock.is_wlocked());
     auto it = snap_info.find(in_snap_id);
     if (in_snap_id != CEPH_NOSNAP && it != snap_info.end()) {
       snap_id = in_snap_id;
@@ -336,7 +336,7 @@ public:
 
   void ImageCtx::snap_unset()
   {
-    ceph_assert(snap_lock.is_wlocked());
+    ceph_assert(image_lock.is_wlocked());
     snap_id = CEPH_NOSNAP;
     snap_namespace = {};
     snap_name = "";
@@ -347,7 +347,7 @@ public:
   snap_t ImageCtx::get_snap_id(const cls::rbd::SnapshotNamespace& in_snap_namespace,
                                const string& in_snap_name) const
   {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     auto it = snap_ids.find({in_snap_namespace, in_snap_name});
     if (it != snap_ids.end()) {
       return it->second;
@@ -357,7 +357,7 @@ public:
 
   const SnapInfo* ImageCtx::get_snap_info(snap_t in_snap_id) const
   {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     map<snap_t, SnapInfo>::const_iterator it =
       snap_info.find(in_snap_id);
     if (it != snap_info.end())
@@ -368,7 +368,7 @@ public:
   int ImageCtx::get_snap_name(snap_t in_snap_id,
                              string *out_snap_name) const
   {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     const SnapInfo *info = get_snap_info(in_snap_id);
     if (info) {
       *out_snap_name = info->name;
@@ -380,7 +380,7 @@ public:
   int ImageCtx::get_snap_namespace(snap_t in_snap_id,
                                   cls::rbd::SnapshotNamespace *out_snap_namespace) const
   {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     const SnapInfo *info = get_snap_info(in_snap_id);
     if (info) {
       *out_snap_namespace = info->snap_namespace;
@@ -402,7 +402,7 @@ public:
 
   uint64_t ImageCtx::get_current_size() const
   {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     return size;
   }
 
@@ -462,7 +462,7 @@ public:
   int ImageCtx::is_snap_protected(snap_t in_snap_id,
                                  bool *is_protected) const
   {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     const SnapInfo *info = get_snap_info(in_snap_id);
     if (info) {
       *is_protected =
@@ -475,7 +475,7 @@ public:
   int ImageCtx::is_snap_unprotected(snap_t in_snap_id,
                                    bool *is_unprotected) const
   {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     const SnapInfo *info = get_snap_info(in_snap_id);
     if (info) {
       *is_unprotected =
@@ -492,7 +492,7 @@ public:
                           uint8_t protection_status, uint64_t flags,
                           utime_t timestamp)
   {
-    ceph_assert(snap_lock.is_wlocked());
+    ceph_assert(image_lock.is_wlocked());
     snaps.push_back(id);
     SnapInfo info(in_snap_name, in_snap_namespace,
                  in_size, parent, protection_status, flags, timestamp);
@@ -504,7 +504,7 @@ public:
                         string in_snap_name,
                         snap_t id)
   {
-    ceph_assert(snap_lock.is_wlocked());
+    ceph_assert(image_lock.is_wlocked());
     snaps.erase(std::remove(snaps.begin(), snaps.end(), id), snaps.end());
     snap_info.erase(id);
     snap_ids.erase({in_snap_namespace, in_snap_name});
@@ -512,7 +512,7 @@ public:
 
   uint64_t ImageCtx::get_image_size(snap_t in_snap_id) const
   {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     if (in_snap_id == CEPH_NOSNAP) {
       if (!resize_reqs.empty() &&
           resize_reqs.front()->shrinking()) {
@@ -529,40 +529,40 @@ public:
   }
 
   uint64_t ImageCtx::get_object_count(snap_t in_snap_id) const {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     uint64_t image_size = get_image_size(in_snap_id);
     return Striper::get_num_objects(layout, image_size);
   }
 
   bool ImageCtx::test_features(uint64_t features) const
   {
-    RWLock::RLocker l(snap_lock);
-    return test_features(features, snap_lock);
+    RWLock::RLocker l(image_lock);
+    return test_features(features, image_lock);
   }
 
   bool ImageCtx::test_features(uint64_t in_features,
-                               const RWLock &in_snap_lock) const
+                               const RWLock &in_image_lock) const
   {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     return ((features & in_features) == in_features);
   }
 
   bool ImageCtx::test_op_features(uint64_t in_op_features) const
   {
-    RWLock::RLocker snap_locker(snap_lock);
-    return test_op_features(in_op_features, snap_lock);
+    RWLock::RLocker image_locker(image_lock);
+    return test_op_features(in_op_features, image_lock);
   }
 
   bool ImageCtx::test_op_features(uint64_t in_op_features,
-                                  const RWLock &in_snap_lock) const
+                                  const RWLock &in_image_lock) const
   {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     return ((op_features & in_op_features) == in_op_features);
   }
 
   int ImageCtx::get_flags(librados::snap_t _snap_id, uint64_t *_flags) const
   {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     if (_snap_id == CEPH_NOSNAP) {
       *_flags = flags;
       return 0;
@@ -578,15 +578,15 @@ public:
   int ImageCtx::test_flags(librados::snap_t in_snap_id,
                            uint64_t flags, bool *flags_set) const
   {
-    RWLock::RLocker l(snap_lock);
-    return test_flags(in_snap_id, flags, snap_lock, flags_set);
+    RWLock::RLocker l(image_lock);
+    return test_flags(in_snap_id, flags, image_lock, flags_set);
   }
 
   int ImageCtx::test_flags(librados::snap_t in_snap_id,
-                           uint64_t flags, const RWLock &in_snap_lock,
+                           uint64_t flags, const RWLock &in_image_lock,
                            bool *flags_set) const
   {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     uint64_t snap_flags;
     int r = get_flags(in_snap_id, &snap_flags);
     if (r < 0) {
@@ -598,7 +598,7 @@ public:
 
   int ImageCtx::update_flags(snap_t in_snap_id, uint64_t flag, bool enabled)
   {
-    ceph_assert(snap_lock.is_wlocked());
+    ceph_assert(image_lock.is_wlocked());
     uint64_t *_flags;
     if (in_snap_id == CEPH_NOSNAP) {
       _flags = &flags;
@@ -620,7 +620,7 @@ public:
 
   const ParentImageInfo* ImageCtx::get_parent_info(snap_t in_snap_id) const
   {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     ceph_assert(parent_lock.is_locked());
     if (in_snap_id == CEPH_NOSNAP)
       return &parent_md;
@@ -656,7 +656,7 @@ public:
 
   int ImageCtx::get_parent_overlap(snap_t in_snap_id, uint64_t *overlap) const
   {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     const auto info = get_parent_info(in_snap_id);
     if (info) {
       *overlap = info->overlap;
@@ -855,7 +855,7 @@ public:
   void ImageCtx::set_image_name(const std::string &image_name) {
     // update the name so rename can be invoked repeatedly
     RWLock::RLocker owner_locker(owner_lock);
-    RWLock::WLocker snap_locker(snap_lock);
+    RWLock::WLocker image_locker(image_lock);
     name = image_name;
     if (old_format) {
       header_oid = util::old_header_name(image_name);
@@ -886,13 +886,13 @@ public:
   }
 
   journal::Policy *ImageCtx::get_journal_policy() const {
-    ceph_assert(snap_lock.is_locked());
+    ceph_assert(image_lock.is_locked());
     ceph_assert(journal_policy != nullptr);
     return journal_policy;
   }
 
   void ImageCtx::set_journal_policy(journal::Policy *policy) {
-    ceph_assert(snap_lock.is_wlocked());
+    ceph_assert(image_lock.is_wlocked());
     ceph_assert(policy != nullptr);
     delete journal_policy;
     journal_policy = policy;
index 0dd5a13cfcda3739bacdd5fdb65581ef7b44edc7..a24d301d35f9b902d0da1a9020223f85140c7a8c 100644 (file)
@@ -97,7 +97,7 @@ namespace librbd {
     /**
      * Lock ordering:
      *
-     * owner_lock, md_lock, snap_lock, parent_lock,
+     * owner_lock, md_lock, image_lock, parent_lock,
      * object_map_lock, async_op_lock, timestamp_lock
      */
     RWLock owner_lock; // protects exclusive lock leadership updates
@@ -109,11 +109,12 @@ namespace librbd {
                    // exclusive_locked
                    // lock_tag
                    // lockers
-    RWLock snap_lock; // protects snapshot-related member variables,
-                      // features (and associated helper classes), and flags
-    RWLock timestamp_lock;
+    RWLock image_lock; // protects snapshot-related member variables,
+                       // features (and associated helper classes), and flags
     RWLock parent_lock; // protects parent_md and parent
     RWLock object_map_lock; // protects object map updates and object_map itself
+
+    RWLock timestamp_lock; // protects (create/access/modify)_timestamp
     Mutex async_ops_lock; // protects async_ops and async_requests
     Mutex copyup_list_lock; // protects copyup_waiting_list
     Mutex completed_reqs_lock; // protects completed_reqs
@@ -267,15 +268,15 @@ namespace librbd {
     uint64_t get_object_count(librados::snap_t in_snap_id) const;
     bool test_features(uint64_t test_features) const;
     bool test_features(uint64_t test_features,
-                       const RWLock &in_snap_lock) const;
+                       const RWLock &in_image_lock) const;
     bool test_op_features(uint64_t op_features) const;
     bool test_op_features(uint64_t op_features,
-                          const RWLock &in_snap_lock) const;
+                          const RWLock &in_image_lock) const;
     int get_flags(librados::snap_t in_snap_id, uint64_t *flags) const;
     int test_flags(librados::snap_t in_snap_id,
                    uint64_t test_flags, bool *flags_set) const;
     int test_flags(librados::snap_t in_snap_id,
-                   uint64_t test_flags, const RWLock &in_snap_lock,
+                   uint64_t test_flags, const RWLock &in_image_lock,
                    bool *flags_set) const;
     int update_flags(librados::snap_t in_snap_id, uint64_t flag, bool enabled);
 
index 81264e5e76f9ae7e73b31dd863ac3083540d3c20..055aec196a148aae8e142a3ccb95989d9ecb74c5 100644 (file)
@@ -416,7 +416,7 @@ void ImageWatcher<I>::schedule_request_lock(bool use_timer, int timer_delay) {
 template <typename I>
 void ImageWatcher<I>::notify_request_lock() {
   RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
-  RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::RLocker image_locker(m_image_ctx.image_lock);
 
   // ExclusiveLock state machine can be dynamically disabled or
   // race with task cancel
@@ -435,7 +435,7 @@ void ImageWatcher<I>::notify_request_lock() {
 template <typename I>
 void ImageWatcher<I>::handle_request_lock(int r) {
   RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
-  RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::RLocker image_locker(m_image_ctx.image_lock);
 
   // ExclusiveLock state machine cannot transition -- but can be
   // dynamically disabled
index 45d103f43277d12c8747522c966198f85b6ae473..2f87146256667d036f1fcebe2e35198843d63771 100644 (file)
@@ -360,7 +360,7 @@ Journal<I>::~Journal() {
 
 template <typename I>
 bool Journal<I>::is_journal_supported(I &image_ctx) {
-  ceph_assert(image_ctx.snap_lock.is_locked());
+  ceph_assert(image_ctx.image_lock.is_locked());
   return ((image_ctx.features & RBD_FEATURE_JOURNALING) &&
           !image_ctx.read_only && image_ctx.snap_id == CEPH_NOSNAP);
 }
@@ -541,7 +541,7 @@ bool Journal<I>::is_journal_replaying(const Mutex &) const {
 
 template <typename I>
 bool Journal<I>::is_journal_appending() const {
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
   Mutex::Locker locker(m_lock);
   return (m_state == STATE_READY &&
           !m_image_ctx.get_journal_policy()->append_disabled());
index 50cbfda89220edc23747aa1a8763401754ecd6f7..4eedf80bba1f724da73b612aa09947fef273388c 100644 (file)
@@ -87,18 +87,18 @@ uint8_t ObjectMap<I>::operator[](uint64_t object_no) const
 template <typename I>
 bool ObjectMap<I>::object_may_exist(uint64_t object_no) const
 {
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
 
   // Fall back to default logic if object map is disabled or invalid
   if (!m_image_ctx.test_features(RBD_FEATURE_OBJECT_MAP,
-                                 m_image_ctx.snap_lock)) {
+                                 m_image_ctx.image_lock)) {
     return true;
   }
 
   bool flags_set;
   int r = m_image_ctx.test_flags(m_image_ctx.snap_id,
                                  RBD_FLAG_OBJECT_MAP_INVALID,
-                                 m_image_ctx.snap_lock, &flags_set);
+                                 m_image_ctx.image_lock, &flags_set);
   if (r < 0 || flags_set) {
     return true;
   }
@@ -114,18 +114,18 @@ bool ObjectMap<I>::object_may_exist(uint64_t object_no) const
 template <typename I>
 bool ObjectMap<I>::object_may_not_exist(uint64_t object_no) const
 {
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
 
   // Fall back to default logic if object map is disabled or invalid
   if (!m_image_ctx.test_features(RBD_FEATURE_OBJECT_MAP,
-                                 m_image_ctx.snap_lock)) {
+                                 m_image_ctx.image_lock)) {
     return true;
   }
 
   bool flags_set;
   int r = m_image_ctx.test_flags(m_image_ctx.snap_id,
                                  RBD_FLAG_OBJECT_MAP_INVALID,
-                                 m_image_ctx.snap_lock, &flags_set);
+                                 m_image_ctx.image_lock, &flags_set);
   if (r < 0 || flags_set) {
     return true;
   }
@@ -172,9 +172,9 @@ void ObjectMap<I>::close(Context *on_finish) {
 template <typename I>
 bool ObjectMap<I>::set_object_map(ceph::BitVector<2> &target_object_map) {
   ceph_assert(m_image_ctx.owner_lock.is_locked());
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
   ceph_assert(m_image_ctx.test_features(RBD_FEATURE_OBJECT_MAP,
-                                        m_image_ctx.snap_lock));
+                                        m_image_ctx.image_lock));
   RWLock::RLocker object_map_locker(m_image_ctx.object_map_lock);
   m_object_map = target_object_map;
   return true;
@@ -182,7 +182,7 @@ bool ObjectMap<I>::set_object_map(ceph::BitVector<2> &target_object_map) {
 
 template <typename I>
 void ObjectMap<I>::rollback(uint64_t snap_id, Context *on_finish) {
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
   ceph_assert(m_image_ctx.object_map_lock.is_wlocked());
 
   object_map::SnapshotRollbackRequest *req =
@@ -192,7 +192,7 @@ void ObjectMap<I>::rollback(uint64_t snap_id, Context *on_finish) {
 
 template <typename I>
 void ObjectMap<I>::snapshot_add(uint64_t snap_id, Context *on_finish) {
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
   ceph_assert((m_image_ctx.features & RBD_FEATURE_OBJECT_MAP) != 0);
   ceph_assert(snap_id != CEPH_NOSNAP);
 
@@ -204,7 +204,7 @@ void ObjectMap<I>::snapshot_add(uint64_t snap_id, Context *on_finish) {
 
 template <typename I>
 void ObjectMap<I>::snapshot_remove(uint64_t snap_id, Context *on_finish) {
-  ceph_assert(m_image_ctx.snap_lock.is_wlocked());
+  ceph_assert(m_image_ctx.image_lock.is_wlocked());
   ceph_assert((m_image_ctx.features & RBD_FEATURE_OBJECT_MAP) != 0);
   ceph_assert(snap_id != CEPH_NOSNAP);
 
@@ -217,9 +217,9 @@ void ObjectMap<I>::snapshot_remove(uint64_t snap_id, Context *on_finish) {
 template <typename I>
 void ObjectMap<I>::aio_save(Context *on_finish) {
   ceph_assert(m_image_ctx.owner_lock.is_locked());
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
   ceph_assert(m_image_ctx.test_features(RBD_FEATURE_OBJECT_MAP,
-                                        m_image_ctx.snap_lock));
+                                        m_image_ctx.image_lock));
   RWLock::RLocker object_map_locker(m_image_ctx.object_map_lock);
 
   librados::ObjectWriteOperation op;
@@ -240,9 +240,9 @@ template <typename I>
 void ObjectMap<I>::aio_resize(uint64_t new_size, uint8_t default_object_state,
                              Context *on_finish) {
   ceph_assert(m_image_ctx.owner_lock.is_locked());
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
   ceph_assert(m_image_ctx.test_features(RBD_FEATURE_OBJECT_MAP,
-                                        m_image_ctx.snap_lock));
+                                        m_image_ctx.image_lock));
   ceph_assert(m_image_ctx.image_watcher != NULL);
   ceph_assert(m_image_ctx.exclusive_lock == nullptr ||
               m_image_ctx.exclusive_lock->is_lock_owner());
@@ -258,7 +258,7 @@ void ObjectMap<I>::detained_aio_update(UpdateOperation &&op) {
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 20) << dendl;
 
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
   ceph_assert(m_image_ctx.object_map_lock.is_wlocked());
 
   BlockGuardCell *cell;
@@ -299,7 +299,7 @@ void ObjectMap<I>::handle_detained_aio_update(BlockGuardCell *cell, int r,
   m_update_guard->release(cell, &block_ops);
 
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     RWLock::WLocker object_map_locker(m_image_ctx.object_map_lock);
     for (auto &op : block_ops) {
       detained_aio_update(std::move(op));
@@ -315,7 +315,7 @@ void ObjectMap<I>::aio_update(uint64_t snap_id, uint64_t start_object_no,
                               const boost::optional<uint8_t> &current_state,
                               const ZTracer::Trace &parent_trace,
                               bool ignore_enoent, Context *on_finish) {
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
   ceph_assert((m_image_ctx.features & RBD_FEATURE_OBJECT_MAP) != 0);
   ceph_assert(m_image_ctx.image_watcher != nullptr);
   ceph_assert(m_image_ctx.exclusive_lock == nullptr ||
index 642cd03a7fefa44dd0e16276cd879fbd1d7b54c7..205f3d08e0f837176eb8fc9c8b66682b65434561 100644 (file)
@@ -178,15 +178,15 @@ struct C_InvokeAsyncRequest : public Context {
     // context can complete before owner_lock is unlocked
     RWLock &owner_lock(image_ctx.owner_lock);
     owner_lock.get_read();
-    image_ctx.snap_lock.get_read();
+    image_ctx.image_lock.get_read();
     if (image_ctx.read_only ||
         (!permit_snapshot && image_ctx.snap_id != CEPH_NOSNAP)) {
-      image_ctx.snap_lock.put_read();
+      image_ctx.image_lock.put_read();
       owner_lock.put_read();
       complete(-EROFS);
       return;
     }
-    image_ctx.snap_lock.put_read();
+    image_ctx.image_lock.put_read();
 
     if (image_ctx.exclusive_lock == nullptr) {
       send_local_request();
@@ -385,21 +385,21 @@ void Operations<I>::execute_flatten(ProgressContext &prog_ctx,
     return;
   }
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   m_image_ctx.parent_lock.get_read();
 
   // can't flatten a non-clone
   if (m_image_ctx.parent_md.spec.pool_id == -1) {
     lderr(cct) << "image has no parent" << dendl;
     m_image_ctx.parent_lock.put_read();
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-EINVAL);
     return;
   }
   if (m_image_ctx.snap_id != CEPH_NOSNAP) {
     lderr(cct) << "snapshots cannot be flattened" << dendl;
     m_image_ctx.parent_lock.put_read();
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-EROFS);
     return;
   }
@@ -415,7 +415,7 @@ void Operations<I>::execute_flatten(ProgressContext &prog_ctx,
                                                       overlap);
 
   m_image_ctx.parent_lock.put_read();
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 
   operation::FlattenRequest<I> *req = new operation::FlattenRequest<I>(
     m_image_ctx, new C_NotifyUpdate<I>(m_image_ctx, on_finish), overlap_objects,
@@ -577,13 +577,13 @@ void Operations<I>::execute_rename(const std::string &dest_name,
     return;
   }
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   if (m_image_ctx.name == dest_name) {
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-EEXIST);
     return;
   }
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 5) << this << " " << __func__ << ": dest_name=" << dest_name
@@ -616,11 +616,11 @@ template <typename I>
 int Operations<I>::resize(uint64_t size, bool allow_shrink, ProgressContext& prog_ctx) {
   CephContext *cct = m_image_ctx.cct;
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   ldout(cct, 5) << this << " " << __func__ << ": "
                 << "size=" << m_image_ctx.size << ", "
                 << "new_size=" << size << dendl;
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 
   int r = m_image_ctx.state->refresh_if_required();
   if (r < 0) {
@@ -655,24 +655,24 @@ void Operations<I>::execute_resize(uint64_t size, bool allow_shrink, ProgressCon
               m_image_ctx.exclusive_lock->is_lock_owner());
 
   CephContext *cct = m_image_ctx.cct;
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   ldout(cct, 5) << this << " " << __func__ << ": "
                 << "size=" << m_image_ctx.size << ", "
                 << "new_size=" << size << dendl;
 
   if (m_image_ctx.snap_id != CEPH_NOSNAP || m_image_ctx.read_only ||
       m_image_ctx.operations_disabled) {
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-EROFS);
     return;
   } else if (m_image_ctx.test_features(RBD_FEATURE_OBJECT_MAP,
-                                       m_image_ctx.snap_lock) &&
+                                       m_image_ctx.image_lock) &&
              !ObjectMap<>::is_compatible(m_image_ctx.layout, size)) {
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-EINVAL);
     return;
   }
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 
   operation::ResizeRequest<I> *req = new operation::ResizeRequest<I>(
     m_image_ctx, new C_NotifyUpdate<I>(m_image_ctx, on_finish), size, allow_shrink,
@@ -717,13 +717,13 @@ void Operations<I>::snap_create(const cls::rbd::SnapshotNamespace &snap_namespac
     return;
   }
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   if (m_image_ctx.get_snap_id(snap_namespace, snap_name) != CEPH_NOSNAP) {
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-EEXIST);
     return;
   }
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 
   C_InvokeAsyncRequest<I> *req = new C_InvokeAsyncRequest<I>(
     m_image_ctx, "snap_create", true,
@@ -754,13 +754,13 @@ void Operations<I>::execute_snap_create(const cls::rbd::SnapshotNamespace &snap_
     return;
   }
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   if (m_image_ctx.get_snap_id(snap_namespace, snap_name) != CEPH_NOSNAP) {
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-EEXIST);
     return;
   }
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 
   operation::SnapshotCreateRequest<I> *req =
     new operation::SnapshotCreateRequest<I>(
@@ -785,8 +785,8 @@ int Operations<I>::snap_rollback(const cls::rbd::SnapshotNamespace& snap_namespa
   {
     RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
     {
-      // need to drop snap_lock before invalidating cache
-      RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+      // need to drop image_lock before invalidating cache
+      RWLock::RLocker image_locker(m_image_ctx.image_lock);
       if (!m_image_ctx.snap_exists) {
         return -ENOENT;
       }
@@ -834,17 +834,17 @@ void Operations<I>::execute_snap_rollback(const cls::rbd::SnapshotNamespace& sna
     return;
   }
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   uint64_t snap_id = m_image_ctx.get_snap_id(snap_namespace, snap_name);
   if (snap_id == CEPH_NOSNAP) {
     lderr(cct) << "No such snapshot found." << dendl;
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-ENOENT);
     return;
   }
 
   uint64_t new_size = m_image_ctx.get_image_size(snap_id);
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 
   // async mode used for journal replay
   operation::SnapshotRollbackRequest<I> *request =
@@ -892,16 +892,16 @@ void Operations<I>::snap_remove(const cls::rbd::SnapshotNamespace& snap_namespac
   }
 
   // quickly filter out duplicate ops
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   if (m_image_ctx.get_snap_id(snap_namespace, snap_name) == CEPH_NOSNAP) {
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-ENOENT);
     return;
   }
 
   bool proxy_op = ((m_image_ctx.features & RBD_FEATURE_FAST_DIFF) != 0 ||
                    (m_image_ctx.features & RBD_FEATURE_JOURNALING) != 0);
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 
   if (proxy_op) {
     C_InvokeAsyncRequest<I> *req = new C_InvokeAsyncRequest<I>(
@@ -938,11 +938,11 @@ void Operations<I>::execute_snap_remove(const cls::rbd::SnapshotNamespace& snap_
     return;
   }
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   uint64_t snap_id = m_image_ctx.get_snap_id(snap_namespace, snap_name);
   if (snap_id == CEPH_NOSNAP) {
     lderr(m_image_ctx.cct) << "No such snapshot found." << dendl;
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-ENOENT);
     return;
   }
@@ -950,16 +950,16 @@ void Operations<I>::execute_snap_remove(const cls::rbd::SnapshotNamespace& snap_
   bool is_protected;
   int r = m_image_ctx.is_snap_protected(snap_id, &is_protected);
   if (r < 0) {
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(r);
     return;
   } else if (is_protected) {
     lderr(m_image_ctx.cct) << "snapshot is protected" << dendl;
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-EBUSY);
     return;
   }
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 
   operation::SnapshotRemoveRequest<I> *req =
     new operation::SnapshotRemoveRequest<I>(
@@ -985,7 +985,7 @@ int Operations<I>::snap_rename(const char *srcname, const char *dstname) {
     return r;
 
   {
-    RWLock::RLocker l(m_image_ctx.snap_lock);
+    RWLock::RLocker l(m_image_ctx.image_lock);
     snap_id = m_image_ctx.get_snap_id(cls::rbd::UserSnapshotNamespace(), srcname);
     if (snap_id == CEPH_NOSNAP) {
       return -ENOENT;
@@ -1037,15 +1037,15 @@ void Operations<I>::execute_snap_rename(const uint64_t src_snap_id,
     return;
   }
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   if (m_image_ctx.get_snap_id(cls::rbd::UserSnapshotNamespace(),
                              dest_snap_name) != CEPH_NOSNAP) {
     // Renaming is supported for snapshots from user namespace only.
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-EEXIST);
     return;
   }
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 5) << this << " " << __func__ << ": "
@@ -1081,7 +1081,7 @@ int Operations<I>::snap_protect(const cls::rbd::SnapshotNamespace& snap_namespac
   }
 
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     bool is_protected;
     r = m_image_ctx.is_snap_protected(m_image_ctx.get_snap_id(snap_namespace, snap_name),
                                       &is_protected);
@@ -1134,20 +1134,20 @@ void Operations<I>::execute_snap_protect(const cls::rbd::SnapshotNamespace& snap
     return;
   }
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   bool is_protected;
   int r = m_image_ctx.is_snap_protected(m_image_ctx.get_snap_id(snap_namespace, snap_name),
                                         &is_protected);
   if (r < 0) {
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(r);
     return;
   } else if (is_protected) {
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-EBUSY);
     return;
   }
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 5) << this << " " << __func__ << ": snap_name=" << snap_name
@@ -1176,7 +1176,7 @@ int Operations<I>::snap_unprotect(const cls::rbd::SnapshotNamespace& snap_namesp
   }
 
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     bool is_unprotected;
     r = m_image_ctx.is_snap_unprotected(m_image_ctx.get_snap_id(snap_namespace, snap_name),
                                   &is_unprotected);
@@ -1229,20 +1229,20 @@ void Operations<I>::execute_snap_unprotect(const cls::rbd::SnapshotNamespace& sn
     return;
   }
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   bool is_unprotected;
   int r = m_image_ctx.is_snap_unprotected(m_image_ctx.get_snap_id(snap_namespace, snap_name),
                                           &is_unprotected);
   if (r < 0) {
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(r);
     return;
   } else if (is_unprotected) {
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-EINVAL);
     return;
   }
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 5) << this << " " << __func__ << ": snap_name=" << snap_name
@@ -1338,7 +1338,7 @@ int Operations<I>::update_features(uint64_t features, bool enabled) {
     return -EINVAL;
   }
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     if (enabled && (features & m_image_ctx.features) != 0) {
       lderr(cct) << "one or more requested features are already enabled"
                 << dendl;
@@ -1355,13 +1355,13 @@ int Operations<I>::update_features(uint64_t features, bool enabled) {
   // when acquiring the exclusive lock in case the journal is corrupt
   bool disabling_journal = false;
   if (!enabled && ((features & RBD_FEATURE_JOURNALING) != 0)) {
-    RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::WLocker image_locker(m_image_ctx.image_lock);
     m_image_ctx.set_journal_policy(new journal::DisabledPolicy());
     disabling_journal = true;
   }
   BOOST_SCOPE_EXIT_ALL( (this)(disabling_journal) ) {
     if (disabling_journal) {
-      RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+      RWLock::WLocker image_locker(m_image_ctx.image_lock);
       m_image_ctx.set_journal_policy(
         new journal::StandardPolicy<I>(&m_image_ctx));
     }
@@ -1612,26 +1612,26 @@ void Operations<I>::execute_migrate(ProgressContext &prog_ctx,
     return;
   }
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   m_image_ctx.parent_lock.get_read();
 
   if (m_image_ctx.migration_info.empty()) {
     lderr(cct) << "image has no migrating parent" << dendl;
     m_image_ctx.parent_lock.put_read();
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-EINVAL);
     return;
   }
   if (m_image_ctx.snap_id != CEPH_NOSNAP) {
     lderr(cct) << "snapshots cannot be migrated" << dendl;
     m_image_ctx.parent_lock.put_read();
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     on_finish->complete(-EROFS);
     return;
   }
 
   m_image_ctx.parent_lock.put_read();
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 
   operation::MigrateRequest<I> *req = new operation::MigrateRequest<I>(
     m_image_ctx, new C_NotifyUpdate<I>(m_image_ctx, on_finish), prog_ctx);
index 0e620cb5adb74c04ea6aceaaa2d251664940e28e..69b9240f58fe8fa22584c5b5231fd89c35ed3eb9 100644 (file)
@@ -259,9 +259,9 @@ int DiffIterate<I>::diff_iterate(I *ictx,
     return r;
   }
 
-  ictx->snap_lock.get_read();
+  ictx->image_lock.get_read();
   r = clip_io(ictx, off, &len);
-  ictx->snap_lock.put_read();
+  ictx->image_lock.put_read();
   if (r < 0) {
     return r;
   }
@@ -283,7 +283,7 @@ int DiffIterate<I>::execute() {
   uint64_t end_size;
   {
     RWLock::RLocker md_locker(m_image_ctx.md_lock);
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     head_ctx.dup(m_image_ctx.data_ctx);
     if (m_from_snap_name) {
       from_snap_id = m_image_ctx.get_snap_id(m_from_snap_namespace, m_from_snap_name);
@@ -308,7 +308,7 @@ int DiffIterate<I>::execute() {
   bool fast_diff_enabled = false;
   BitVector<2> object_diff_state;
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     if (m_whole_object && (m_image_ctx.features & RBD_FEATURE_FAST_DIFF) != 0) {
       r = diff_object_map(from_snap_id, end_snap_id, &object_diff_state);
       if (r < 0) {
@@ -331,7 +331,7 @@ int DiffIterate<I>::execute() {
   DiffContext diff_context(m_image_ctx, m_callback, m_callback_arg,
                            m_whole_object, from_snap_id, end_snap_id);
   if (m_include_parent && from_snap_id == 0) {
-    RWLock::RLocker l(m_image_ctx.snap_lock);
+    RWLock::RLocker l(m_image_ctx.image_lock);
     RWLock::RLocker l2(m_image_ctx.parent_lock);
     uint64_t overlap = 0;
     m_image_ctx.get_parent_overlap(m_image_ctx.snap_id, &overlap);
@@ -411,7 +411,7 @@ int DiffIterate<I>::execute() {
 template <typename I>
 int DiffIterate<I>::diff_object_map(uint64_t from_snap_id, uint64_t to_snap_id,
                                     BitVector<2>* object_diff_state) {
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
   CephContext* cct = m_image_ctx.cct;
 
   bool diff_from_start = (from_snap_id == 0);
index 8b75bd9480e9cd3f3830124c3517eb8b9d8bd4ca..9dfbc19018d1bc04ef1b422c9519863b495ba622 100644 (file)
@@ -37,7 +37,7 @@ namespace {
 template <typename I>
 snap_t get_group_snap_id(I* ictx,
                          const cls::rbd::SnapshotNamespace& in_snap_namespace) {
-  ceph_assert(ictx->snap_lock.is_locked());
+  ceph_assert(ictx->image_lock.is_locked());
   auto it = ictx->snap_ids.lower_bound({in_snap_namespace, ""});
   if (it != ictx->snap_ids.end() && it->first.first == in_snap_namespace) {
     return it->second;
@@ -260,10 +260,10 @@ int group_snap_remove_by_record(librados::IoCtx& group_ioctx,
     on_finishes[i] = new C_SaferCond;
 
     std::string snap_name;
-    ictx->snap_lock.get_read();
+    ictx->image_lock.get_read();
     snap_t snap_id = get_group_snap_id(ictx, ne);
     r = ictx->get_snap_name(snap_id, &snap_name);
-    ictx->snap_lock.put_read();
+    ictx->image_lock.put_read();
 
     if (r >= 0) {
       ldout(cct, 20) << "removing individual snapshot from image " << ictx->name
@@ -399,10 +399,10 @@ int group_snap_rollback_by_record(librados::IoCtx& group_ioctx,
 
     RWLock::RLocker owner_locker(ictx->owner_lock);
     std::string snap_name;
-    ictx->snap_lock.get_read();
+    ictx->image_lock.get_read();
     snap_t snap_id = get_group_snap_id(ictx, ne);
     r = ictx->get_snap_name(snap_id, &snap_name);
-    ictx->snap_lock.put_read();
+    ictx->image_lock.put_read();
 
     if (r >= 0) {
       ldout(cct, 20) << "rolling back to individual snapshot for image " << ictx->name
@@ -979,9 +979,9 @@ int Group<I>::snap_create(librados::IoCtx& group_ioctx,
       ret_code = r;
     } else {
       ImageCtx *ictx = ictxs[i];
-      ictx->snap_lock.get_read();
+      ictx->image_lock.get_read();
       snap_t snap_id = get_group_snap_id(ictx, ne);
-      ictx->snap_lock.put_read();
+      ictx->image_lock.put_read();
       if (snap_id == CEPH_NOSNAP) {
        ldout(cct, 20) << "Couldn't find created snapshot with namespace: "
                        << ne << dendl;
@@ -1017,10 +1017,10 @@ remove_image_snaps:
 
     on_finishes[i] = new C_SaferCond;
     std::string snap_name;
-    ictx->snap_lock.get_read();
+    ictx->image_lock.get_read();
     snap_t snap_id = get_group_snap_id(ictx, ne);
     r = ictx->get_snap_name(snap_id, &snap_name);
-    ictx->snap_lock.put_read();
+    ictx->image_lock.put_read();
     if (r >= 0) {
       ictx->operations->snap_remove(ne, snap_name.c_str(), on_finishes[i]);
     } else {
index 8fbd7176652cebce6bd66e166bc538a5ca48f34d..e32b4c7a397a9bac10eb468843fadcb6691a8755 100644 (file)
@@ -86,7 +86,7 @@ int Image<I>::get_op_features(I *ictx, uint64_t *op_features) {
     return r;
   }
 
-  RWLock::RLocker snap_locker(ictx->snap_lock);
+  RWLock::RLocker image_locker(ictx->image_lock);
   *op_features = ictx->op_features;
   return 0;
 }
@@ -200,14 +200,14 @@ int Image<I>::get_parent(I *ictx,
     return r;
   }
 
-  RWLock::RLocker snap_locker(ictx->snap_lock);
+  RWLock::RLocker image_locker(ictx->image_lock);
   RWLock::RLocker parent_locker(ictx->parent_lock);
 
   bool release_parent_locks = false;
   BOOST_SCOPE_EXIT_ALL(ictx, &release_parent_locks) {
     if (release_parent_locks) {
       ictx->parent->parent_lock.put_read();
-      ictx->parent->snap_lock.put_read();
+      ictx->parent->image_lock.put_read();
     }
   };
 
@@ -216,7 +216,7 @@ int Image<I>::get_parent(I *ictx,
   auto parent = ictx->parent;
   if (!ictx->migration_info.empty() && ictx->parent != nullptr) {
     release_parent_locks = true;
-    ictx->parent->snap_lock.get_read();
+    ictx->parent->image_lock.get_read();
     ictx->parent->parent_lock.get_read();
 
     parent = ictx->parent->parent;
@@ -230,7 +230,7 @@ int Image<I>::get_parent(I *ictx,
   parent_image->pool_name = parent->md_ctx.get_pool_name();
   parent_image->pool_namespace = parent->md_ctx.get_namespace();
 
-  RWLock::RLocker parent_snap_locker(parent->snap_lock);
+  RWLock::RLocker parent_image_locker(parent->image_lock);
   parent_snap->id = parent->snap_id;
   parent_snap->namespace_type = RBD_SNAP_NAMESPACE_TYPE_USER;
   if (parent->snap_id != CEPH_NOSNAP) {
@@ -312,7 +312,7 @@ template <typename I>
 int Image<I>::list_descendants(
     I *ictx, const std::optional<size_t> &max_level,
     std::vector<librbd::linked_image_spec_t> *images) {
-  RWLock::RLocker l(ictx->snap_lock);
+  RWLock::RLocker l(ictx->image_lock);
   std::vector<librados::snap_t> snap_ids;
   if (ictx->snap_id != CEPH_NOSNAP) {
     snap_ids.push_back(ictx->snap_id);
@@ -347,7 +347,7 @@ int Image<I>::list_descendants(
   ldout(cct, 20) << "ictx=" << ictx << dendl;
 
   // no children for non-layered or old format image
-  if (!ictx->test_features(RBD_FEATURE_LAYERING, ictx->snap_lock)) {
+  if (!ictx->test_features(RBD_FEATURE_LAYERING, ictx->image_lock)) {
     return 0;
   }
 
@@ -519,7 +519,7 @@ int Image<I>::deep_copy(I *src, librados::IoCtx& dest_md_ctx,
   uint64_t features;
   uint64_t src_size;
   {
-    RWLock::RLocker snap_locker(src->snap_lock);
+    RWLock::RLocker image_locker(src->image_lock);
 
     if (!src->migration_info.empty()) {
       lderr(cct) << "cannot deep copy migrating image" << dendl;
@@ -566,7 +566,7 @@ int Image<I>::deep_copy(I *src, librados::IoCtx& dest_md_ctx,
   if (flatten > 0) {
     parent_spec.pool_id = -1;
   } else {
-    RWLock::RLocker snap_locker(src->snap_lock);
+    RWLock::RLocker image_locker(src->image_lock);
     RWLock::RLocker parent_locker(src->parent_lock);
 
     // use oldest snapshot or HEAD for parent spec
@@ -648,7 +648,7 @@ int Image<I>::deep_copy(I *src, I *dest, bool flatten,
   librados::snap_t snap_id_start = 0;
   librados::snap_t snap_id_end;
   {
-    RWLock::RLocker snap_locker(src->snap_lock);
+    RWLock::RLocker image_locker(src->image_lock);
     snap_id_end = src->snap_id;
   }
 
@@ -684,7 +684,7 @@ int Image<I>::snap_set(I *ictx,
   uint64_t snap_id = CEPH_NOSNAP;
   std::string name(snap_name == nullptr ? "" : snap_name);
   if (!name.empty()) {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     snap_id = ictx->get_snap_id(cls::rbd::UserSnapshotNamespace{},
                                 snap_name);
     if (snap_id == CEPH_NOSNAP) {
index 0c56959d76ececb0be40712cab4fad5d271a4e00..90cda0b86baf0bc95576ebc3b03e8ad2b55ba6d8 100644 (file)
@@ -389,7 +389,7 @@ int Migration<I>::prepare(librados::IoCtx& io_ctx,
 
   uint64_t features;
   {
-    RWLock::RLocker snap_locker(image_ctx->snap_lock);
+    RWLock::RLocker image_locker(image_ctx->image_lock);
     features = image_ctx->features;
   }
   opts.get(RBD_IMAGE_OPTION_FEATURES, &features);
@@ -1026,7 +1026,7 @@ int Migration<I>::validate_src_snaps() {
   }
 
   for (auto &snap : snaps) {
-    RWLock::RLocker snap_locker(m_src_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(m_src_image_ctx->image_lock);
     cls::rbd::ParentImageSpec parent_spec{m_src_image_ctx->md_ctx.get_id(),
                                           m_src_image_ctx->md_ctx.get_namespace(),
                                           m_src_image_ctx->id, snap.id};
@@ -1193,7 +1193,7 @@ int Migration<I>::create_dst_image() {
   uint64_t size;
   cls::rbd::ParentImageSpec parent_spec;
   {
-    RWLock::RLocker snap_locker(m_src_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(m_src_image_ctx->image_lock);
     RWLock::RLocker parent_locker(m_src_image_ctx->parent_lock);
     size = m_src_image_ctx->size;
 
@@ -1542,7 +1542,7 @@ int Migration<I>::relink_children(I *from_image_ctx, I *to_image_ctx) {
       // Also collect the list of the children currently attached to the
       // source, so we could make a proper decision later about relinking.
 
-      RWLock::RLocker src_snap_locker(to_image_ctx->snap_lock);
+      RWLock::RLocker src_image_locker(to_image_ctx->image_lock);
       cls::rbd::ParentImageSpec src_parent_spec{to_image_ctx->md_ctx.get_id(),
                                                 to_image_ctx->md_ctx.get_namespace(),
                                                 to_image_ctx->id, snap.id};
@@ -1554,7 +1554,7 @@ int Migration<I>::relink_children(I *from_image_ctx, I *to_image_ctx) {
         return r;
       }
 
-      RWLock::RLocker snap_locker(from_image_ctx->snap_lock);
+      RWLock::RLocker image_locker(from_image_ctx->image_lock);
       snap.id = from_image_ctx->get_snap_id(cls::rbd::UserSnapshotNamespace(),
                                             snap.name);
       if (snap.id == CEPH_NOSNAP) {
@@ -1565,7 +1565,7 @@ int Migration<I>::relink_children(I *from_image_ctx, I *to_image_ctx) {
 
     std::vector<librbd::linked_image_spec_t> child_images;
     {
-      RWLock::RLocker snap_locker(from_image_ctx->snap_lock);
+      RWLock::RLocker image_locker(from_image_ctx->image_lock);
       cls::rbd::ParentImageSpec parent_spec{from_image_ctx->md_ctx.get_id(),
                                             from_image_ctx->md_ctx.get_namespace(),
                                             from_image_ctx->id, snap.id};
@@ -1615,7 +1615,7 @@ int Migration<I>::relink_child(I *from_image_ctx, I *to_image_ctx,
 
   librados::snap_t to_snap_id;
   {
-    RWLock::RLocker snap_locker(to_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(to_image_ctx->image_lock);
     to_snap_id = to_image_ctx->get_snap_id(cls::rbd::UserSnapshotNamespace(),
                                              from_snap.name);
     if (to_snap_id == CEPH_NOSNAP) {
@@ -1653,7 +1653,7 @@ int Migration<I>::relink_child(I *from_image_ctx, I *to_image_ctx,
   cls::rbd::ParentImageSpec parent_spec;
   uint64_t parent_overlap;
   {
-    RWLock::RLocker snap_locker(child_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(child_image_ctx->image_lock);
     RWLock::RLocker parent_locker(child_image_ctx->parent_lock);
 
     // use oldest snapshot or HEAD for parent spec
index 9fe240bc67097ff514dee54bb7d680f693915d33..7b3c8a166e2b83072f2b48e9cede030c526e0f80 100644 (file)
@@ -297,7 +297,7 @@ int Mirror<I>::image_disable(I *ictx, bool force) {
     };
 
     {
-      RWLock::RLocker l(ictx->snap_lock);
+      RWLock::RLocker l(ictx->image_lock);
       map<librados::snap_t, SnapInfo> snap_info = ictx->snap_info;
       for (auto &info : snap_info) {
         cls::rbd::ParentImageSpec parent_spec{ictx->md_ctx.get_id(),
index 99010bf4d3537840ef5744d9d48dd792f0dc7373..a3c314c9762616f7f2701f8133ceaed9896c85f0 100644 (file)
@@ -105,7 +105,7 @@ int Snapshot<I>::get_group_namespace(I *ictx, uint64_t snap_id,
     return r;
   }
 
-  RWLock::RLocker snap_locker(ictx->snap_lock);
+  RWLock::RLocker image_locker(ictx->image_lock);
   auto snap_info = ictx->get_snap_info(snap_id);
   if (snap_info == nullptr) {
     return -ENOENT;
@@ -128,7 +128,7 @@ int Snapshot<I>::get_trash_namespace(I *ictx, uint64_t snap_id,
     return r;
   }
 
-  RWLock::RLocker snap_locker(ictx->snap_lock);
+  RWLock::RLocker image_locker(ictx->image_lock);
   auto snap_info = ictx->get_snap_info(snap_id);
   if (snap_info == nullptr) {
     return -ENOENT;
@@ -151,7 +151,7 @@ int Snapshot<I>::get_namespace_type(I *ictx, uint64_t snap_id,
     return r;
   }
 
-  RWLock::RLocker l(ictx->snap_lock);
+  RWLock::RLocker l(ictx->image_lock);
   auto snap_info = ictx->get_snap_info(snap_id);
   if (snap_info == nullptr) {
     return -ENOENT;
@@ -174,7 +174,7 @@ int Snapshot<I>::remove(I *ictx, uint64_t snap_id) {
   cls::rbd::SnapshotNamespace snapshot_namespace;
   std::string snapshot_name;
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     auto it = ictx->snap_info.find(snap_id);
     if (it == ictx->snap_info.end()) {
       return -ENOENT;
index 9a534d21db7f691fa49d6161ff1b5796dbac72a1..b8deddfb2bda459bd55d41f7b092efb78a027ab6 100644 (file)
@@ -137,7 +137,7 @@ int Trash<I>::move(librados::IoCtx &io_ctx, rbd_trash_image_source_t source,
 
   if (r == 0) {
     if (ictx->test_features(RBD_FEATURE_JOURNALING)) {
-      RWLock::WLocker snap_locker(ictx->snap_lock);
+      RWLock::WLocker image_locker(ictx->image_lock);
       ictx->set_journal_policy(new journal::DisabledPolicy());
     }
 
@@ -155,14 +155,14 @@ int Trash<I>::move(librados::IoCtx &io_ctx, rbd_trash_image_source_t source,
     }
     ictx->owner_lock.put_read();
 
-    ictx->snap_lock.get_read();
+    ictx->image_lock.get_read();
     if (!ictx->migration_info.empty()) {
       lderr(cct) << "cannot move migrating image to trash" << dendl;
-      ictx->snap_lock.put_read();
+      ictx->image_lock.put_read();
       ictx->state->close();
       return -EBUSY;
     }
-    ictx->snap_lock.put_read();
+    ictx->image_lock.put_read();
 
     r = disable_mirroring<I>(ictx);
     if (r < 0) {
index adf6b31d90b7aa058670b8a3871e2d07e522d76e..698a28bdf3478f8ac0eb0ddb7152f9d698962877 100644 (file)
@@ -190,9 +190,9 @@ bool ObjectCacherObjectDispatch<I>::read(
   on_dispatched = util::create_async_context_callback(*m_image_ctx,
                                                       on_dispatched);
 
-  m_image_ctx->snap_lock.get_read();
+  m_image_ctx->image_lock.get_read();
   auto rd = m_object_cacher->prepare_read(snap_id, read_data, op_flags);
-  m_image_ctx->snap_lock.put_read();
+  m_image_ctx->image_lock.put_read();
 
   ObjectExtent extent(oid, object_no, object_off, object_len, 0);
   extent.oloc.pool = m_image_ctx->data_ctx.get_id();
@@ -267,10 +267,10 @@ bool ObjectCacherObjectDispatch<I>::write(
   on_dispatched = util::create_async_context_callback(*m_image_ctx,
                                                       on_dispatched);
 
-  m_image_ctx->snap_lock.get_read();
+  m_image_ctx->image_lock.get_read();
   ObjectCacher::OSDWrite *wr = m_object_cacher->prepare_write(
     snapc, data, ceph::real_time::min(), op_flags, *journal_tid);
-  m_image_ctx->snap_lock.put_read();
+  m_image_ctx->image_lock.put_read();
 
   ObjectExtent extent(oid, 0, object_off, data.length(), 0);
   extent.oloc.pool = m_image_ctx->data_ctx.get_id();
index 246db499f72fcfdf4b4ce061671589cbd1901764..10414e64c3eacc186325666e6218c7ec1a1e5104 100644 (file)
@@ -147,13 +147,13 @@ bool ObjectCacherWriteback::may_copy_on_write(const object_t& oid,
                                               uint64_t read_len,
                                               snapid_t snapid)
 {
-  m_ictx->snap_lock.get_read();
+  m_ictx->image_lock.get_read();
   librados::snap_t snap_id = m_ictx->snap_id;
   m_ictx->parent_lock.get_read();
   uint64_t overlap = 0;
   m_ictx->get_parent_overlap(snap_id, &overlap);
   m_ictx->parent_lock.put_read();
-  m_ictx->snap_lock.put_read();
+  m_ictx->image_lock.put_read();
 
   uint64_t object_no = oid_to_object_no(oid.name, m_ictx->object_prefix);
 
index bcf9970bf589d251389afb38ceecb39c2578110c..2f0ff231bfa3e548363912a617a43f647c919d68 100644 (file)
@@ -68,7 +68,7 @@ void ImageCopyRequest<I>::send_object_copies() {
 
   uint64_t size;
   {
-    RWLock::RLocker snap_locker(m_src_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(m_src_image_ctx->image_lock);
     size =  m_src_image_ctx->get_image_size(CEPH_NOSNAP);
     for (auto snap_id : m_src_image_ctx->snaps) {
       size = std::max(size, m_src_image_ctx->get_image_size(snap_id));
index b28fde452b2c0dcef61e65ff77047ee785bbdf88..2fe039b23c62c2bf648751cef1b1ff2e8d40511e 100644 (file)
@@ -224,11 +224,11 @@ void ObjectCopyRequest<I>::handle_read_object(int r) {
 
 template <typename I>
 void ObjectCopyRequest<I>::send_read_from_parent() {
-  m_src_image_ctx->snap_lock.get_read();
+  m_src_image_ctx->image_lock.get_read();
   m_src_image_ctx->parent_lock.get_read();
   io::Extents image_extents;
   compute_read_from_parent_ops(&image_extents);
-  m_src_image_ctx->snap_lock.put_read();
+  m_src_image_ctx->image_lock.put_read();
 
   if (image_extents.empty()) {
     m_src_image_ctx->parent_lock.put_read();
@@ -438,12 +438,12 @@ void ObjectCopyRequest<I>::send_update_object_map() {
   }
 
   m_dst_image_ctx->owner_lock.get_read();
-  m_dst_image_ctx->snap_lock.get_read();
+  m_dst_image_ctx->image_lock.get_read();
   if (m_dst_image_ctx->object_map == nullptr) {
     // possible that exclusive lock was lost in background
     lderr(m_cct) << "object map is not initialized" << dendl;
 
-    m_dst_image_ctx->snap_lock.put_read();
+    m_dst_image_ctx->image_lock.put_read();
     m_dst_image_ctx->owner_lock.put_read();
     finish(-EINVAL);
     return;
@@ -463,7 +463,7 @@ void ObjectCopyRequest<I>::send_update_object_map() {
   auto finish_op_ctx = start_lock_op(m_dst_image_ctx->owner_lock, &r);
   if (finish_op_ctx == nullptr) {
     lderr(m_cct) << "lost exclusive lock" << dendl;
-    m_dst_image_ctx->snap_lock.put_read();
+    m_dst_image_ctx->image_lock.put_read();
     m_dst_image_ctx->owner_lock.put_read();
     finish(r);
     return;
@@ -482,7 +482,7 @@ void ObjectCopyRequest<I>::send_update_object_map() {
 
   // NOTE: state machine might complete before we reach here
   dst_image_ctx->object_map_lock.put_write();
-  dst_image_ctx->snap_lock.put_read();
+  dst_image_ctx->image_lock.put_read();
   dst_image_ctx->owner_lock.put_read();
   if (!sent) {
     ceph_assert(dst_snap_id == CEPH_NOSNAP);
@@ -717,7 +717,7 @@ void ObjectCopyRequest<I>::compute_read_ops() {
 template <typename I>
 void ObjectCopyRequest<I>::compute_read_from_parent_ops(
     io::Extents *parent_image_extents) {
-  assert(m_src_image_ctx->snap_lock.is_locked());
+  assert(m_src_image_ctx->image_lock.is_locked());
   assert(m_src_image_ctx->parent_lock.is_locked());
 
   m_read_ops = {};
@@ -873,7 +873,7 @@ void ObjectCopyRequest<I>::compute_zero_ops() {
     }
 
     if (hide_parent) {
-      RWLock::RLocker snap_locker(m_dst_image_ctx->snap_lock);
+      RWLock::RLocker image_locker(m_dst_image_ctx->image_lock);
       RWLock::RLocker parent_locker(m_dst_image_ctx->parent_lock);
       uint64_t parent_overlap = 0;
       int r = m_dst_image_ctx->get_parent_overlap(dst_snap_seq, &parent_overlap);
@@ -972,7 +972,7 @@ void ObjectCopyRequest<I>::finish(int r) {
 
 template <typename I>
 void ObjectCopyRequest<I>::compute_dst_object_may_exist() {
-  RWLock::RLocker snap_locker(m_dst_image_ctx->snap_lock);
+  RWLock::RLocker image_locker(m_dst_image_ctx->image_lock);
 
   auto snap_ids = m_dst_image_ctx->snaps;
   snap_ids.push_back(CEPH_NOSNAP);
index 5670ba07505bc4d870e69b5992b72784fdda346f..3d896ad06af838f8bf3d6426f190b225fa203d63 100644 (file)
@@ -39,13 +39,13 @@ void SetHeadRequest<I>::send() {
 
 template <typename I>
 void SetHeadRequest<I>::send_set_size() {
-  m_image_ctx->snap_lock.get_read();
+  m_image_ctx->image_lock.get_read();
   if (m_image_ctx->size == m_size) {
-    m_image_ctx->snap_lock.put_read();
+    m_image_ctx->image_lock.put_read();
     send_detach_parent();
     return;
   }
-  m_image_ctx->snap_lock.put_read();
+  m_image_ctx->image_lock.put_read();
 
   ldout(m_cct, 20) << dendl;
 
@@ -87,7 +87,7 @@ void SetHeadRequest<I>::handle_set_size(int r) {
 
   {
     // adjust in-memory image size now that it's updated on disk
-    RWLock::WLocker snap_locker(m_image_ctx->snap_lock);
+    RWLock::WLocker image_locker(m_image_ctx->image_lock);
     if (m_image_ctx->size > m_size) {
       RWLock::WLocker parent_locker(m_image_ctx->parent_lock);
       if (m_image_ctx->parent_md.spec.pool_id != -1 &&
index db24ca72ecf3b19fe9b3b508b562a29bd17fe8d1..de57ddb144b163221d7f2e03d5b16e11ac66683b 100644 (file)
@@ -104,18 +104,18 @@ void SnapshotCopyRequest<I>::send_snap_unprotect() {
   for (; snap_id_it != m_dst_snap_ids.end(); ++snap_id_it) {
     librados::snap_t dst_snap_id = *snap_id_it;
 
-    m_dst_image_ctx->snap_lock.get_read();
+    m_dst_image_ctx->image_lock.get_read();
 
     bool dst_unprotected;
     int r = m_dst_image_ctx->is_snap_unprotected(dst_snap_id, &dst_unprotected);
     if (r < 0) {
       lderr(m_cct) << "failed to retrieve destination snap unprotect status: "
            << cpp_strerror(r) << dendl;
-      m_dst_image_ctx->snap_lock.put_read();
+      m_dst_image_ctx->image_lock.put_read();
       finish(r);
       return;
     }
-    m_dst_image_ctx->snap_lock.put_read();
+    m_dst_image_ctx->image_lock.put_read();
 
     if (dst_unprotected) {
       // snap is already unprotected -- check next snap
@@ -131,7 +131,7 @@ void SnapshotCopyRequest<I>::send_snap_unprotect() {
       });
 
     if (snap_seq_it != m_snap_seqs.end()) {
-      m_src_image_ctx->snap_lock.get_read();
+      m_src_image_ctx->image_lock.get_read();
       bool src_unprotected;
       r = m_src_image_ctx->is_snap_unprotected(snap_seq_it->first,
                                                &src_unprotected);
@@ -145,11 +145,11 @@ void SnapshotCopyRequest<I>::send_snap_unprotect() {
       if (r < 0) {
         lderr(m_cct) << "failed to retrieve source snap unprotect status: "
                      << cpp_strerror(r) << dendl;
-        m_src_image_ctx->snap_lock.put_read();
+        m_src_image_ctx->image_lock.put_read();
         finish(r);
         return;
       }
-      m_src_image_ctx->snap_lock.put_read();
+      m_src_image_ctx->image_lock.put_read();
 
       if (src_unprotected) {
         // source is unprotected -- unprotect destination snap
@@ -204,7 +204,7 @@ void SnapshotCopyRequest<I>::handle_snap_unprotect(int r) {
 
   {
     // avoid the need to refresh to delete the newly unprotected snapshot
-    RWLock::RLocker snap_locker(m_dst_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(m_dst_image_ctx->image_lock);
     auto snap_info_it = m_dst_image_ctx->snap_info.find(m_prev_snap_id);
     if (snap_info_it != m_dst_image_ctx->snap_info.end()) {
       snap_info_it->second.protection_status =
@@ -230,9 +230,9 @@ void SnapshotCopyRequest<I>::send_snap_remove() {
     librados::snap_t dst_snap_id = *snap_id_it;
 
     cls::rbd::SnapshotNamespace snap_namespace;
-    m_dst_image_ctx->snap_lock.get_read();
+    m_dst_image_ctx->image_lock.get_read();
     int r = m_dst_image_ctx->get_snap_namespace(dst_snap_id, &snap_namespace);
-    m_dst_image_ctx->snap_lock.put_read();
+    m_dst_image_ctx->image_lock.put_read();
     if (r < 0) {
       lderr(m_cct) << "failed to retrieve destination snap namespace: "
                    << m_snap_name << dendl;
@@ -316,9 +316,9 @@ void SnapshotCopyRequest<I>::send_snap_create() {
     librados::snap_t src_snap_id = *snap_id_it;
 
     cls::rbd::SnapshotNamespace snap_namespace;
-    m_src_image_ctx->snap_lock.get_read();
+    m_src_image_ctx->image_lock.get_read();
     int r = m_src_image_ctx->get_snap_namespace(src_snap_id, &snap_namespace);
-    m_src_image_ctx->snap_lock.put_read();
+    m_src_image_ctx->image_lock.put_read();
     if (r < 0) {
       lderr(m_cct) << "failed to retrieve source snap namespace: "
                    << m_snap_name << dendl;
@@ -343,10 +343,10 @@ void SnapshotCopyRequest<I>::send_snap_create() {
   m_prev_snap_id = *snap_id_it;
   m_snap_name = get_snapshot_name(m_src_image_ctx, m_prev_snap_id);
 
-  m_src_image_ctx->snap_lock.get_read();
+  m_src_image_ctx->image_lock.get_read();
   auto snap_info_it = m_src_image_ctx->snap_info.find(m_prev_snap_id);
   if (snap_info_it == m_src_image_ctx->snap_info.end()) {
-    m_src_image_ctx->snap_lock.put_read();
+    m_src_image_ctx->image_lock.put_read();
     lderr(m_cct) << "failed to retrieve source snap info: " << m_snap_name
                  << dendl;
     finish(-ENOENT);
@@ -361,7 +361,7 @@ void SnapshotCopyRequest<I>::send_snap_create() {
     parent_spec = m_dst_parent_spec;
     parent_overlap = snap_info_it->second.parent.overlap;
   }
-  m_src_image_ctx->snap_lock.put_read();
+  m_src_image_ctx->image_lock.put_read();
 
   ldout(m_cct, 20) << "snap_name=" << m_snap_name << ", "
                    << "snap_id=" << m_prev_snap_id << ", "
@@ -428,18 +428,18 @@ void SnapshotCopyRequest<I>::send_snap_protect() {
   for (; snap_id_it != m_src_snap_ids.end(); ++snap_id_it) {
     librados::snap_t src_snap_id = *snap_id_it;
 
-    m_src_image_ctx->snap_lock.get_read();
+    m_src_image_ctx->image_lock.get_read();
 
     bool src_protected;
     int r = m_src_image_ctx->is_snap_protected(src_snap_id, &src_protected);
     if (r < 0) {
       lderr(m_cct) << "failed to retrieve source snap protect status: "
                    << cpp_strerror(r) << dendl;
-      m_src_image_ctx->snap_lock.put_read();
+      m_src_image_ctx->image_lock.put_read();
       finish(r);
       return;
     }
-    m_src_image_ctx->snap_lock.put_read();
+    m_src_image_ctx->image_lock.put_read();
 
     if (!src_protected) {
       // snap is not protected -- check next snap
@@ -450,17 +450,17 @@ void SnapshotCopyRequest<I>::send_snap_protect() {
     auto snap_seq_it = m_snap_seqs.find(src_snap_id);
     ceph_assert(snap_seq_it != m_snap_seqs.end());
 
-    m_dst_image_ctx->snap_lock.get_read();
+    m_dst_image_ctx->image_lock.get_read();
     bool dst_protected;
     r = m_dst_image_ctx->is_snap_protected(snap_seq_it->second, &dst_protected);
     if (r < 0) {
       lderr(m_cct) << "failed to retrieve destination snap protect status: "
                    << cpp_strerror(r) << dendl;
-      m_dst_image_ctx->snap_lock.put_read();
+      m_dst_image_ctx->image_lock.put_read();
       finish(r);
       return;
     }
-    m_dst_image_ctx->snap_lock.put_read();
+    m_dst_image_ctx->image_lock.put_read();
 
     if (!dst_protected) {
       break;
@@ -527,7 +527,7 @@ void SnapshotCopyRequest<I>::send_set_head() {
   cls::rbd::ParentImageSpec parent_spec;
   uint64_t parent_overlap = 0;
   {
-    RWLock::RLocker src_locker(m_src_image_ctx->snap_lock);
+    RWLock::RLocker src_locker(m_src_image_ctx->image_lock);
     size = m_src_image_ctx->size;
     if (!m_flatten) {
       parent_spec = m_src_image_ctx->parent_md.spec;
@@ -566,7 +566,7 @@ void SnapshotCopyRequest<I>::send_resize_object_map() {
   if (m_snap_id_end == CEPH_NOSNAP &&
       m_dst_image_ctx->test_features(RBD_FEATURE_OBJECT_MAP)) {
     RWLock::RLocker owner_locker(m_dst_image_ctx->owner_lock);
-    RWLock::RLocker snap_locker(m_dst_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(m_dst_image_ctx->image_lock);
 
     if (m_dst_image_ctx->object_map != nullptr &&
         Striper::get_num_objects(m_dst_image_ctx->layout,
@@ -632,7 +632,7 @@ template <typename I>
 int SnapshotCopyRequest<I>::validate_parent(I *image_ctx,
                                             cls::rbd::ParentImageSpec *spec) {
   RWLock::RLocker owner_locker(image_ctx->owner_lock);
-  RWLock::RLocker snap_locker(image_ctx->snap_lock);
+  RWLock::RLocker image_locker(image_ctx->image_lock);
 
   // ensure source image's parent specs are still consistent
   *spec = image_ctx->parent_md.spec;
index 0ff9c8325fa592ac32c660c50ca0653f5fe3e17a..2d5fc58d8d6048ac01e102a32afa0b7df8100b6d 100644 (file)
@@ -108,17 +108,17 @@ void SnapshotCreateRequest<I>::send_create_object_map() {
     return;
   }
 
-  m_dst_image_ctx->snap_lock.get_read();
+  m_dst_image_ctx->image_lock.get_read();
   auto snap_it = m_dst_image_ctx->snap_ids.find(
     {cls::rbd::UserSnapshotNamespace(), m_snap_name});
   if (snap_it == m_dst_image_ctx->snap_ids.end()) {
     lderr(m_cct) << "failed to locate snap: " << m_snap_name << dendl;
-    m_dst_image_ctx->snap_lock.put_read();
+    m_dst_image_ctx->image_lock.put_read();
     finish(-ENOENT);
     return;
   }
   librados::snap_t local_snap_id = snap_it->second;
-  m_dst_image_ctx->snap_lock.put_read();
+  m_dst_image_ctx->image_lock.put_read();
 
   std::string object_map_oid(librbd::ObjectMap<>::object_map_name(
     m_dst_image_ctx->id, local_snap_id));
index 7e67e41c2b6e5dbaf555ba0af6b1ee29e7fb36e1..3d20d4b2aa0207ac53eef6823c81c95e1c897c7c 100644 (file)
@@ -108,9 +108,9 @@ void PostAcquireRequest<I>::send_open_journal() {
 
   bool journal_enabled;
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     journal_enabled = (m_image_ctx.test_features(RBD_FEATURE_JOURNALING,
-                                                 m_image_ctx.snap_lock) &&
+                                                 m_image_ctx.image_lock) &&
                        !m_image_ctx.get_journal_policy()->journal_disabled());
   }
   if (!journal_enabled) {
@@ -153,7 +153,7 @@ void PostAcquireRequest<I>::send_allocate_journal_tag() {
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 10) << dendl;
 
-  RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::RLocker image_locker(m_image_ctx.image_lock);
   using klass = PostAcquireRequest<I>;
   Context *ctx = create_context_callback<
     klass, &klass::handle_allocate_journal_tag>(this);
@@ -272,7 +272,7 @@ void PostAcquireRequest<I>::handle_close_object_map(int r) {
 template <typename I>
 void PostAcquireRequest<I>::apply() {
   {
-    RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::WLocker image_locker(m_image_ctx.image_lock);
     ceph_assert(m_image_ctx.object_map == nullptr);
     m_image_ctx.object_map = m_object_map;
 
@@ -286,7 +286,7 @@ void PostAcquireRequest<I>::apply() {
 
 template <typename I>
 void PostAcquireRequest<I>::revert() {
-  RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::WLocker image_locker(m_image_ctx.image_lock);
   m_image_ctx.object_map = nullptr;
   m_image_ctx.journal = nullptr;
 
index 7dbae6c5992e417a625ad72ed5796c98fb222d02..346c4f39e0d365fd12f6c7cfca67cc1814b94871 100644 (file)
@@ -212,7 +212,7 @@ void PreReleaseRequest<I>::handle_flush_notifies(int r) {
 template <typename I>
 void PreReleaseRequest<I>::send_close_journal() {
   {
-    RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::WLocker image_locker(m_image_ctx.image_lock);
     std::swap(m_journal, m_image_ctx.journal);
   }
 
@@ -248,7 +248,7 @@ void PreReleaseRequest<I>::handle_close_journal(int r) {
 template <typename I>
 void PreReleaseRequest<I>::send_close_object_map() {
   {
-    RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::WLocker image_locker(m_image_ctx.image_lock);
     std::swap(m_object_map, m_image_ctx.object_map);
   }
 
index bedeeca01563720c010b60234b4f83f53b93a5d8..ac709aa0f3e7a6eb465702acdf5f44684d2b2b6f 100644 (file)
@@ -93,7 +93,7 @@ void AttachChildRequest<I>::handle_v1_refresh(int r) {
 
   bool snap_protected = false;
   if (r == 0) {
-    RWLock::RLocker snap_locker(m_parent_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(m_parent_image_ctx->image_lock);
     r = m_parent_image_ctx->is_snap_protected(m_parent_snap_id,
                                               &snap_protected);
   }
index 24da545113079f5c9d41a10e4f38616e67c460bb..d430680aed87c2a884b27dcb31868773701379a5 100644 (file)
@@ -189,13 +189,13 @@ void CloneRequest<I>::validate_parent() {
     return;
   }
 
-  m_parent_image_ctx->snap_lock.get_read();
+  m_parent_image_ctx->image_lock.get_read();
   uint64_t p_features = m_parent_image_ctx->features;
   m_size = m_parent_image_ctx->get_image_size(m_parent_image_ctx->snap_id);
 
   bool snap_protected;
   int r = m_parent_image_ctx->is_snap_protected(m_parent_image_ctx->snap_id, &snap_protected);
-  m_parent_image_ctx->snap_lock.put_read();
+  m_parent_image_ctx->image_lock.put_read();
 
   if ((p_features & RBD_FEATURE_LAYERING) != RBD_FEATURE_LAYERING) {
     lderr(m_cct) << "parent image must support layering" << dendl;
@@ -276,7 +276,7 @@ void CloneRequest<I>::create_child() {
   Context *ctx = create_context_callback<
     klass, &klass::handle_create_child>(this);
 
-  RWLock::RLocker snap_locker(m_parent_image_ctx->snap_lock);
+  RWLock::RLocker image_locker(m_parent_image_ctx->image_lock);
   CreateRequest<I> *req = CreateRequest<I>::create(
     m_config, m_ioctx, m_name, m_id, m_size, m_opts,
     m_non_primary_global_image_id, m_primary_mirror_uuid, true,
index d114c401862b2a82730eff94e0a4dbd97960f0b0..15f9d306c9bc43492a814a8bda651b5e44a9dd53 100644 (file)
@@ -109,7 +109,7 @@ void CloseRequest<I>::send_shut_down_exclusive_lock() {
     m_exclusive_lock = m_image_ctx->exclusive_lock;
 
     // if reading a snapshot -- possible object map is open
-    RWLock::WLocker snap_locker(m_image_ctx->snap_lock);
+    RWLock::WLocker image_locker(m_image_ctx->image_lock);
     if (m_exclusive_lock == nullptr) {
       delete m_image_ctx->object_map;
       m_image_ctx->object_map = nullptr;
@@ -140,7 +140,7 @@ void CloseRequest<I>::handle_shut_down_exclusive_lock(int r) {
     ceph_assert(m_image_ctx->exclusive_lock == nullptr);
 
     // object map and journal closed during exclusive lock shutdown
-    RWLock::RLocker snap_locker(m_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx->image_lock);
     ceph_assert(m_image_ctx->journal == nullptr);
     ceph_assert(m_image_ctx->object_map == nullptr);
   }
index 39221e1b25dc86a8b68a27a38a4ef474cdb65c78..33f9c215cb924bc74a7e173db25de21c2fdf2a22 100644 (file)
@@ -32,7 +32,7 @@ DetachChildRequest<I>::~DetachChildRequest() {
 template <typename I>
 void DetachChildRequest<I>::send() {
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     RWLock::RLocker parent_locker(m_image_ctx.parent_lock);
 
     // use oldest snapshot or HEAD for parent spec
index 3024f03a610aed269ed670315bf78fb6979e1050..325107d9e2efa7884e0b58b56e5b6fd737c75d59 100644 (file)
@@ -602,7 +602,7 @@ Context *OpenRequest<I>::send_set_snap(int *result) {
   uint64_t snap_id = CEPH_NOSNAP;
   std::swap(m_image_ctx->open_snap_id, snap_id);
   if (snap_id == CEPH_NOSNAP) {
-    RWLock::RLocker snap_locker(m_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx->image_lock);
     snap_id = m_image_ctx->get_snap_id(m_image_ctx->snap_namespace,
                                        m_image_ctx->snap_name);
   }
index 48e89e5b5f2df67c971cb5de8b40168d9cfacf23..5c664c217279c2328cd901d4d853f30ef81931a3 100644 (file)
@@ -64,7 +64,7 @@ void PreRemoveRequest<I>::acquire_exclusive_lock() {
   // do not attempt to open the journal when removing the image in case
   // it's corrupt
   if (m_image_ctx->test_features(RBD_FEATURE_JOURNALING)) {
-    RWLock::WLocker snap_locker(m_image_ctx->snap_lock);
+    RWLock::WLocker image_locker(m_image_ctx->image_lock);
     m_image_ctx->set_journal_policy(new journal::DisabledPolicy());
   }
 
@@ -136,19 +136,19 @@ void PreRemoveRequest<I>::check_image_snaps() {
   auto cct = m_image_ctx->cct;
   ldout(cct, 5) << dendl;
 
-  m_image_ctx->snap_lock.get_read();
+  m_image_ctx->image_lock.get_read();
   for (auto& snap_info : m_image_ctx->snap_info) {
     if (auto_delete_snapshot(snap_info.second)) {
       m_snap_infos.insert(snap_info);
     } else {
-      m_image_ctx->snap_lock.put_read();
+      m_image_ctx->image_lock.put_read();
 
       ldout(cct, 5) << "image has snapshots - not removing" << dendl;
       finish(-ENOTEMPTY);
       return;
     }
   }
-  m_image_ctx->snap_lock.put_read();
+  m_image_ctx->image_lock.put_read();
 
   list_image_watchers();
 }
index 668ad56bc14df6f1b69439fbbddb2d34326d2da6..e6b16e092c1e68da5d4ee6086c1885272b1fd5dd 100644 (file)
@@ -36,7 +36,7 @@ template <typename I>
 bool RefreshParentRequest<I>::is_refresh_required(
     I &child_image_ctx, const ParentImageInfo &parent_md,
     const MigrationInfo &migration_info) {
-  ceph_assert(child_image_ctx.snap_lock.is_locked());
+  ceph_assert(child_image_ctx.image_lock.is_locked());
   ceph_assert(child_image_ctx.parent_lock.is_locked());
   return (is_open_required(child_image_ctx, parent_md, migration_info) ||
           is_close_required(child_image_ctx, parent_md, migration_info));
@@ -90,7 +90,7 @@ void RefreshParentRequest<I>::send() {
 
 template <typename I>
 void RefreshParentRequest<I>::apply() {
-  ceph_assert(m_child_image_ctx.snap_lock.is_wlocked());
+  ceph_assert(m_child_image_ctx.image_lock.is_wlocked());
   ceph_assert(m_child_image_ctx.parent_lock.is_wlocked());
   std::swap(m_child_image_ctx.parent, m_parent_image_ctx);
 }
index d3777c61011133b7627bf1d11b06dfb2fb437d89..04db922d34caafb3edf3b9576c839c4a8a717e8a 100644 (file)
@@ -336,7 +336,7 @@ void RefreshRequest<I>::send_v2_get_mutable_metadata() {
 
   uint64_t snap_id;
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     snap_id = m_image_ctx.snap_id;
   }
 
@@ -807,7 +807,7 @@ Context *RefreshRequest<I>::handle_v2_get_snapshots(int *result) {
 template <typename I>
 void RefreshRequest<I>::send_v2_refresh_parent() {
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     RWLock::RLocker parent_locker(m_image_ctx.parent_lock);
 
     ParentImageInfo parent_md;
@@ -903,7 +903,7 @@ void RefreshRequest<I>::send_v2_open_journal() {
      !m_image_ctx.exclusive_lock->is_lock_owner());
   bool journal_disabled_by_policy;
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     journal_disabled_by_policy = (
       !journal_disabled &&
       m_image_ctx.get_journal_policy()->journal_disabled());
@@ -955,7 +955,7 @@ template <typename I>
 void RefreshRequest<I>::send_v2_block_writes() {
   bool disabled_journaling = false;
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     disabled_journaling = ((m_features & RBD_FEATURE_EXCLUSIVE_LOCK) != 0 &&
                            (m_features & RBD_FEATURE_JOURNALING) == 0 &&
                            m_image_ctx.journal != nullptr);
@@ -1285,7 +1285,7 @@ void RefreshRequest<I>::apply() {
   RWLock::WLocker md_locker(m_image_ctx.md_lock);
 
   {
-    RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::WLocker image_locker(m_image_ctx.image_lock);
     RWLock::WLocker parent_locker(m_image_ctx.parent_lock);
 
     m_image_ctx.size = m_size;
@@ -1391,7 +1391,7 @@ void RefreshRequest<I>::apply() {
     // handle dynamically enabled / disabled features
     if (m_image_ctx.exclusive_lock != nullptr &&
         !m_image_ctx.test_features(RBD_FEATURE_EXCLUSIVE_LOCK,
-                                   m_image_ctx.snap_lock)) {
+                                   m_image_ctx.image_lock)) {
       // disabling exclusive lock will automatically handle closing
       // object map and journaling
       ceph_assert(m_exclusive_lock == nullptr);
@@ -1402,7 +1402,7 @@ void RefreshRequest<I>::apply() {
         std::swap(m_exclusive_lock, m_image_ctx.exclusive_lock);
       }
       if (!m_image_ctx.test_features(RBD_FEATURE_JOURNALING,
-                                     m_image_ctx.snap_lock)) {
+                                     m_image_ctx.image_lock)) {
         if (!m_image_ctx.clone_copy_on_read && m_image_ctx.journal != nullptr) {
           m_image_ctx.io_work_queue->set_require_lock(io::DIRECTION_READ,
                                                       false);
@@ -1412,7 +1412,7 @@ void RefreshRequest<I>::apply() {
         std::swap(m_journal, m_image_ctx.journal);
       }
       if (!m_image_ctx.test_features(RBD_FEATURE_OBJECT_MAP,
-                                     m_image_ctx.snap_lock) ||
+                                     m_image_ctx.image_lock) ||
           m_object_map != nullptr) {
         std::swap(m_object_map, m_image_ctx.object_map);
       }
index a18c749948a8323ef21aae35a0685b0023a78125..22b009008a1b6b3e674b86cc834ad48a0360e25e 100644 (file)
@@ -36,7 +36,7 @@ void SetFlagsRequest<I>::send_set_flags() {
   CephContext *cct = m_image_ctx->cct;
   ldout(cct, 20) << __func__ << dendl;
 
-  RWLock::WLocker snap_locker(m_image_ctx->snap_lock);
+  RWLock::WLocker image_locker(m_image_ctx->image_lock);
   std::vector<uint64_t> snap_ids;
   snap_ids.push_back(CEPH_NOSNAP);
   for (auto it : m_image_ctx->snap_info) {
index f342147f35e5dfd0a5da93fb4beb3697011ced5c..bf017e5ab0eca08af605d64f22e452b60aeac367 100644 (file)
@@ -48,7 +48,7 @@ void SetSnapRequest<I>::send() {
 template <typename I>
 void SetSnapRequest<I>::send_init_exclusive_lock() {
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     if (m_image_ctx.exclusive_lock != nullptr) {
       ceph_assert(m_image_ctx.snap_id == CEPH_NOSNAP);
       send_complete();
@@ -120,7 +120,7 @@ Context *SetSnapRequest<I>::handle_block_writes(int *result) {
   }
 
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     auto it = m_image_ctx.snap_info.find(m_snap_id);
     if (it == m_image_ctx.snap_info.end()) {
       ldout(cct, 5) << "failed to locate snapshot '" << m_snap_id << "'"
@@ -138,7 +138,7 @@ Context *SetSnapRequest<I>::handle_block_writes(int *result) {
 template <typename I>
 Context *SetSnapRequest<I>::send_shut_down_exclusive_lock(int *result) {
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     m_exclusive_lock = m_image_ctx.exclusive_lock;
   }
 
@@ -178,7 +178,7 @@ Context *SetSnapRequest<I>::send_refresh_parent(int *result) {
   ParentImageInfo parent_md;
   bool refresh_parent;
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     RWLock::RLocker parent_locker(m_image_ctx.parent_lock);
 
     const auto parent_info = m_image_ctx.get_parent_info(m_snap_id);
@@ -325,7 +325,7 @@ int SetSnapRequest<I>::apply() {
   ldout(cct, 10) << __func__ << dendl;
 
   RWLock::WLocker owner_locker(m_image_ctx.owner_lock);
-  RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::WLocker image_locker(m_image_ctx.image_lock);
   RWLock::WLocker parent_locker(m_image_ctx.parent_lock);
   if (m_snap_id != CEPH_NOSNAP) {
     ceph_assert(m_image_ctx.exclusive_lock == nullptr);
index 8b499c283da6446c190f3303b9cb6def1d5bead5..963e7811250e2537bfd4aa3c8c787fee7a9daa51 100644 (file)
@@ -172,9 +172,9 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
   void image_info(ImageCtx *ictx, image_info_t& info, size_t infosize)
   {
     int obj_order = ictx->order;
-    ictx->snap_lock.get_read();
+    ictx->image_lock.get_read();
     info.size = ictx->get_image_size(ictx->snap_id);
-    ictx->snap_lock.put_read();
+    ictx->image_lock.put_read();
     info.obj_size = 1ULL << obj_order;
     info.num_objs = Striper::get_num_objects(ictx->layout, info.size);
     info.order = obj_order;
@@ -204,10 +204,10 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
                 ictx->exclusive_lock->is_lock_owner());
 
     C_SaferCond ctx;
-    ictx->snap_lock.get_read();
+    ictx->image_lock.get_read();
     operation::TrimRequest<> *req = operation::TrimRequest<>::create(
       *ictx, &ctx, ictx->size, newsize, prog_ctx);
-    ictx->snap_lock.put_read();
+    ictx->image_lock.put_read();
     req->send();
 
     int r = ctx.wait();
@@ -521,7 +521,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
       return r;
     }
 
-    RWLock::RLocker l(ictx->snap_lock);
+    RWLock::RLocker l(ictx->image_lock);
     snap_t snap_id = ictx->get_snap_id(cls::rbd::UserSnapshotNamespace(),
                                        snap_name);
 
@@ -606,7 +606,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
     int r = ictx->state->refresh_if_required();
     if (r < 0)
       return r;
-    RWLock::RLocker l(ictx->snap_lock);
+    RWLock::RLocker l(ictx->image_lock);
     snap_t snap_id = ictx->get_snap_id(*snap_namespace, snap_name);
     if (snap_id == CEPH_NOSNAP)
       return -ENOENT;
@@ -623,7 +623,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
     if (r < 0)
       return r;
 
-    RWLock::RLocker l(ictx->snap_lock);
+    RWLock::RLocker l(ictx->image_lock);
     snap_t snap_id = ictx->get_snap_id(cls::rbd::UserSnapshotNamespace(), snap_name);
     if (snap_id == CEPH_NOSNAP)
       return -ENOENT;
@@ -954,7 +954,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
     int r = ictx->state->refresh_if_required();
     if (r < 0)
       return r;
-    RWLock::RLocker l2(ictx->snap_lock);
+    RWLock::RLocker l2(ictx->image_lock);
     *size = ictx->get_image_size(ictx->snap_id);
     return 0;
   }
@@ -964,7 +964,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
     int r = ictx->state->refresh_if_required();
     if (r < 0)
       return r;
-    RWLock::RLocker l(ictx->snap_lock);
+    RWLock::RLocker l(ictx->image_lock);
     *features = ictx->features;
     return 0;
   }
@@ -974,7 +974,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
     int r = ictx->state->refresh_if_required();
     if (r < 0)
       return r;
-    RWLock::RLocker l(ictx->snap_lock);
+    RWLock::RLocker l(ictx->image_lock);
     RWLock::RLocker l2(ictx->parent_lock);
     return ictx->get_parent_overlap(ictx->snap_id, overlap);
   }
@@ -986,7 +986,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
       return r;
     }
 
-    RWLock::RLocker l2(ictx->snap_lock);
+    RWLock::RLocker l2(ictx->image_lock);
     return ictx->get_flags(ictx->snap_id, flags);
   }
 
@@ -1203,7 +1203,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
     if (r < 0)
       return r;
 
-    RWLock::RLocker l(ictx->snap_lock);
+    RWLock::RLocker l(ictx->image_lock);
     for (map<snap_t, SnapInfo>::iterator it = ictx->snap_info.begin();
         it != ictx->snap_info.end(); ++it) {
       snap_info_t info;
@@ -1225,7 +1225,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
     if (r < 0)
       return r;
 
-    RWLock::RLocker l(ictx->snap_lock);
+    RWLock::RLocker l(ictx->image_lock);
     *exists = ictx->get_snap_id(snap_namespace, snap_name) != CEPH_NOSNAP;
     return 0;
   }
@@ -1327,10 +1327,10 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
                   << (src->snap_name.length() ? "@" + src->snap_name : "")
                   << " -> " << destname << " opts = " << opts << dendl;
 
-    src->snap_lock.get_read();
+    src->image_lock.get_read();
     uint64_t features = src->features;
     uint64_t src_size = src->get_image_size(src->snap_id);
-    src->snap_lock.put_read();
+    src->image_lock.put_read();
     uint64_t format = src->old_format ? 1 : 2;
     if (opts.get(RBD_IMAGE_OPTION_FORMAT, &format) != 0) {
       opts.set(RBD_IMAGE_OPTION_FORMAT, format);
@@ -1472,13 +1472,13 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
 
   int copy(ImageCtx *src, ImageCtx *dest, ProgressContext &prog_ctx, size_t sparse_size)
   {
-    src->snap_lock.get_read();
+    src->image_lock.get_read();
     uint64_t src_size = src->get_image_size(src->snap_id);
-    src->snap_lock.put_read();
+    src->image_lock.put_read();
 
-    dest->snap_lock.get_read();
+    dest->image_lock.get_read();
     uint64_t dest_size = dest->get_image_size(dest->snap_id);
-    dest->snap_lock.put_read();
+    dest->image_lock.put_read();
 
     CephContext *cct = src->cct;
     if (dest_size < src_size) {
@@ -1528,7 +1528,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
       }
 
       {
-        RWLock::RLocker snap_locker(src->snap_lock);
+        RWLock::RLocker image_locker(src->image_lock);
         if (src->object_map != nullptr) {
           bool skip = true;
           // each period is related to src->stripe_count objects, check them all
@@ -1738,9 +1738,9 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
       return r;
 
     uint64_t mylen = len;
-    ictx->snap_lock.get_read();
+    ictx->image_lock.get_read();
     r = clip_io(ictx, off, &mylen);
-    ictx->snap_lock.put_read();
+    ictx->image_lock.put_read();
     if (r < 0)
       return r;
 
@@ -1792,7 +1792,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
   // validate extent against image size; clip to image size if necessary
   int clip_io(ImageCtx *ictx, uint64_t off, uint64_t *len)
   {
-    ceph_assert(ictx->snap_lock.is_locked());
+    ceph_assert(ictx->image_lock.is_locked());
     uint64_t image_size = ictx->get_image_size(ictx->snap_id);
     bool snap_exists = ictx->snap_exists;
 
@@ -1916,10 +1916,10 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
       return;
     }
     ictx->total_bytes_read += total_bytes;
-    ictx->snap_lock.get_read();
+    ictx->image_lock.get_read();
     uint64_t image_size = ictx->get_image_size(ictx->snap_id);
     auto snap_id = ictx->snap_id;
-    ictx->snap_lock.put_read();
+    ictx->image_lock.put_read();
     ictx->md_lock.put_write();
 
     pair<uint64_t, uint64_t> readahead_extent = ictx->readahead.update(image_extents, image_size);
index 3ab44d0ec8599be139c9b4313fb45056e5951fa3..4c8f19945a0f77107972b0ac89a15f6130e0543e 100644 (file)
@@ -55,7 +55,7 @@ public:
     }
     ceph_assert(image_ctx.exclusive_lock->is_lock_owner());
 
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     if (image_ctx.object_map == nullptr) {
       return 1;
     }
@@ -80,7 +80,7 @@ public:
   int update_snapshot(uint64_t snap_id) {
     auto& image_ctx = this->m_image_ctx;
     uint8_t state = OBJECT_EXISTS;
-    if (image_ctx.test_features(RBD_FEATURE_FAST_DIFF, image_ctx.snap_lock) &&
+    if (image_ctx.test_features(RBD_FEATURE_FAST_DIFF, image_ctx.image_lock) &&
         (m_snap_id_idx > 0 || m_first_snap_is_clean)) {
       // first snapshot should be exists+dirty since it contains
       // the copyup data -- later snapshots inherit the data.
@@ -146,7 +146,7 @@ void CopyupRequest<I>::send() {
 template <typename I>
 void CopyupRequest<I>::read_from_parent() {
   auto cct = m_image_ctx->cct;
-  RWLock::RLocker snap_locker(m_image_ctx->snap_lock);
+  RWLock::RLocker image_locker(m_image_ctx->image_lock);
   RWLock::RLocker parent_locker(m_image_ctx->parent_lock);
 
   if (m_image_ctx->parent == nullptr) {
@@ -181,7 +181,7 @@ void CopyupRequest<I>::handle_read_from_parent(int r) {
   auto cct = m_image_ctx->cct;
   ldout(cct, 20) << "oid=" << m_oid << ", r=" << r << dendl;
 
-  m_image_ctx->snap_lock.get_read();
+  m_image_ctx->image_lock.get_read();
   m_lock.Lock();
   m_copyup_is_zero = m_copyup_data.is_zero();
   m_copyup_required = is_copyup_required();
@@ -189,7 +189,7 @@ void CopyupRequest<I>::handle_read_from_parent(int r) {
 
   if (r < 0 && r != -ENOENT) {
     m_lock.Unlock();
-    m_image_ctx->snap_lock.put_read();
+    m_image_ctx->image_lock.put_read();
 
     lderr(cct) << "error reading from parent: " << cpp_strerror(r) << dendl;
     finish(r);
@@ -198,7 +198,7 @@ void CopyupRequest<I>::handle_read_from_parent(int r) {
 
   if (!m_copyup_required) {
     m_lock.Unlock();
-    m_image_ctx->snap_lock.put_read();
+    m_image_ctx->image_lock.put_read();
 
     ldout(cct, 20) << "no-op, skipping" << dendl;
     finish(0);
@@ -213,7 +213,7 @@ void CopyupRequest<I>::handle_read_from_parent(int r) {
   }
 
   m_lock.Unlock();
-  m_image_ctx->snap_lock.put_read();
+  m_image_ctx->image_lock.put_read();
 
   update_object_maps();
 }
@@ -221,7 +221,7 @@ void CopyupRequest<I>::handle_read_from_parent(int r) {
 template <typename I>
 void CopyupRequest<I>::deep_copy() {
   auto cct = m_image_ctx->cct;
-  ceph_assert(m_image_ctx->snap_lock.is_locked());
+  ceph_assert(m_image_ctx->image_lock.is_locked());
   ceph_assert(m_image_ctx->parent_lock.is_locked());
   ceph_assert(m_image_ctx->parent != nullptr);
 
@@ -245,12 +245,12 @@ void CopyupRequest<I>::handle_deep_copy(int r) {
   auto cct = m_image_ctx->cct;
   ldout(cct, 20) << "oid=" << m_oid << ", r=" << r << dendl;
 
-  m_image_ctx->snap_lock.get_read();
+  m_image_ctx->image_lock.get_read();
   m_lock.Lock();
   m_copyup_required = is_copyup_required();
   if (r == -ENOENT && !m_flatten && m_copyup_required) {
     m_lock.Unlock();
-    m_image_ctx->snap_lock.put_read();
+    m_image_ctx->image_lock.put_read();
 
     ldout(cct, 10) << "restart deep-copy with flatten" << dendl;
     send();
@@ -261,7 +261,7 @@ void CopyupRequest<I>::handle_deep_copy(int r) {
 
   if (r < 0 && r != -ENOENT) {
     m_lock.Unlock();
-    m_image_ctx->snap_lock.put_read();
+    m_image_ctx->image_lock.put_read();
 
     lderr(cct) << "error encountered during deep-copy: " << cpp_strerror(r)
                << dendl;
@@ -271,7 +271,7 @@ void CopyupRequest<I>::handle_deep_copy(int r) {
 
   if (!m_copyup_required && !is_update_object_map_required(r)) {
     m_lock.Unlock();
-    m_image_ctx->snap_lock.put_read();
+    m_image_ctx->image_lock.put_read();
 
     if (r == -ENOENT) {
       r = 0;
@@ -291,7 +291,7 @@ void CopyupRequest<I>::handle_deep_copy(int r) {
   }
 
   m_lock.Unlock();
-  m_image_ctx->snap_lock.put_read();
+  m_image_ctx->image_lock.put_read();
 
   update_object_maps();
 }
@@ -299,9 +299,9 @@ void CopyupRequest<I>::handle_deep_copy(int r) {
 template <typename I>
 void CopyupRequest<I>::update_object_maps() {
   RWLock::RLocker owner_locker(m_image_ctx->owner_lock);
-  RWLock::RLocker snap_locker(m_image_ctx->snap_lock);
+  RWLock::RLocker image_locker(m_image_ctx->image_lock);
   if (m_image_ctx->object_map == nullptr) {
-    snap_locker.unlock();
+    image_locker.unlock();
     owner_locker.unlock();
 
     copyup();
@@ -315,7 +315,7 @@ void CopyupRequest<I>::update_object_maps() {
   uint8_t head_object_map_state = OBJECT_EXISTS;
   if (copy_on_read && !m_snap_ids.empty() &&
       m_image_ctx->test_features(RBD_FEATURE_FAST_DIFF,
-                                 m_image_ctx->snap_lock)) {
+                                 m_image_ctx->image_lock)) {
     // HEAD is non-dirty since data is tied to first snapshot
     head_object_map_state = OBJECT_EXISTS_CLEAN;
   }
@@ -332,7 +332,7 @@ void CopyupRequest<I>::update_object_maps() {
     m_snap_ids.push_back(CEPH_NOSNAP);
   }
   object_map_locker.unlock();
-  snap_locker.unlock();
+  image_locker.unlock();
 
   ceph_assert(m_image_ctx->exclusive_lock->is_lock_owner());
   typename AsyncObjectThrottle<I>::ContextFactory context_factory(
@@ -366,9 +366,9 @@ void CopyupRequest<I>::handle_update_object_maps(int r) {
 template <typename I>
 void CopyupRequest<I>::copyup() {
   auto cct = m_image_ctx->cct;
-  m_image_ctx->snap_lock.get_read();
+  m_image_ctx->image_lock.get_read();
   auto snapc = m_image_ctx->snapc;
-  m_image_ctx->snap_lock.put_read();
+  m_image_ctx->image_lock.put_read();
 
   m_lock.Lock();
   if (!m_copyup_required) {
@@ -549,13 +549,13 @@ bool CopyupRequest<I>::is_copyup_required() {
 
 template <typename I>
 bool CopyupRequest<I>::is_deep_copy() const {
-  ceph_assert(m_image_ctx->snap_lock.is_locked());
+  ceph_assert(m_image_ctx->image_lock.is_locked());
   return !m_image_ctx->migration_info.empty();
 }
 
 template <typename I>
 bool CopyupRequest<I>::is_update_object_map_required(int r) {
-  ceph_assert(m_image_ctx->snap_lock.is_locked());
+  ceph_assert(m_image_ctx->image_lock.is_locked());
 
   if (r < 0) {
     return false;
@@ -578,7 +578,7 @@ bool CopyupRequest<I>::is_update_object_map_required(int r) {
 
 template <typename I>
 void CopyupRequest<I>::compute_deep_copy_snap_ids() {
-  ceph_assert(m_image_ctx->snap_lock.is_locked());
+  ceph_assert(m_image_ctx->image_lock.is_locked());
 
   // don't copy ids for the snaps updated by object deep copy or
   // that don't overlap
index b4c4b794db541904c27744e3430455d88233a3d8..069bf20c86aca8e81a612b3198b85906468c0578 100644 (file)
@@ -167,7 +167,7 @@ void ImageRequest<I>::send() {
 
 template <typename I>
 int ImageRequest<I>::clip_request() {
-  RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::RLocker image_locker(m_image_ctx.image_lock);
   for (auto &image_extent : m_image_extents) {
     auto clip_len = image_extent.second;
     int r = clip_io(get_image_ctx(&m_image_ctx), image_extent.first, &clip_len);
@@ -277,7 +277,7 @@ void ImageReadRequest<I>::send_request() {
   {
     // prevent image size from changing between computing clip and recording
     // pending async operation
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     snap_id = image_ctx.snap_id;
 
     // map image extents to object extents
@@ -355,7 +355,7 @@ void AbstractImageWriteRequest<I>::send_request() {
   {
     // prevent image size from changing between computing clip and recording
     // pending async operation
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     if (image_ctx.snap_id != CEPH_NOSNAP || image_ctx.read_only) {
       aio_comp->fail(-EROFS);
       return;
@@ -600,7 +600,7 @@ void ImageFlushRequest<I>::send_request() {
 
   bool journaling = false;
   {
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     journaling = (m_flush_source == FLUSH_SOURCE_USER &&
                   image_ctx.journal != nullptr &&
                   image_ctx.journal->is_journal_appending());
index 70e6aae9c91c389fc7c90b69fb2a484642d5a21b..ac7b04661f97ca5505fcc5af014827559328eedc 100644 (file)
@@ -137,9 +137,9 @@ ssize_t ImageRequestWQ<I>::write(uint64_t off, uint64_t len,
   ldout(cct, 20) << "ictx=" << &m_image_ctx << ", off=" << off << ", "
                  << "len = " << len << dendl;
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   int r = clip_io(util::get_image_ctx(&m_image_ctx), off, &len);
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
   if (r < 0) {
     lderr(cct) << "invalid IO request: " << cpp_strerror(r) << dendl;
     return r;
@@ -163,9 +163,9 @@ ssize_t ImageRequestWQ<I>::discard(uint64_t off, uint64_t len,
   ldout(cct, 20) << "ictx=" << &m_image_ctx << ", off=" << off << ", "
                  << "len = " << len << dendl;
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   int r = clip_io(util::get_image_ctx(&m_image_ctx), off, &len);
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
   if (r < 0) {
     lderr(cct) << "invalid IO request: " << cpp_strerror(r) << dendl;
     return r;
@@ -189,9 +189,9 @@ ssize_t ImageRequestWQ<I>::writesame(uint64_t off, uint64_t len,
   ldout(cct, 20) << "ictx=" << &m_image_ctx << ", off=" << off << ", "
                  << "len = " << len << ", data_len " << bl.length() << dendl;
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   int r = clip_io(util::get_image_ctx(&m_image_ctx), off, &len);
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
   if (r < 0) {
     lderr(cct) << "invalid IO request: " << cpp_strerror(r) << dendl;
     return r;
@@ -218,9 +218,9 @@ ssize_t ImageRequestWQ<I>::compare_and_write(uint64_t off, uint64_t len,
   ldout(cct, 20) << "compare_and_write ictx=" << &m_image_ctx << ", off="
                  << off << ", " << "len = " << len << dendl;
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   int r = clip_io(util::get_image_ctx(&m_image_ctx), off, &len);
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
   if (r < 0) {
     lderr(cct) << "invalid IO request: " << cpp_strerror(r) << dendl;
     return r;
index 57bd7291c6824575029a6a17a9ac215a72dbcc4c..b3173cd46bb58c8bbcd4eb68c74d392cad75a4a3 100644 (file)
@@ -36,7 +36,7 @@ namespace {
 
 template <typename I>
 inline bool is_copy_on_read(I *ictx, librados::snap_t snap_id) {
-  RWLock::RLocker snap_locker(ictx->snap_lock);
+  RWLock::RLocker image_locker(ictx->image_lock);
   return (ictx->clone_copy_on_read &&
           !ictx->read_only && snap_id == CEPH_NOSNAP &&
           (ictx->exclusive_lock == nullptr ||
@@ -133,7 +133,7 @@ void ObjectRequest<I>::add_write_hint(I& image_ctx,
 template <typename I>
 bool ObjectRequest<I>::compute_parent_extents(Extents *parent_extents,
                                               bool read_request) {
-  ceph_assert(m_ictx->snap_lock.is_locked());
+  ceph_assert(m_ictx->image_lock.is_locked());
   ceph_assert(m_ictx->parent_lock.is_locked());
 
   m_has_parent = false;
@@ -212,7 +212,7 @@ template <typename I>
 void ObjectReadRequest<I>::read_object() {
   I *image_ctx = this->m_ictx;
   {
-    RWLock::RLocker snap_locker(image_ctx->snap_lock);
+    RWLock::RLocker image_locker(image_ctx->image_lock);
     if (image_ctx->object_map != nullptr &&
         !image_ctx->object_map->object_may_exist(this->m_object_no)) {
       image_ctx->op_work_queue->queue(new FunctionContext([this](int r) {
@@ -266,7 +266,7 @@ template <typename I>
 void ObjectReadRequest<I>::read_parent() {
   I *image_ctx = this->m_ictx;
 
-  RWLock::RLocker snap_locker(image_ctx->snap_lock);
+  RWLock::RLocker image_locker(image_ctx->image_lock);
   RWLock::RLocker parent_locker(image_ctx->parent_lock);
 
   // calculate reverse mapping onto the image
@@ -285,7 +285,7 @@ void ObjectReadRequest<I>::read_parent() {
 
   if (object_overlap == 0) {
     parent_locker.unlock();
-    snap_locker.unlock();
+    image_locker.unlock();
 
     this->finish(-ENOENT);
     return;
@@ -328,14 +328,14 @@ void ObjectReadRequest<I>::copyup() {
   }
 
   image_ctx->owner_lock.get_read();
-  image_ctx->snap_lock.get_read();
+  image_ctx->image_lock.get_read();
   image_ctx->parent_lock.get_read();
   Extents parent_extents;
   if (!this->compute_parent_extents(&parent_extents, true) ||
       (image_ctx->exclusive_lock != nullptr &&
        !image_ctx->exclusive_lock->is_lock_owner())) {
     image_ctx->parent_lock.put_read();
-    image_ctx->snap_lock.put_read();
+    image_ctx->image_lock.put_read();
     image_ctx->owner_lock.put_read();
     this->finish(0);
     return;
@@ -354,12 +354,12 @@ void ObjectReadRequest<I>::copyup() {
     image_ctx->copyup_list[this->m_object_no] = new_req;
     image_ctx->copyup_list_lock.Unlock();
     image_ctx->parent_lock.put_read();
-    image_ctx->snap_lock.put_read();
+    image_ctx->image_lock.put_read();
     new_req->send();
   } else {
     image_ctx->copyup_list_lock.Unlock();
     image_ctx->parent_lock.put_read();
-    image_ctx->snap_lock.put_read();
+    image_ctx->image_lock.put_read();
   }
 
   image_ctx->owner_lock.put_read();
@@ -386,17 +386,17 @@ AbstractObjectWriteRequest<I>::AbstractObjectWriteRequest(
 
   compute_parent_info();
 
-  ictx->snap_lock.get_read();
+  ictx->image_lock.get_read();
   if (!ictx->migration_info.empty()) {
     m_guarding_migration_write = true;
   }
-  ictx->snap_lock.put_read();
+  ictx->image_lock.put_read();
 }
 
 template <typename I>
 void AbstractObjectWriteRequest<I>::compute_parent_info() {
   I *image_ctx = this->m_ictx;
-  RWLock::RLocker snap_locker(image_ctx->snap_lock);
+  RWLock::RLocker image_locker(image_ctx->image_lock);
   RWLock::RLocker parent_locker(image_ctx->parent_lock);
 
   this->compute_parent_extents(&m_parent_extents, false);
@@ -411,7 +411,7 @@ template <typename I>
 void AbstractObjectWriteRequest<I>::add_write_hint(
     librados::ObjectWriteOperation *wr) {
   I *image_ctx = this->m_ictx;
-  RWLock::RLocker snap_locker(image_ctx->snap_lock);
+  RWLock::RLocker image_locker(image_ctx->image_lock);
   if (image_ctx->object_map == nullptr || !this->m_object_may_exist) {
     ObjectRequest<I>::add_write_hint(*image_ctx, wr);
   }
@@ -424,7 +424,7 @@ void AbstractObjectWriteRequest<I>::send() {
                             << this->m_object_off << "~" << this->m_object_len
                             << dendl;
   {
-    RWLock::RLocker snap_lock(image_ctx->snap_lock);
+    RWLock::RLocker image_lock(image_ctx->image_lock);
     if (image_ctx->object_map == nullptr) {
       m_object_may_exist = true;
     } else {
@@ -449,16 +449,16 @@ template <typename I>
 void AbstractObjectWriteRequest<I>::pre_write_object_map_update() {
   I *image_ctx = this->m_ictx;
 
-  image_ctx->snap_lock.get_read();
+  image_ctx->image_lock.get_read();
   if (image_ctx->object_map == nullptr || !is_object_map_update_enabled()) {
-    image_ctx->snap_lock.put_read();
+    image_ctx->image_lock.put_read();
     write_object();
     return;
   }
 
   if (!m_object_may_exist && m_copyup_enabled) {
     // optimization: copyup required
-    image_ctx->snap_lock.put_read();
+    image_ctx->image_lock.put_read();
     copyup();
     return;
   }
@@ -474,12 +474,12 @@ void AbstractObjectWriteRequest<I>::pre_write_object_map_update() {
           CEPH_NOSNAP, this->m_object_no, new_state, {}, this->m_trace, false,
           this)) {
     image_ctx->object_map_lock.put_write();
-    image_ctx->snap_lock.put_read();
+    image_ctx->image_lock.put_read();
     return;
   }
 
   image_ctx->object_map_lock.put_write();
-  image_ctx->snap_lock.put_read();
+  image_ctx->image_lock.put_read();
   write_object();
 }
 
@@ -539,9 +539,9 @@ void AbstractObjectWriteRequest<I>::handle_write_object(int r) {
       return;
     }
   } else if (r == -ERANGE && m_guarding_migration_write) {
-    image_ctx->snap_lock.get_read();
+    image_ctx->image_lock.get_read();
     m_guarding_migration_write = !image_ctx->migration_info.empty();
-    image_ctx->snap_lock.put_read();
+    image_ctx->image_lock.put_read();
 
     if (m_guarding_migration_write) {
       copyup();
@@ -620,10 +620,10 @@ template <typename I>
 void AbstractObjectWriteRequest<I>::post_write_object_map_update() {
   I *image_ctx = this->m_ictx;
 
-  image_ctx->snap_lock.get_read();
+  image_ctx->image_lock.get_read();
   if (image_ctx->object_map == nullptr || !is_object_map_update_enabled() ||
       !is_non_existent_post_write_object_map_state()) {
-    image_ctx->snap_lock.put_read();
+    image_ctx->image_lock.put_read();
     this->finish(0);
     return;
   }
@@ -639,12 +639,12 @@ void AbstractObjectWriteRequest<I>::post_write_object_map_update() {
           CEPH_NOSNAP, this->m_object_no, OBJECT_NONEXISTENT, OBJECT_PENDING,
           this->m_trace, false, this)) {
     image_ctx->object_map_lock.put_write();
-    image_ctx->snap_lock.put_read();
+    image_ctx->image_lock.put_read();
     return;
   }
 
   image_ctx->object_map_lock.put_write();
-  image_ctx->snap_lock.put_read();
+  image_ctx->image_lock.put_read();
   this->finish(0);
 }
 
index af48b244d8a3f7974457904e31b3a6790463934e..8f850ab5369ac7d906cd5f56f1e58609f40d6cda 100644 (file)
@@ -1143,9 +1143,9 @@ template <typename I>
 bool Replay<I>::clipped_io(uint64_t image_offset, io::AioCompletion *aio_comp) {
   CephContext *cct = m_image_ctx.cct;
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   size_t image_size = m_image_ctx.size;
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 
   if (image_offset >= image_size) {
     // rbd-mirror image sync might race an IO event w/ associated resize between
index a2b9d8f60d67908e22a0974a68221dad73e299d6..6576fb2c2e4c303a6d34fca13559eabc8daef369 100644 (file)
@@ -33,7 +33,7 @@ void CreateRequest<I>::send() {
   uint64_t max_size = m_image_ctx->size;
 
   {
-    RWLock::WLocker snap_locker(m_image_ctx->snap_lock);
+    RWLock::WLocker image_locker(m_image_ctx->image_lock);
     m_snap_ids.push_back(CEPH_NOSNAP);
     for (auto it : m_image_ctx->snap_info) {
       max_size = std::max(max_size, it.second.size);
index 9f7a2fa10140f8f6fc6c01a41beb634d3a92b9df..c610e2b0f0684c5df908f018da630f94039c3320 100644 (file)
@@ -24,7 +24,7 @@ template <typename I>
 void InvalidateRequest<I>::send() {
   I &image_ctx = this->m_image_ctx;
   ceph_assert(image_ctx.owner_lock.is_locked());
-  ceph_assert(image_ctx.snap_lock.is_wlocked());
+  ceph_assert(image_ctx.image_lock.is_wlocked());
 
   uint64_t snap_flags;
   int r = image_ctx.get_flags(m_snap_id, &snap_flags);
index c4fc2539c05dd822674a2f45bf8c0d2566297b46..98984008cfd4faca2fed3fef19716c3bf38f4ad3 100644 (file)
@@ -35,7 +35,7 @@ RefreshRequest<I>::RefreshRequest(I &image_ctx, ceph::BitVector<2> *object_map,
 template <typename I>
 void RefreshRequest<I>::send() {
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     m_object_count = Striper::get_num_objects(
       m_image_ctx.layout, m_image_ctx.get_image_size(m_snap_id));
   }
@@ -51,7 +51,7 @@ template <typename I>
 void RefreshRequest<I>::apply() {
   uint64_t num_objs;
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     num_objs = Striper::get_num_objects(
       m_image_ctx.layout, m_image_ctx.get_image_size(m_snap_id));
   }
@@ -172,7 +172,7 @@ void RefreshRequest<I>::send_invalidate() {
     m_image_ctx, m_snap_id, true, ctx);
 
   RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
-  RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::WLocker image_locker(m_image_ctx.image_lock);
   req->send();
 }
 
@@ -206,7 +206,7 @@ void RefreshRequest<I>::send_resize_invalidate() {
     m_image_ctx, m_snap_id, true, ctx);
 
   RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
-  RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::WLocker image_locker(m_image_ctx.image_lock);
   req->send();
 }
 
@@ -277,7 +277,7 @@ void RefreshRequest<I>::send_invalidate_and_close() {
 
   lderr(cct) << "object map too large: " << m_object_count << dendl;
   RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
-  RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::WLocker image_locker(m_image_ctx.image_lock);
   req->send();
 }
 
index a7db0c030611f564923b6d07dfc826da76c47477..bfd80f51d8b2bea0bdbbfe5b98ed154dc4a70bfd 100644 (file)
@@ -35,7 +35,7 @@ void RemoveRequest<I>::send_remove_object_map() {
   CephContext *cct = m_image_ctx->cct;
   ldout(cct, 20) << __func__ << dendl;
 
-  RWLock::WLocker snap_locker(m_image_ctx->snap_lock);
+  RWLock::WLocker image_locker(m_image_ctx->image_lock);
   std::vector<uint64_t> snap_ids;
   snap_ids.push_back(CEPH_NOSNAP);
   for (auto it : m_image_ctx->snap_info) {
index a5e3a8bd993c1ccfaef55daea63e435740529533..8690272292309d345b36196a070b73a7a9b1515c 100644 (file)
@@ -58,7 +58,7 @@ bool Request::invalidate() {
   m_state = STATE_INVALIDATE;
 
   RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
-  RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::WLocker image_locker(m_image_ctx.image_lock);
   InvalidateRequest<> *req = new InvalidateRequest<>(m_image_ctx, m_snap_id,
                                                      true,
                                                      create_callback_context());
index 2949dec8dd7bb074e2bece35e4a6fa07ba08fbd2..35950e32e9f3a4e431d262dd242141f4aec0cea0 100644 (file)
@@ -75,7 +75,7 @@ bool SnapshotCreateRequest::should_complete(int r) {
 }
 
 void SnapshotCreateRequest::send_read_map() {
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
 
   CephContext *cct = m_image_ctx.cct;
   std::string oid(ObjectMap<>::object_map_name(m_image_ctx.id, CEPH_NOSNAP));
@@ -110,7 +110,7 @@ void SnapshotCreateRequest::send_write_map() {
 }
 
 bool SnapshotCreateRequest::send_add_snapshot() {
-  RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::RLocker image_locker(m_image_ctx.image_lock);
   if ((m_image_ctx.features & RBD_FEATURE_FAST_DIFF) == 0) {
     return true;
   }
@@ -132,7 +132,7 @@ bool SnapshotCreateRequest::send_add_snapshot() {
 }
 
 void SnapshotCreateRequest::update_object_map() {
-  RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::WLocker image_locker(m_image_ctx.image_lock);
   RWLock::WLocker object_map_locker(m_image_ctx.object_map_lock);
 
   auto it = m_object_map.begin();
index 54f67c8d76d0a48abde937d02dba49da46296e7f..eef3ec37414121be55d7322677267058c8b2293e 100644 (file)
@@ -19,7 +19,7 @@ namespace object_map {
 
 void SnapshotRemoveRequest::send() {
   ceph_assert(m_image_ctx.owner_lock.is_locked());
-  ceph_assert(m_image_ctx.snap_lock.is_wlocked());
+  ceph_assert(m_image_ctx.image_lock.is_wlocked());
 
   if ((m_image_ctx.features & RBD_FEATURE_FAST_DIFF) != 0) {
     int r = m_image_ctx.get_flags(m_snap_id, &m_flags);
@@ -67,7 +67,7 @@ void SnapshotRemoveRequest::handle_load_map(int r) {
                << cpp_strerror(r) << dendl;
 
     RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
-    RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::WLocker image_locker(m_image_ctx.image_lock);
     invalidate_next_map();
     return;
   }
@@ -80,7 +80,7 @@ void SnapshotRemoveRequest::remove_snapshot() {
     // snapshot object map exists on disk but is invalid. cannot clean fast-diff
     // on next snapshot if current snapshot was invalid.
     RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
-    RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::WLocker image_locker(m_image_ctx.image_lock);
     invalidate_next_map();
     return;
   }
@@ -113,19 +113,19 @@ void SnapshotRemoveRequest::handle_remove_snapshot(int r) {
                << cpp_strerror(r) << dendl;
 
     RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
-    RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::WLocker image_locker(m_image_ctx.image_lock);
     invalidate_next_map();
     return;
   }
 
-  RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::RLocker image_locker(m_image_ctx.image_lock);
   update_object_map();
   remove_map();
 }
 
 void SnapshotRemoveRequest::invalidate_next_map() {
   ceph_assert(m_image_ctx.owner_lock.is_locked());
-  ceph_assert(m_image_ctx.snap_lock.is_wlocked());
+  ceph_assert(m_image_ctx.image_lock.is_wlocked());
 
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 5) << dendl;
@@ -185,7 +185,7 @@ void SnapshotRemoveRequest::handle_remove_map(int r) {
 }
 
 void SnapshotRemoveRequest::compute_next_snap_id() {
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
 
   m_next_snap_id = CEPH_NOSNAP;
   std::map<librados::snap_t, SnapInfo>::const_iterator it =
@@ -199,7 +199,7 @@ void SnapshotRemoveRequest::compute_next_snap_id() {
 }
 
 void SnapshotRemoveRequest::update_object_map() {
-  assert(m_image_ctx.snap_lock.is_locked());
+  assert(m_image_ctx.image_lock.is_locked());
   RWLock::WLocker object_map_locker(m_image_ctx.object_map_lock);
   if (m_next_snap_id == m_image_ctx.snap_id && m_next_snap_id == CEPH_NOSNAP) {
     CephContext *cct = m_image_ctx.cct;
index d32123ffcf2a2bd962c7e3b284517a14c2c57886..3e5d54dc3d4495db5a538d60557bc22162d1ee9d 100644 (file)
@@ -115,7 +115,7 @@ void SnapshotRollbackRequest::send_write_map() {
 
 void SnapshotRollbackRequest::send_invalidate_map() {
   RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
-  RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::WLocker image_locker(m_image_ctx.image_lock);
 
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 5) << this << " " << __func__ << dendl;
index 4b30533498a3ebb16682bfe6c51883ee8d4a6a15..cb9a2251cc8d9e329f4b6982ecde90a3f581c21b 100644 (file)
@@ -33,7 +33,7 @@ void UpdateRequest<I>::send() {
 
 template <typename I>
 void UpdateRequest<I>::update_object_map() {
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
   ceph_assert(m_image_ctx.object_map_lock.is_locked());
   CephContext *cct = m_image_ctx.cct;
 
@@ -80,7 +80,7 @@ void UpdateRequest<I>::handle_update_object_map(int r) {
   }
 
   {
-    RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx.image_lock);
     RWLock::WLocker object_map_locker(m_image_ctx.object_map_lock);
     update_in_memory_object_map();
 
@@ -97,7 +97,7 @@ void UpdateRequest<I>::handle_update_object_map(int r) {
 
 template <typename I>
 void UpdateRequest<I>::update_in_memory_object_map() {
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
   ceph_assert(m_image_ctx.object_map_lock.is_locked());
 
   // rebuilding the object map might update on-disk only
index b064bc45f79380a4cd8c30cf98a0a0c1e5140833..22c39e976424082557809be0af5a99d475ca4555 100644 (file)
@@ -107,7 +107,7 @@ private:
 
   bool m_acquired_lock = false;
   bool m_writes_blocked = false;
-  bool m_snap_lock_acquired = false;
+  bool m_image_lock_acquired = false;
   bool m_requests_blocked = false;
 
   uint64_t m_new_features = 0;
index af21bd4e6a520f066249cde377908bc79a68c086..7656e7b6cd1e6ce4ffffd3250234a7f383c7930e 100644 (file)
@@ -46,7 +46,7 @@ public:
     }
 
     {
-      RWLock::RLocker snap_lock(image_ctx.snap_lock);
+      RWLock::RLocker image_lock(image_ctx.image_lock);
       if (image_ctx.object_map != nullptr &&
           !image_ctx.object_map->object_may_not_exist(m_object_no)) {
         // can skip because the object already exists
@@ -144,15 +144,15 @@ void FlattenRequest<I>::detach_child() {
   // if there are no snaps, remove from the children object as well
   // (if snapshots remain, they have their own parent info, and the child
   // will be removed when the last snap goes away)
-  image_ctx.snap_lock.get_read();
+  image_ctx.image_lock.get_read();
   if ((image_ctx.features & RBD_FEATURE_DEEP_FLATTEN) == 0 &&
       !image_ctx.snaps.empty()) {
-    image_ctx.snap_lock.put_read();
+    image_ctx.image_lock.put_read();
     image_ctx.owner_lock.put_read();
     detach_parent();
     return;
   }
-  image_ctx.snap_lock.put_read();
+  image_ctx.image_lock.put_read();
 
   ldout(cct, 5) << dendl;
   auto ctx = create_context_callback<
index 71a6f93288efa38e09c230befe1e5138860cc66e..2884961490b5f13c3231fc719ff35f8adda5939e 100644 (file)
@@ -101,7 +101,7 @@ private:
 
   bool is_within_overlap_bounds() {
     I &image_ctx = this->m_image_ctx;
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
 
     auto overlap = std::min(image_ctx.size, image_ctx.migration_info.overlap);
     return overlap > 0 &&
@@ -220,7 +220,7 @@ uint64_t MigrateRequest<I>::get_num_overlap_objects() {
   CephContext *cct = image_ctx.cct;
   ldout(cct, 10) << dendl;
 
-  RWLock::RLocker snap_locker(image_ctx.snap_lock);
+  RWLock::RLocker image_locker(image_ctx.image_lock);
   RWLock::RLocker parent_locker(image_ctx.parent_lock);
 
   auto overlap = image_ctx.migration_info.overlap;
index 658dbb4a73762d5c8adbf0a1e81f9df449c4c60e..578598792700cff5212862f6aa222a63401057f2 100644 (file)
@@ -107,7 +107,7 @@ private:
 
   uint8_t get_object_state() {
     I &image_ctx = this->m_image_ctx;
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     for (std::vector<librados::clone_info_t>::const_iterator r =
            m_snap_set.clones.begin(); r != m_snap_set.clones.end(); ++r) {
       librados::snap_t from_snap_id;
@@ -137,7 +137,7 @@ private:
 
   uint64_t next_valid_snap_id(uint64_t snap_id) {
     I &image_ctx = this->m_image_ctx;
-    ceph_assert(image_ctx.snap_lock.is_locked());
+    ceph_assert(image_ctx.image_lock.is_locked());
 
     std::map<librados::snap_t, SnapInfo>::iterator it =
       image_ctx.snap_info.lower_bound(snap_id);
@@ -156,7 +156,7 @@ private:
     ceph_assert(image_ctx.exclusive_lock == nullptr ||
                 image_ctx.exclusive_lock->is_lock_owner());
 
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     ceph_assert(image_ctx.object_map != nullptr);
 
     RWLock::WLocker l(image_ctx.object_map_lock);
@@ -243,7 +243,7 @@ void ObjectMapIterateRequest<I>::send_verify_objects() {
   uint64_t snap_id;
   uint64_t num_objects;
   {
-    RWLock::RLocker l(m_image_ctx.snap_lock);
+    RWLock::RLocker l(m_image_ctx.image_lock);
     snap_id = m_image_ctx.snap_id;
     num_objects = Striper::get_num_objects(m_image_ctx.layout,
                                            m_image_ctx.get_image_size(snap_id));
@@ -265,7 +265,7 @@ void ObjectMapIterateRequest<I>::send_verify_objects() {
 
 template <typename I>
 uint64_t ObjectMapIterateRequest<I>::get_image_size() const {
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
   if (m_image_ctx.snap_id == CEPH_NOSNAP) {
     if (!m_image_ctx.resize_reqs.empty()) {
       return m_image_ctx.resize_reqs.front()->get_image_size();
@@ -289,7 +289,7 @@ void ObjectMapIterateRequest<I>::send_invalidate_object_map() {
                                             this->create_callback_context());
 
   ceph_assert(m_image_ctx.owner_lock.is_locked());
-  RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::WLocker image_locker(m_image_ctx.image_lock);
   req->send();
 }
 
index f923f36c595ffae5ce36e0b579ae6532c6f7b18d..31497d67bbc01ab310aba8547b3cee08a94563ec 100644 (file)
@@ -96,14 +96,14 @@ void RebuildObjectMapRequest<I>::send_resize_object_map() {
   ceph_assert(m_image_ctx.owner_lock.is_locked());
   CephContext *cct = m_image_ctx.cct;
 
-  m_image_ctx.snap_lock.get_read();
+  m_image_ctx.image_lock.get_read();
   ceph_assert(m_image_ctx.object_map != nullptr);
 
   uint64_t size = get_image_size();
   uint64_t num_objects = Striper::get_num_objects(m_image_ctx.layout, size);
 
   if (m_image_ctx.object_map->size() == num_objects) {
-    m_image_ctx.snap_lock.put_read();
+    m_image_ctx.image_lock.put_read();
     send_verify_objects();
     return;
   }
@@ -117,7 +117,7 @@ void RebuildObjectMapRequest<I>::send_resize_object_map() {
 
   m_image_ctx.object_map->aio_resize(size, OBJECT_NONEXISTENT,
                                      this->create_callback_context());
-  m_image_ctx.snap_lock.put_read();
+  m_image_ctx.image_lock.put_read();
 }
 
 template <typename I>
@@ -135,7 +135,7 @@ void RebuildObjectMapRequest<I>::send_trim_image() {
   uint64_t new_size;
   uint64_t orig_size;
   {
-    RWLock::RLocker l(m_image_ctx.snap_lock);
+    RWLock::RLocker l(m_image_ctx.image_lock);
     ceph_assert(m_image_ctx.object_map != nullptr);
 
     new_size = get_image_size();
@@ -199,7 +199,7 @@ void RebuildObjectMapRequest<I>::send_save_object_map() {
   ceph_assert(m_image_ctx.exclusive_lock == nullptr ||
               m_image_ctx.exclusive_lock->is_lock_owner());
 
-  RWLock::RLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::RLocker image_locker(m_image_ctx.image_lock);
   ceph_assert(m_image_ctx.object_map != nullptr);
   m_image_ctx.object_map->aio_save(this->create_callback_context());
 }
@@ -225,13 +225,13 @@ void RebuildObjectMapRequest<I>::send_update_header() {
   ceph_assert(r == 0);
   comp->release();
 
-  RWLock::WLocker snap_locker(m_image_ctx.snap_lock);
+  RWLock::WLocker image_locker(m_image_ctx.image_lock);
   m_image_ctx.update_flags(m_image_ctx.snap_id, flags, false);
 }
 
 template <typename I>
 uint64_t RebuildObjectMapRequest<I>::get_image_size() const {
-  ceph_assert(m_image_ctx.snap_lock.is_locked());
+  ceph_assert(m_image_ctx.image_lock.is_locked());
   if (m_image_ctx.snap_id == CEPH_NOSNAP) {
     if (!m_image_ctx.resize_reqs.empty()) {
       return m_image_ctx.resize_reqs.front()->get_image_size();
index 44c5e2cd468135ca2549b5a5b28d8494a201dcab..823e82dd1412717d92c5b0e18dc9548382ea54f0 100644 (file)
@@ -105,7 +105,7 @@ int RenameRequest<I>::filter_return_code(int r) const {
   CephContext *cct = image_ctx.cct;
 
   if (m_state == STATE_READ_SOURCE_HEADER && r == -ENOENT) {
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     if (image_ctx.name == m_dest_name) {
       // signal that replay raced with itself
       return -EEXIST;
index 429cc01e1802d8dc241fff45d52e36b78df8ee0d..3f50acd5abb653b2f15c1ea566199b4fd2be826f 100644 (file)
@@ -75,7 +75,7 @@ bool Request<I>::append_op_event() {
   I &image_ctx = this->m_image_ctx;
 
   ceph_assert(image_ctx.owner_lock.is_locked());
-  RWLock::RLocker snap_locker(image_ctx.snap_lock);
+  RWLock::RLocker image_locker(image_ctx.image_lock);
   if (image_ctx.journal != nullptr &&
       image_ctx.journal->is_journal_appending()) {
     append_op_event(util::create_context_callback<
@@ -88,7 +88,7 @@ bool Request<I>::append_op_event() {
 template <typename I>
 bool Request<I>::commit_op_event(int r) {
   I &image_ctx = this->m_image_ctx;
-  RWLock::RLocker snap_locker(image_ctx.snap_lock);
+  RWLock::RLocker image_locker(image_ctx.image_lock);
 
   if (!m_appended_op_event) {
     return false;
@@ -132,7 +132,7 @@ template <typename I>
 void Request<I>::replay_op_ready(Context *on_safe) {
   I &image_ctx = this->m_image_ctx;
   ceph_assert(image_ctx.owner_lock.is_locked());
-  ceph_assert(image_ctx.snap_lock.is_locked());
+  ceph_assert(image_ctx.image_lock.is_locked());
   ceph_assert(m_op_tid != 0);
 
   m_appended_op_event = true;
@@ -144,7 +144,7 @@ template <typename I>
 void Request<I>::append_op_event(Context *on_safe) {
   I &image_ctx = this->m_image_ctx;
   ceph_assert(image_ctx.owner_lock.is_locked());
-  ceph_assert(image_ctx.snap_lock.is_locked());
+  ceph_assert(image_ctx.image_lock.is_locked());
 
   CephContext *cct = image_ctx.cct;
   ldout(cct, 10) << this << " " << __func__ << dendl;
index 315a3c964ec351d4bc706e6d7caf134cdd7724b6..c1ca11ddc6dec9e7d3d3eb2fe3dbac9f93fcb9be 100644 (file)
@@ -39,7 +39,7 @@ protected:
 
     ceph_assert(can_affect_io());
     RWLock::RLocker owner_locker(image_ctx.owner_lock);
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     if (image_ctx.journal != nullptr) {
       if (image_ctx.journal->is_journal_replaying()) {
         Context *ctx = util::create_context_callback<T, MF>(request);
index c5fa86f57bcb50e04b4294c9632528b350804a5c..81fbd351ab8b9bf799c0afcbb1827e3d76747627 100644 (file)
@@ -42,7 +42,7 @@ ResizeRequest<I>::~ResizeRequest() {
   I &image_ctx = this->m_image_ctx;
   ResizeRequest *next_req = NULL;
   {
-    RWLock::WLocker snap_locker(image_ctx.snap_lock);
+    RWLock::WLocker image_locker(image_ctx.image_lock);
     ceph_assert(m_xlist_item.remove_myself());
     if (!image_ctx.resize_reqs.empty()) {
       next_req = image_ctx.resize_reqs.front();
@@ -61,7 +61,7 @@ void ResizeRequest<I>::send() {
   ceph_assert(image_ctx.owner_lock.is_locked());
 
   {
-    RWLock::WLocker snap_locker(image_ctx.snap_lock);
+    RWLock::WLocker image_locker(image_ctx.image_lock);
     if (!m_xlist_item.is_on_list()) {
       image_ctx.resize_reqs.push_back(&m_xlist_item);
       if (image_ctx.resize_reqs.front() != this) {
@@ -253,7 +253,7 @@ Context *ResizeRequest<I>::send_grow_object_map() {
   I &image_ctx = this->m_image_ctx;
 
   {
-    RWLock::WLocker snap_locker(image_ctx.snap_lock);
+    RWLock::WLocker image_locker(image_ctx.image_lock);
     m_shrink_size_visible = true;
   }
   image_ctx.io_work_queue->unblock_writes();
@@ -266,9 +266,9 @@ Context *ResizeRequest<I>::send_grow_object_map() {
   }
 
   image_ctx.owner_lock.get_read();
-  image_ctx.snap_lock.get_read();
+  image_ctx.image_lock.get_read();
   if (image_ctx.object_map == nullptr) {
-    image_ctx.snap_lock.put_read();
+    image_ctx.image_lock.put_read();
     image_ctx.owner_lock.put_read();
 
     send_post_block_writes();
@@ -285,7 +285,7 @@ Context *ResizeRequest<I>::send_grow_object_map() {
   image_ctx.object_map->aio_resize(
     m_new_size, OBJECT_NONEXISTENT, create_context_callback<
       ResizeRequest<I>, &ResizeRequest<I>::handle_grow_object_map>(this));
-  image_ctx.snap_lock.put_read();
+  image_ctx.image_lock.put_read();
   image_ctx.owner_lock.put_read();
   return nullptr;
 }
@@ -311,9 +311,9 @@ Context *ResizeRequest<I>::send_shrink_object_map() {
   I &image_ctx = this->m_image_ctx;
 
   image_ctx.owner_lock.get_read();
-  image_ctx.snap_lock.get_read();
+  image_ctx.image_lock.get_read();
   if (image_ctx.object_map == nullptr || m_new_size > m_original_size) {
-    image_ctx.snap_lock.put_read();
+    image_ctx.image_lock.put_read();
     image_ctx.owner_lock.put_read();
 
     update_size_and_overlap();
@@ -332,7 +332,7 @@ Context *ResizeRequest<I>::send_shrink_object_map() {
   image_ctx.object_map->aio_resize(
     m_new_size, OBJECT_NONEXISTENT, create_context_callback<
       ResizeRequest<I>, &ResizeRequest<I>::handle_shrink_object_map>(this));
-  image_ctx.snap_lock.put_read();
+  image_ctx.image_lock.put_read();
   image_ctx.owner_lock.put_read();
   return nullptr;
 }
@@ -445,7 +445,7 @@ template <typename I>
 void ResizeRequest<I>::update_size_and_overlap() {
   I &image_ctx = this->m_image_ctx;
   {
-    RWLock::WLocker snap_locker(image_ctx.snap_lock);
+    RWLock::WLocker image_locker(image_ctx.image_lock);
     image_ctx.size = m_new_size;
 
     RWLock::WLocker parent_locker(image_ctx.parent_lock);
index 31553177306f0183335f3abaea910d5b68d42ef8..a7808f68b4d3243f5926fd6913cb7e03080c8676 100644 (file)
@@ -159,7 +159,7 @@ void SnapshotCreateRequest<I>::send_create_snap() {
   ldout(cct, 5) << this << " " << __func__ << dendl;
 
   RWLock::RLocker owner_locker(image_ctx.owner_lock);
-  RWLock::RLocker snap_locker(image_ctx.snap_lock);
+  RWLock::RLocker image_locker(image_ctx.image_lock);
   RWLock::RLocker parent_locker(image_ctx.parent_lock);
 
   // should have been canceled prior to releasing lock
@@ -208,9 +208,9 @@ template <typename I>
 Context *SnapshotCreateRequest<I>::send_create_object_map() {
   I &image_ctx = this->m_image_ctx;
 
-  image_ctx.snap_lock.get_read();
+  image_ctx.image_lock.get_read();
   if (image_ctx.object_map == nullptr || m_skip_object_map) {
-    image_ctx.snap_lock.put_read();
+    image_ctx.image_lock.put_read();
 
     update_snap_context();
     image_ctx.io_work_queue->unblock_writes();
@@ -227,7 +227,7 @@ Context *SnapshotCreateRequest<I>::send_create_object_map() {
         SnapshotCreateRequest<I>,
         &SnapshotCreateRequest<I>::handle_create_object_map>(this));
   }
-  image_ctx.snap_lock.put_read();
+  image_ctx.image_lock.put_read();
   return nullptr;
 }
 
@@ -281,7 +281,7 @@ void SnapshotCreateRequest<I>::update_snap_context() {
   I &image_ctx = this->m_image_ctx;
 
   RWLock::RLocker owner_locker(image_ctx.owner_lock);
-  RWLock::WLocker snap_locker(image_ctx.snap_lock);
+  RWLock::WLocker image_locker(image_ctx.image_lock);
   if (image_ctx.old_format) {
     return;
   }
index d47dc3a86af2353be9958632b6c4318e2b7a936e..f36b5c9d306738cae74f036e1640aaae48930f49 100644 (file)
@@ -47,7 +47,7 @@ void SnapshotLimitRequest<I>::send_limit_snaps() {
 
   {
     RWLock::RLocker md_locker(image_ctx.md_lock);
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
 
     librados::ObjectWriteOperation op;
     cls_client::snapshot_set_limit(&op, m_snap_limit);
index 9a0375fc7c2f1f338248242abb70b71cb431848e..6c331e228e4ebb73ed4fb7ede163acf36068bd17 100644 (file)
@@ -77,7 +77,7 @@ template <typename I>
 int SnapshotProtectRequest<I>::verify_and_send_protect_snap() {
   I &image_ctx = this->m_image_ctx;
   RWLock::RLocker md_locker(image_ctx.md_lock);
-  RWLock::RLocker snap_locker(image_ctx.snap_lock);
+  RWLock::RLocker image_locker(image_ctx.image_lock);
 
   CephContext *cct = image_ctx.cct;
   if ((image_ctx.features & RBD_FEATURE_LAYERING) == 0) {
index 072867b448640d334af731e4dc324ab392d4d95b..a3e7f987ce935ff187cee03c207ccc78d5d794ce 100644 (file)
@@ -38,7 +38,7 @@ void SnapshotRemoveRequest<I>::send_op() {
 
   ceph_assert(image_ctx.owner_lock.is_locked());
   {
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     RWLock::RLocker object_map_locker(image_ctx.object_map_lock);
     if (image_ctx.snap_info.find(m_snap_id) == image_ctx.snap_info.end()) {
       lderr(cct) << "snapshot doesn't exist" << dendl;
@@ -159,7 +159,7 @@ void SnapshotRemoveRequest<I>::detach_child() {
 
   bool detach_child = false;
   {
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     RWLock::RLocker parent_locker(image_ctx.parent_lock);
 
     cls::rbd::ParentImageSpec our_pspec;
@@ -226,7 +226,7 @@ void SnapshotRemoveRequest<I>::remove_object_map() {
 
   {
     RWLock::RLocker owner_lock(image_ctx.owner_lock);
-    RWLock::WLocker snap_locker(image_ctx.snap_lock);
+    RWLock::WLocker image_locker(image_ctx.image_lock);
     RWLock::RLocker object_map_locker(image_ctx.object_map_lock);
     if (image_ctx.object_map != nullptr) {
       ldout(cct, 5) << dendl;
@@ -333,7 +333,7 @@ void SnapshotRemoveRequest<I>::remove_snap_context() {
   CephContext *cct = image_ctx.cct;
   ldout(cct, 5) << dendl;
 
-  RWLock::WLocker snap_locker(image_ctx.snap_lock);
+  RWLock::WLocker image_locker(image_ctx.image_lock);
   image_ctx.rm_snap(m_snap_namespace, m_snap_name, m_snap_id);
 }
 
@@ -341,7 +341,7 @@ template <typename I>
 int SnapshotRemoveRequest<I>::scan_for_parents(
     cls::rbd::ParentImageSpec &pspec) {
   I &image_ctx = this->m_image_ctx;
-  ceph_assert(image_ctx.snap_lock.is_locked());
+  ceph_assert(image_ctx.image_lock.is_locked());
   ceph_assert(image_ctx.parent_lock.is_locked());
 
   if (pspec.pool_id != -1) {
index b25b991f4d1c734301c9eda805c752230096bacf..e85db29b862a670d334ac63e7be376874e857868 100644 (file)
@@ -41,7 +41,7 @@ SnapshotRenameRequest<I>::SnapshotRenameRequest(I &image_ctx,
 template <typename I>
 journal::Event SnapshotRenameRequest<I>::create_event(uint64_t op_tid) const {
   I &image_ctx = this->m_image_ctx;
-  ceph_assert(image_ctx.snap_lock.is_locked());
+  ceph_assert(image_ctx.image_lock.is_locked());
 
   std::string src_snap_name;
   auto snap_info_it = image_ctx.snap_info.find(m_snap_id);
@@ -79,7 +79,7 @@ void SnapshotRenameRequest<I>::send_rename_snap() {
   I &image_ctx = this->m_image_ctx;
   ceph_assert(image_ctx.owner_lock.is_locked());
   RWLock::RLocker md_locker(image_ctx.md_lock);
-  RWLock::RLocker snap_locker(image_ctx.snap_lock);
+  RWLock::RLocker image_locker(image_ctx.image_lock);
 
   CephContext *cct = image_ctx.cct;
   ldout(cct, 5) << this << " " << __func__ << dendl;
index 596570a397b97ceb9dcc61a1e1ed9082ae6de02d..a7363f08e9cd79a7163695f1c617ca544b8f5c8d 100644 (file)
@@ -47,7 +47,7 @@ public:
                    << m_object_num << dendl;
 
     {
-      RWLock::RLocker snap_locker(image_ctx.snap_lock);
+      RWLock::RLocker image_locker(image_ctx.image_lock);
       if (m_object_num < m_head_num_objects &&
           m_snap_object_map != nullptr &&
           !image_ctx.object_map->object_may_exist(m_object_num) &&
@@ -140,7 +140,7 @@ void SnapshotRollbackRequest<I>::send_resize_image() {
   uint64_t current_size;
   {
     RWLock::RLocker owner_locker(image_ctx.owner_lock);
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     current_size = image_ctx.get_image_size(CEPH_NOSNAP);
   }
 
@@ -188,7 +188,7 @@ void SnapshotRollbackRequest<I>::send_get_snap_object_map() {
   CephContext *cct = image_ctx.cct;
   {
     RWLock::RLocker owner_locker(image_ctx.owner_lock);
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     object_map_enabled = (image_ctx.object_map != nullptr);
     int r = image_ctx.get_flags(m_snap_id, &flags);
     if (r < 0) {
@@ -239,7 +239,7 @@ void SnapshotRollbackRequest<I>::send_rollback_object_map() {
 
   {
     RWLock::RLocker owner_locker(image_ctx.owner_lock);
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     RWLock::WLocker object_map_lock(image_ctx.object_map_lock);
     if (image_ctx.object_map != nullptr) {
       CephContext *cct = image_ctx.cct;
@@ -284,7 +284,7 @@ void SnapshotRollbackRequest<I>::send_rollback_objects() {
   RWLock::RLocker owner_locker(image_ctx.owner_lock);
   uint64_t num_objects;
   {
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     num_objects = Striper::get_num_objects(image_ctx.layout,
                                            image_ctx.get_current_size());
   }
@@ -327,7 +327,7 @@ Context *SnapshotRollbackRequest<I>::send_refresh_object_map() {
   bool object_map_enabled;
   {
     RWLock::RLocker owner_locker(image_ctx.owner_lock);
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     object_map_enabled = (image_ctx.object_map != nullptr);
   }
   if (!object_map_enabled) {
@@ -400,7 +400,7 @@ void SnapshotRollbackRequest<I>::apply() {
   I &image_ctx = this->m_image_ctx;
 
   RWLock::RLocker owner_locker(image_ctx.owner_lock);
-  RWLock::WLocker snap_locker(image_ctx.snap_lock);
+  RWLock::WLocker image_locker(image_ctx.image_lock);
   if (image_ctx.object_map != nullptr) {
     std::swap(m_object_map, image_ctx.object_map);
   }
index 4a58dbc0bbacbd15eec3809ab82c28d1c4c8c21d..44bb1c296faa6439d588565a62c996ee6e0659f1 100644 (file)
@@ -311,7 +311,7 @@ template <typename I>
 int SnapshotUnprotectRequest<I>::verify_and_send_unprotect_snap_start() {
   I &image_ctx = this->m_image_ctx;
   RWLock::RLocker md_locker(image_ctx.md_lock);
-  RWLock::RLocker snap_locker(image_ctx.snap_lock);
+  RWLock::RLocker image_locker(image_ctx.image_lock);
 
   CephContext *cct = image_ctx.cct;
   if ((image_ctx.features & RBD_FEATURE_LAYERING) == 0) {
index 4dc6bde7e3240f747572b3b67c480e4b920887b9..5770a2c047d2d366385b76fc31b40964f41aa559 100644 (file)
@@ -131,7 +131,7 @@ public:
     }
 
     {
-      RWLock::RLocker snap_locker(image_ctx.snap_lock);
+      RWLock::RLocker image_locker(image_ctx.image_lock);
       if (image_ctx.object_map != nullptr &&
           !image_ctx.object_map->object_may_exist(m_object_no)) {
         // can skip because the object does not exist
@@ -206,12 +206,12 @@ public:
     ldout(m_cct, 20) << dendl;
 
     image_ctx.owner_lock.get_read();
-    image_ctx.snap_lock.get_read();
+    image_ctx.image_lock.get_read();
     if (image_ctx.object_map == nullptr) {
       // possible that exclusive lock was lost in background
       lderr(m_cct) << "object map is not initialized" << dendl;
 
-      image_ctx.snap_lock.put_read();
+      image_ctx.image_lock.put_read();
       image_ctx.owner_lock.put_read();
       finish_op(-EINVAL);
       return;
@@ -221,7 +221,7 @@ public:
     m_finish_op_ctx = image_ctx.exclusive_lock->start_op(&r);
     if (m_finish_op_ctx == nullptr) {
       lderr(m_cct) << "lost exclusive lock" << dendl;
-      image_ctx.snap_lock.put_read();
+      image_ctx.image_lock.put_read();
       image_ctx.owner_lock.put_read();
       finish_op(r);
       return;
@@ -238,7 +238,7 @@ public:
 
     // NOTE: state machine might complete before we reach here
     image_ctx.object_map_lock.put_write();
-    image_ctx.snap_lock.put_read();
+    image_ctx.image_lock.put_read();
     image_ctx.owner_lock.put_read();
     if (!sent) {
       finish_op(0);
@@ -300,7 +300,7 @@ public:
     bool sent;
     {
       RWLock::RLocker owner_locker(image_ctx.owner_lock);
-      RWLock::RLocker snap_locker(image_ctx.snap_lock);
+      RWLock::RLocker image_locker(image_ctx.image_lock);
 
       assert(image_ctx.exclusive_lock->is_lock_owner());
       assert(image_ctx.object_map != nullptr);
@@ -473,7 +473,7 @@ void SparsifyRequest<I>::sparsify_objects() {
 
   uint64_t objects = 0;
   {
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     objects = image_ctx.get_object_count(CEPH_NOSNAP);
   }
 
index cecf37b3e6138936b3764f6993051b1e2926d204..2dd8d6c47a9640e4aa21a1c7552c36589150a552 100644 (file)
@@ -74,7 +74,7 @@ public:
                 image_ctx.exclusive_lock->is_lock_owner());
 
     {
-      RWLock::RLocker snap_locker(image_ctx.snap_lock);
+      RWLock::RLocker image_locker(image_ctx.image_lock);
       if (image_ctx.object_map != nullptr &&
           !image_ctx.object_map->object_may_exist(m_object_no)) {
         return 1;
@@ -188,7 +188,7 @@ void TrimRequest<I>::send_pre_trim() {
   }
 
   {
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     if (image_ctx.object_map != nullptr) {
       ldout(image_ctx.cct, 5) << this << " send_pre_trim: "
                               << " delete_start_min=" << m_delete_start_min
@@ -218,7 +218,7 @@ void TrimRequest<I>::send_copyup_objects() {
   bool has_snapshots;
   uint64_t parent_overlap;
   {
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     RWLock::RLocker parent_locker(image_ctx.parent_lock);
 
     snapc = image_ctx.snapc;
@@ -284,7 +284,7 @@ void TrimRequest<I>::send_post_trim() {
   ceph_assert(image_ctx.owner_lock.is_locked());
 
   {
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     if (image_ctx.object_map != nullptr) {
       ldout(image_ctx.cct, 5) << this << " send_post_trim:"
                               << " delete_start_min=" << m_delete_start_min
@@ -326,7 +326,7 @@ void TrimRequest<I>::send_clean_boundary() {
 
   ::SnapContext snapc;
   {
-    RWLock::RLocker snap_locker(image_ctx.snap_lock);
+    RWLock::RLocker image_locker(image_ctx.image_lock);
     snapc = image_ctx.snapc;
   }
 
index 7816a507e90d7d90fc22adc041b09f3a089077d8..17320a31100e5331af168fa0b12e4beeb75cb35a 100644 (file)
@@ -291,7 +291,7 @@ public:
                               Return(true)));
       } else {
         expect.WillOnce(DoAll(WithArg<7>(Invoke([&mock_image_ctx, snap_id, state](Context *ctx) {
-                                  ceph_assert(mock_image_ctx.image_ctx->snap_lock.is_locked());
+                                  ceph_assert(mock_image_ctx.image_ctx->image_lock.is_locked());
                                   ceph_assert(mock_image_ctx.image_ctx->object_map_lock.is_wlocked());
                                   mock_image_ctx.image_ctx->object_map->aio_update<Context>(
                                     snap_id, 0, 1, state, boost::none, {}, false, ctx);
index b38fbed9a4ef3ea153b5d9256d85b725b1fef6b4..e1b1547de4c48810c855dc5828109efbf3e7424b 100644 (file)
@@ -194,7 +194,7 @@ TEST_F(TestMockExclusiveLockPostAcquireRequest, Success) {
   MockJournal mock_journal;
   MockJournalPolicy mock_journal_policy;
   expect_test_features(mock_image_ctx, RBD_FEATURE_JOURNALING,
-                       mock_image_ctx.snap_lock, true);
+                       mock_image_ctx.image_lock, true);
   expect_get_journal_policy(mock_image_ctx, mock_journal_policy);
   expect_journal_disabled(mock_journal_policy, false);
   expect_create_journal(mock_image_ctx, &mock_journal);
@@ -230,7 +230,7 @@ TEST_F(TestMockExclusiveLockPostAcquireRequest, SuccessRefresh) {
   MockObjectMap mock_object_map;
   expect_test_features(mock_image_ctx, RBD_FEATURE_OBJECT_MAP, false);
   expect_test_features(mock_image_ctx, RBD_FEATURE_JOURNALING,
-                       mock_image_ctx.snap_lock, false);
+                       mock_image_ctx.image_lock, false);
   expect_handle_prepare_lock_complete(mock_image_ctx);
 
   C_SaferCond acquire_ctx;
@@ -261,7 +261,7 @@ TEST_F(TestMockExclusiveLockPostAcquireRequest, SuccessJournalDisabled) {
   expect_open_object_map(mock_image_ctx, mock_object_map, 0);
 
   expect_test_features(mock_image_ctx, RBD_FEATURE_JOURNALING,
-                       mock_image_ctx.snap_lock, false);
+                       mock_image_ctx.image_lock, false);
   expect_handle_prepare_lock_complete(mock_image_ctx);
 
   C_SaferCond acquire_ctx;
@@ -291,7 +291,7 @@ TEST_F(TestMockExclusiveLockPostAcquireRequest, SuccessObjectMapDisabled) {
   MockJournal mock_journal;
   MockJournalPolicy mock_journal_policy;
   expect_test_features(mock_image_ctx, RBD_FEATURE_JOURNALING,
-                       mock_image_ctx.snap_lock, true);
+                       mock_image_ctx.image_lock, true);
   expect_get_journal_policy(mock_image_ctx, mock_journal_policy);
   expect_journal_disabled(mock_journal_policy, false);
   expect_create_journal(mock_image_ctx, &mock_journal);
@@ -351,7 +351,7 @@ TEST_F(TestMockExclusiveLockPostAcquireRequest, RefreshLockDisabled) {
   MockObjectMap mock_object_map;
   expect_test_features(mock_image_ctx, RBD_FEATURE_OBJECT_MAP, false);
   expect_test_features(mock_image_ctx, RBD_FEATURE_JOURNALING,
-                       mock_image_ctx.snap_lock, false);
+                       mock_image_ctx.image_lock, false);
   expect_handle_prepare_lock_complete(mock_image_ctx);
 
   C_SaferCond acquire_ctx;
@@ -384,7 +384,7 @@ TEST_F(TestMockExclusiveLockPostAcquireRequest, JournalError) {
   MockJournal *mock_journal = new MockJournal();
   MockJournalPolicy mock_journal_policy;
   expect_test_features(mock_image_ctx, RBD_FEATURE_JOURNALING,
-                       mock_image_ctx.snap_lock, true);
+                       mock_image_ctx.image_lock, true);
   expect_get_journal_policy(mock_image_ctx, mock_journal_policy);
   expect_journal_disabled(mock_journal_policy, false);
   expect_create_journal(mock_image_ctx, mock_journal);
@@ -422,7 +422,7 @@ TEST_F(TestMockExclusiveLockPostAcquireRequest, AllocateJournalTagError) {
   MockJournal *mock_journal = new MockJournal();
   MockJournalPolicy mock_journal_policy;
   expect_test_features(mock_image_ctx, RBD_FEATURE_JOURNALING,
-                       mock_image_ctx.snap_lock, true);
+                       mock_image_ctx.image_lock, true);
   expect_get_journal_policy(mock_image_ctx, mock_journal_policy);
   expect_journal_disabled(mock_journal_policy, false);
   expect_create_journal(mock_image_ctx, mock_journal);
@@ -490,7 +490,7 @@ TEST_F(TestMockExclusiveLockPostAcquireRequest, OpenObjectMapTooBig) {
   MockJournal mock_journal;
   MockJournalPolicy mock_journal_policy;
   expect_test_features(mock_image_ctx, RBD_FEATURE_JOURNALING,
-                       mock_image_ctx.snap_lock, true);
+                       mock_image_ctx.image_lock, true);
   expect_get_journal_policy(mock_image_ctx, mock_journal_policy);
   expect_journal_disabled(mock_journal_policy, false);
   expect_create_journal(mock_image_ctx, &mock_journal);
index 8d38b117e509f55eb2c26e7016b81076b267c4d7..03a668da260d5641b7fb4df4ed951f91ab26dec8 100644 (file)
@@ -363,7 +363,7 @@ TEST_F(TestMockIoCopyupRequest, StandardWithSnaps) {
 
   librbd::ImageCtx *ictx;
   ASSERT_EQ(0, open_image(m_image_name, &ictx));
-  ictx->snap_lock.get_write();
+  ictx->image_lock.get_write();
   ictx->add_snap(cls::rbd::UserSnapshotNamespace(), "2", 2, ictx->size,
                  ictx->parent_md, RBD_PROTECTION_STATUS_UNPROTECTED,
                  0, {});
@@ -371,7 +371,7 @@ TEST_F(TestMockIoCopyupRequest, StandardWithSnaps) {
                  ictx->parent_md, RBD_PROTECTION_STATUS_UNPROTECTED,
                  0, {});
   ictx->snapc = {2, {2, 1}};
-  ictx->snap_lock.put_write();
+  ictx->image_lock.put_write();
 
   MockTestImageCtx mock_parent_image_ctx(*ictx->parent);
   MockTestImageCtx mock_image_ctx(*ictx, &mock_parent_image_ctx);
@@ -458,12 +458,12 @@ TEST_F(TestMockIoCopyupRequest, CopyOnReadWithSnaps) {
 
   librbd::ImageCtx *ictx;
   ASSERT_EQ(0, open_image(m_image_name, &ictx));
-  ictx->snap_lock.get_write();
+  ictx->image_lock.get_write();
   ictx->add_snap(cls::rbd::UserSnapshotNamespace(), "1", 1, ictx->size,
                  ictx->parent_md, RBD_PROTECTION_STATUS_UNPROTECTED,
                  0, {});
   ictx->snapc = {1, {1}};
-  ictx->snap_lock.put_write();
+  ictx->image_lock.put_write();
 
   MockTestImageCtx mock_parent_image_ctx(*ictx->parent);
   MockTestImageCtx mock_image_ctx(*ictx, &mock_parent_image_ctx);
@@ -588,7 +588,7 @@ TEST_F(TestMockIoCopyupRequest, DeepCopyWithPostSnaps) {
 
   librbd::ImageCtx *ictx;
   ASSERT_EQ(0, open_image(m_image_name, &ictx));
-  ictx->snap_lock.get_write();
+  ictx->image_lock.get_write();
   ictx->add_snap(cls::rbd::UserSnapshotNamespace(), "3", 3, ictx->size,
                  ictx->parent_md, RBD_PROTECTION_STATUS_UNPROTECTED,
                  0, {});
@@ -599,7 +599,7 @@ TEST_F(TestMockIoCopyupRequest, DeepCopyWithPostSnaps) {
                  ictx->parent_md, RBD_PROTECTION_STATUS_UNPROTECTED,
                  0, {});
   ictx->snapc = {3, {3, 2, 1}};
-  ictx->snap_lock.put_write();
+  ictx->image_lock.put_write();
 
   MockTestImageCtx mock_parent_image_ctx(*ictx->parent);
   MockTestImageCtx mock_image_ctx(*ictx, &mock_parent_image_ctx);
@@ -656,7 +656,7 @@ TEST_F(TestMockIoCopyupRequest, DeepCopyWithPreAndPostSnaps) {
 
   librbd::ImageCtx *ictx;
   ASSERT_EQ(0, open_image(m_image_name, &ictx));
-  ictx->snap_lock.get_write();
+  ictx->image_lock.get_write();
   ictx->add_snap(cls::rbd::UserSnapshotNamespace(), "4", 4, ictx->size,
                  ictx->parent_md, RBD_PROTECTION_STATUS_UNPROTECTED,
                  0, {});
@@ -670,7 +670,7 @@ TEST_F(TestMockIoCopyupRequest, DeepCopyWithPreAndPostSnaps) {
                  ictx->parent_md, RBD_PROTECTION_STATUS_UNPROTECTED,
                  0, {});
   ictx->snapc = {4, {4, 3, 2, 1}};
-  ictx->snap_lock.put_write();
+  ictx->image_lock.put_write();
 
   MockTestImageCtx mock_parent_image_ctx(*ictx->parent);
   MockTestImageCtx mock_image_ctx(*ictx, &mock_parent_image_ctx);
@@ -1008,12 +1008,12 @@ TEST_F(TestMockIoCopyupRequest, CopyupError) {
 
   librbd::ImageCtx *ictx;
   ASSERT_EQ(0, open_image(m_image_name, &ictx));
-  ictx->snap_lock.get_write();
+  ictx->image_lock.get_write();
   ictx->add_snap(cls::rbd::UserSnapshotNamespace(), "1", 1, ictx->size,
                  ictx->parent_md, RBD_PROTECTION_STATUS_UNPROTECTED,
                  0, {});
   ictx->snapc = {1, {1}};
-  ictx->snap_lock.put_write();
+  ictx->image_lock.put_write();
 
   MockTestImageCtx mock_parent_image_ctx(*ictx->parent);
   MockTestImageCtx mock_image_ctx(*ictx, &mock_parent_image_ctx);
index b7137b5c612b20537bfab02c2731fe486836b14c..9a2f522a75622f8a59575e03ceb06591e2c57d91 100644 (file)
@@ -328,7 +328,7 @@ TEST_F(TestJournalReplay, SnapCreate) {
   ASSERT_EQ(1, current_entry);
 
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     ASSERT_NE(CEPH_NOSNAP, ictx->get_snap_id(cls::rbd::UserSnapshotNamespace(),
                                             "snap"));
   }
@@ -395,7 +395,7 @@ TEST_F(TestJournalReplay, SnapUnprotect) {
                                             "snap"));
   uint64_t snap_id;
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     snap_id = ictx->get_snap_id(cls::rbd::UserSnapshotNamespace(), "snap");
     ASSERT_NE(CEPH_NOSNAP, snap_id);
   }
@@ -450,7 +450,7 @@ TEST_F(TestJournalReplay, SnapRename) {
                                             "snap"));
   uint64_t snap_id;
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     snap_id = ictx->get_snap_id(cls::rbd::UserSnapshotNamespace(), "snap");
     ASSERT_NE(CEPH_NOSNAP, snap_id);
   }
@@ -478,7 +478,7 @@ TEST_F(TestJournalReplay, SnapRename) {
   ASSERT_EQ(0, ictx->state->refresh());
 
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     snap_id = ictx->get_snap_id(cls::rbd::UserSnapshotNamespace(), "snap2");
     ASSERT_NE(CEPH_NOSNAP, snap_id);
   }
@@ -563,7 +563,7 @@ TEST_F(TestJournalReplay, SnapRemove) {
   ASSERT_EQ(initial_entry + 2, current_entry);
 
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     uint64_t snap_id = ictx->get_snap_id(cls::rbd::UserSnapshotNamespace(),
                                         "snap");
     ASSERT_EQ(CEPH_NOSNAP, snap_id);
index 296411413acf677ae8c7eda546d132e24a985010..aa073c3215eb05ed8a2926a9913e7c0f1fe199be 100644 (file)
@@ -62,7 +62,7 @@ struct MockImageCtx {
       lock_tag(image_ctx.lock_tag),
       owner_lock(image_ctx.owner_lock),
       md_lock(image_ctx.md_lock),
-      snap_lock(image_ctx.snap_lock),
+      image_lock(image_ctx.image_lock),
       timestamp_lock(image_ctx.timestamp_lock),
       parent_lock(image_ctx.parent_lock),
       object_map_lock(image_ctx.object_map_lock),
@@ -193,7 +193,7 @@ struct MockImageCtx {
 
   MOCK_CONST_METHOD1(test_features, bool(uint64_t test_features));
   MOCK_CONST_METHOD2(test_features, bool(uint64_t test_features,
-                                         const RWLock &in_snap_lock));
+                                         const RWLock &in_image_lock));
 
   MOCK_CONST_METHOD1(test_op_features, bool(uint64_t op_features));
 
@@ -249,7 +249,7 @@ struct MockImageCtx {
 
   RWLock &owner_lock;
   RWLock &md_lock;
-  RWLock &snap_lock;
+  RWLock &image_lock;
   RWLock &timestamp_lock;
   RWLock &parent_lock;
   RWLock &object_map_lock;
index f4b2ed43889a4edc1fb086ffce170cc2a75c9794..c6ecce1a28ef6bf432847c87d8038177c7430513 100644 (file)
@@ -41,7 +41,7 @@ TEST_F(TestMockObjectMapInvalidateRequest, UpdatesInMemoryFlag) {
 
   {
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
@@ -67,7 +67,7 @@ TEST_F(TestMockObjectMapInvalidateRequest, UpdatesHeadOnDiskFlag) {
 
   {
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
@@ -96,7 +96,7 @@ TEST_F(TestMockObjectMapInvalidateRequest, UpdatesSnapOnDiskFlag) {
 
   {
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
@@ -117,7 +117,7 @@ TEST_F(TestMockObjectMapInvalidateRequest, SkipOnDiskUpdateWithoutLock) {
 
   {
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
@@ -141,7 +141,7 @@ TEST_F(TestMockObjectMapInvalidateRequest, IgnoresOnDiskUpdateFailure) {
 
   {
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
index 6aa8d1427964fbd764dbe912ba35fe6fa463b839..90b5e750b1e6ac7d2ffd392858bf650d08390adf 100644 (file)
@@ -23,7 +23,7 @@ using ::testing::StrEq;
 class TestMockObjectMapSnapshotCreateRequest : public TestMockFixture {
 public:
   void inject_snap_info(librbd::ImageCtx *ictx, uint64_t snap_id) {
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     RWLock::RLocker parent_locker(ictx->parent_lock);
     ictx->add_snap(cls::rbd::UserSnapshotNamespace(), "snap name", snap_id,
                   ictx->size, ictx->parent_md,
@@ -100,7 +100,7 @@ TEST_F(TestMockObjectMapSnapshotCreateRequest, Success) {
   AsyncRequest<> *request = new SnapshotCreateRequest(
     *ictx, &object_map, snap_id, &cond_ctx);
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
@@ -126,7 +126,7 @@ TEST_F(TestMockObjectMapSnapshotCreateRequest, ReadMapError) {
   AsyncRequest<> *request = new SnapshotCreateRequest(
     *ictx, &object_map, snap_id, &cond_ctx);
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
@@ -153,7 +153,7 @@ TEST_F(TestMockObjectMapSnapshotCreateRequest, WriteMapError) {
   AsyncRequest<> *request = new SnapshotCreateRequest(
     *ictx, &object_map, snap_id, &cond_ctx);
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
@@ -181,7 +181,7 @@ TEST_F(TestMockObjectMapSnapshotCreateRequest, AddSnapshotError) {
   AsyncRequest<> *request = new SnapshotCreateRequest(
     *ictx, &object_map, snap_id, &cond_ctx);
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
@@ -209,7 +209,7 @@ TEST_F(TestMockObjectMapSnapshotCreateRequest, FlagCleanObjects) {
   AsyncRequest<> *request = new SnapshotCreateRequest(
     *ictx, &object_map, snap_id, &cond_ctx);
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
index b9dd81689b47225121a9d110c51cccd009d9b18d..ee85500dad6d207b6ebbc6d5b666d317caedd17e 100644 (file)
@@ -90,7 +90,7 @@ TEST_F(TestMockObjectMapSnapshotRemoveRequest, Success) {
     *ictx, &object_map, snap_id, &cond_ctx);
   {
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
@@ -119,7 +119,7 @@ TEST_F(TestMockObjectMapSnapshotRemoveRequest, LoadMapMissing) {
     *ictx, &object_map, snap_id, &cond_ctx);
   {
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
@@ -127,7 +127,7 @@ TEST_F(TestMockObjectMapSnapshotRemoveRequest, LoadMapMissing) {
   {
     // shouldn't invalidate the HEAD revision when we fail to load
     // the already deleted snapshot
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     uint64_t flags;
     ASSERT_EQ(0, ictx->get_flags(CEPH_NOSNAP, &flags));
     ASSERT_EQ(0U, flags & RBD_FLAG_OBJECT_MAP_INVALID);
@@ -155,7 +155,7 @@ TEST_F(TestMockObjectMapSnapshotRemoveRequest, LoadMapError) {
     *ictx, &object_map, snap_id, &cond_ctx);
   {
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
@@ -182,7 +182,7 @@ TEST_F(TestMockObjectMapSnapshotRemoveRequest, RemoveSnapshotMissing) {
     *ictx, &object_map, snap_id, &cond_ctx);
   {
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
@@ -210,7 +210,7 @@ TEST_F(TestMockObjectMapSnapshotRemoveRequest, RemoveSnapshotError) {
     *ictx, &object_map, snap_id, &cond_ctx);
   {
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
@@ -239,7 +239,7 @@ TEST_F(TestMockObjectMapSnapshotRemoveRequest, RemoveMapMissing) {
     *ictx, &object_map, snap_id, &cond_ctx);
   {
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx.wait());
@@ -268,7 +268,7 @@ TEST_F(TestMockObjectMapSnapshotRemoveRequest, RemoveMapError) {
     *ictx, &object_map, snap_id, &cond_ctx);
   {
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(-EINVAL, cond_ctx.wait());
@@ -296,7 +296,7 @@ TEST_F(TestMockObjectMapSnapshotRemoveRequest, ScrubCleanObjects) {
   {
     librbd::ObjectMap om(*ictx, ictx->snap_id);
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     om.set_object_map(object_map);
     om.aio_save(&cond_ctx1);
   }
@@ -315,7 +315,7 @@ TEST_F(TestMockObjectMapSnapshotRemoveRequest, ScrubCleanObjects) {
     *ictx, &object_map, snap_id, &cond_ctx2);
   {
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::WLocker snap_locker(ictx->snap_lock);
+    RWLock::WLocker image_locker(ictx->image_lock);
     request->send();
   }
   ASSERT_EQ(0, cond_ctx2.wait());
index 19d89d10f030f588e5bed7ff2bc279b87c3e5593..e27993fbe2cbbf22f78e3b8bb89b951b4392e6f3 100644 (file)
@@ -99,7 +99,7 @@ TEST_F(TestMockObjectMapSnapshotRollbackRequest, ReadMapError) {
   ASSERT_EQ(0, cond_ctx.wait());
 
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     uint64_t flags;
     ASSERT_EQ(0, ictx->get_flags(snap_id, &flags));
     ASSERT_NE(0U, flags & RBD_FLAG_OBJECT_MAP_INVALID);
@@ -131,7 +131,7 @@ TEST_F(TestMockObjectMapSnapshotRollbackRequest, WriteMapError) {
   ASSERT_EQ(0, cond_ctx.wait());
 
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     uint64_t flags;
     ASSERT_EQ(0, ictx->get_flags(snap_id, &flags));
     ASSERT_EQ(0U, flags & RBD_FLAG_OBJECT_MAP_INVALID);
index b7de4d1868ea83386aaf5c56a4423ef1884ccb4e..c7221567ccf6e5dc95083e3ff4e51d152720ad32 100644 (file)
@@ -83,7 +83,7 @@ TEST_F(TestMockObjectMapUpdateRequest, UpdateInMemory) {
     *ictx, &object_map, CEPH_NOSNAP, 0, object_map.size(), OBJECT_NONEXISTENT,
     OBJECT_EXISTS, {}, false, &cond_ctx);
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     RWLock::WLocker object_map_locker(ictx->object_map_lock);
     req->send();
   }
@@ -115,7 +115,7 @@ TEST_F(TestMockObjectMapUpdateRequest, UpdateHeadOnDisk) {
     *ictx, &object_map, CEPH_NOSNAP, 0, object_map.size(), OBJECT_NONEXISTENT,
     OBJECT_EXISTS, {}, false, &cond_ctx);
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     RWLock::WLocker object_map_locker(ictx->object_map_lock);
     req->send();
   }
@@ -145,7 +145,7 @@ TEST_F(TestMockObjectMapUpdateRequest, UpdateSnapOnDisk) {
     *ictx, &object_map, snap_id, 0, object_map.size(), OBJECT_NONEXISTENT,
     OBJECT_EXISTS, {}, false, &cond_ctx);
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     RWLock::WLocker object_map_locker(ictx->object_map_lock);
     req->send();
   }
@@ -173,7 +173,7 @@ TEST_F(TestMockObjectMapUpdateRequest, UpdateOnDiskError) {
     *ictx, &object_map, CEPH_NOSNAP, 0, object_map.size(), OBJECT_NONEXISTENT,
     OBJECT_EXISTS, {}, false, &cond_ctx);
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     RWLock::WLocker object_map_locker(ictx->object_map_lock);
     req->send();
   }
@@ -204,7 +204,7 @@ TEST_F(TestMockObjectMapUpdateRequest, RebuildSnapOnDisk) {
     *ictx, &object_map, snap_id, 0, object_map.size(), OBJECT_EXISTS_CLEAN,
     boost::optional<uint8_t>(), {}, false, &cond_ctx);
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     RWLock::WLocker object_map_locker(ictx->object_map_lock);
     req->send();
   }
@@ -242,7 +242,7 @@ TEST_F(TestMockObjectMapUpdateRequest, BatchUpdate) {
     *ictx, &object_map, CEPH_NOSNAP, 0, object_map.size(), OBJECT_NONEXISTENT,
     OBJECT_EXISTS, {}, false, &cond_ctx);
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     RWLock::WLocker object_map_locker(ictx->object_map_lock);
     req->send();
   }
@@ -267,7 +267,7 @@ TEST_F(TestMockObjectMapUpdateRequest, IgnoreMissingObjectMap) {
     *ictx, &object_map, CEPH_NOSNAP, 0, object_map.size(), OBJECT_NONEXISTENT,
     OBJECT_EXISTS, {}, true, &cond_ctx);
   {
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     RWLock::WLocker object_map_locker(ictx->object_map_lock);
     req->send();
   }
index 1f9148faa07f865d849e730552869838678916d5..06494933a983de1521ac547acbd99a193f5d6e7a 100644 (file)
@@ -78,8 +78,8 @@ struct TestDeepCopy : public TestFixture {
                      dst_snap_name));
       uint64_t src_size, dst_size;
       {
-        RWLock::RLocker src_locker(m_src_ictx->snap_lock);
-        RWLock::RLocker dst_locker(m_dst_ictx->snap_lock);
+        RWLock::RLocker src_locker(m_src_ictx->image_lock);
+        RWLock::RLocker dst_locker(m_dst_ictx->image_lock);
         src_size = m_src_ictx->get_image_size(m_src_ictx->snap_id);
         dst_size = m_dst_ictx->get_image_size(m_dst_ictx->snap_id);
       }
@@ -87,10 +87,10 @@ struct TestDeepCopy : public TestFixture {
 
       if (m_dst_ictx->test_features(RBD_FEATURE_LAYERING)) {
         bool flags_set;
-        RWLock::RLocker dst_locker(m_dst_ictx->snap_lock);
+        RWLock::RLocker dst_locker(m_dst_ictx->image_lock);
         EXPECT_EQ(0, m_dst_ictx->test_flags(m_dst_ictx->snap_id,
                                             RBD_FLAG_OBJECT_MAP_INVALID,
-                                            m_dst_ictx->snap_lock, &flags_set));
+                                            m_dst_ictx->image_lock, &flags_set));
         EXPECT_FALSE(flags_set);
       }
 
@@ -357,7 +357,7 @@ struct TestDeepCopy : public TestFixture {
   void test_stress() {
     uint64_t initial_size, size;
     {
-      RWLock::RLocker src_locker(m_src_ictx->snap_lock);
+      RWLock::RLocker src_locker(m_src_ictx->image_lock);
       size = initial_size = m_src_ictx->get_image_size(CEPH_NOSNAP);
     }
 
@@ -429,7 +429,7 @@ struct TestDeepCopy : public TestFixture {
         std::cout << "resize: " << new_size << std::endl;
         ASSERT_EQ(0, m_src_ictx->operations->resize(new_size, true, no_op));
         {
-          RWLock::RLocker src_locker(m_src_ictx->snap_lock);
+          RWLock::RLocker src_locker(m_src_ictx->image_lock);
           size = m_src_ictx->get_image_size(CEPH_NOSNAP);
         }
         ASSERT_EQ(new_size, size);
index c220b2bee6eb19293a3b252660ec59f6e9aa3c79..dacfdac66571e5b679005741796bde73431f1aa6 100644 (file)
@@ -97,8 +97,8 @@ struct TestMigration : public TestFixture {
                      librbd::ImageCtx *dst_ictx) {
     uint64_t src_size, dst_size;
     {
-      RWLock::RLocker src_locker(src_ictx->snap_lock);
-      RWLock::RLocker dst_locker(dst_ictx->snap_lock);
+      RWLock::RLocker src_locker(src_ictx->image_lock);
+      RWLock::RLocker dst_locker(dst_ictx->image_lock);
       src_size = src_ictx->get_image_size(src_ictx->snap_id);
       dst_size = dst_ictx->get_image_size(dst_ictx->snap_id);
     }
@@ -109,10 +109,10 @@ struct TestMigration : public TestFixture {
 
     if (dst_ictx->test_features(RBD_FEATURE_LAYERING)) {
       bool flags_set;
-      RWLock::RLocker dst_locker(dst_ictx->snap_lock);
+      RWLock::RLocker dst_locker(dst_ictx->image_lock);
       EXPECT_EQ(0, dst_ictx->test_flags(dst_ictx->snap_id,
                                         RBD_FLAG_OBJECT_MAP_INVALID,
-                                        dst_ictx->snap_lock, &flags_set));
+                                        dst_ictx->image_lock, &flags_set));
       EXPECT_FALSE(flags_set);
     }
 
index d939ffb94d0d7f50609378dfc56c52acf7dd8191..3003d68b335f171992a2ee71b61c9bdee646f660 100644 (file)
@@ -199,7 +199,7 @@ TEST_F(TestObjectMap, DISABLED_StressTest) {
       });
 
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    RWLock::RLocker snap_locker(ictx->snap_lock);
+    RWLock::RLocker image_locker(ictx->image_lock);
     RWLock::WLocker object_map_locker(ictx->object_map_lock);
     ASSERT_TRUE(ictx->object_map != nullptr);
 
index e95be0b8a9f20504cfe8820e4975173b80876720..3ca8297abebb9d6550c56091a2457b0f8c034d31 100644 (file)
@@ -894,7 +894,7 @@ TEST_F(TestInternal, ResizeCopyup)
 
   {
     // hide the parent from the snapshot
-    RWLock::WLocker snap_locker(ictx2->snap_lock);
+    RWLock::WLocker image_locker(ictx2->image_lock);
     ictx2->snap_info.begin()->second.parent = librbd::ParentImageInfo();
   }
 
@@ -961,7 +961,7 @@ TEST_F(TestInternal, DiscardCopyup)
 
   {
     // hide the parent from the snapshot
-    RWLock::WLocker snap_locker(ictx2->snap_lock);
+    RWLock::WLocker image_locker(ictx2->image_lock);
     ictx2->snap_info.begin()->second.parent = librbd::ParentImageInfo();
   }
 
index 12f445d6c88bcec8dd6e24a3e7d8caf77ba3f6fa..727d0db838193bbc581fe21b41ac9a098bbaa0ec 100644 (file)
@@ -1332,7 +1332,7 @@ TEST_F(TestMockJournal, AppendDisabled) {
   };
 
   InSequence seq;
-  RWLock::RLocker snap_locker(mock_image_ctx.snap_lock);
+  RWLock::RLocker image_locker(mock_image_ctx.image_lock);
   EXPECT_CALL(mock_image_ctx, get_journal_policy()).WillOnce(
     Return(ictx->get_journal_policy()));
   ASSERT_TRUE(mock_journal.is_journal_appending());
index 41672c73f33f1e198d858dc932a0474ba3eeb523..98c91173492162fec9d4fc90690539b0811976f7 100644 (file)
@@ -180,7 +180,7 @@ TEST_F(TestMockObjectMap, NonDetainedUpdate) {
   C_SaferCond update_ctx1;
   C_SaferCond update_ctx2;
   {
-    RWLock::RLocker snap_locker(mock_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(mock_image_ctx.image_lock);
     RWLock::WLocker object_map_locker(mock_image_ctx.object_map_lock);
     mock_object_map.aio_update(CEPH_NOSNAP, 0, 1, {}, {}, false, &update_ctx1);
     mock_object_map.aio_update(CEPH_NOSNAP, 1, 1, {}, {}, false, &update_ctx2);
@@ -238,7 +238,7 @@ TEST_F(TestMockObjectMap, DetainedUpdate) {
   C_SaferCond update_ctx3;
   C_SaferCond update_ctx4;
   {
-    RWLock::RLocker snap_locker(mock_image_ctx.snap_lock);
+    RWLock::RLocker image_locker(mock_image_ctx.image_lock);
     RWLock::WLocker object_map_locker(mock_image_ctx.object_map_lock);
     mock_object_map.aio_update(CEPH_NOSNAP, 1, 4, 1, {}, {}, false,
                                &update_ctx1);
index 35850d3a39aab7171df52c093bc041558b7eea3b..f0a448127157c44d1ae268a19bcd591ecd84c296 100644 (file)
@@ -158,7 +158,7 @@ public:
 
 TEST_F(TestMockImageDeleterSnapshotPurgeRequest, Success) {
   {
-    RWLock::WLocker snap_locker(m_local_image_ctx->snap_lock);
+    RWLock::WLocker image_locker(m_local_image_ctx->image_lock);
     m_local_image_ctx->add_snap(cls::rbd::UserSnapshotNamespace{}, "snap1", 1,
                                 0, {}, RBD_PROTECTION_STATUS_PROTECTED, 0, {});
     m_local_image_ctx->add_snap(cls::rbd::UserSnapshotNamespace{}, "snap2", 2,
@@ -206,7 +206,7 @@ TEST_F(TestMockImageDeleterSnapshotPurgeRequest, Success) {
 
 TEST_F(TestMockImageDeleterSnapshotPurgeRequest, OpenError) {
   {
-    RWLock::WLocker snap_locker(m_local_image_ctx->snap_lock);
+    RWLock::WLocker image_locker(m_local_image_ctx->image_lock);
     m_local_image_ctx->add_snap(cls::rbd::UserSnapshotNamespace{}, "snap1", 1,
                                 0, {}, RBD_PROTECTION_STATUS_UNPROTECTED, 0,
                                 {});
@@ -230,7 +230,7 @@ TEST_F(TestMockImageDeleterSnapshotPurgeRequest, OpenError) {
 
 TEST_F(TestMockImageDeleterSnapshotPurgeRequest, AcquireLockError) {
   {
-    RWLock::WLocker snap_locker(m_local_image_ctx->snap_lock);
+    RWLock::WLocker image_locker(m_local_image_ctx->image_lock);
     m_local_image_ctx->add_snap(cls::rbd::UserSnapshotNamespace{}, "snap1", 1,
                                 0, {}, RBD_PROTECTION_STATUS_UNPROTECTED, 0,
                                 {});
@@ -256,7 +256,7 @@ TEST_F(TestMockImageDeleterSnapshotPurgeRequest, AcquireLockError) {
 
 TEST_F(TestMockImageDeleterSnapshotPurgeRequest, SnapUnprotectBusy) {
   {
-    RWLock::WLocker snap_locker(m_local_image_ctx->snap_lock);
+    RWLock::WLocker image_locker(m_local_image_ctx->image_lock);
     m_local_image_ctx->add_snap(cls::rbd::UserSnapshotNamespace{}, "snap1", 1,
                                 0, {}, RBD_PROTECTION_STATUS_PROTECTED, 0, {});
   }
@@ -290,7 +290,7 @@ TEST_F(TestMockImageDeleterSnapshotPurgeRequest, SnapUnprotectBusy) {
 
 TEST_F(TestMockImageDeleterSnapshotPurgeRequest, SnapUnprotectError) {
   {
-    RWLock::WLocker snap_locker(m_local_image_ctx->snap_lock);
+    RWLock::WLocker image_locker(m_local_image_ctx->image_lock);
     m_local_image_ctx->add_snap(cls::rbd::UserSnapshotNamespace{}, "snap1", 1,
                                 0, {}, RBD_PROTECTION_STATUS_PROTECTED, 0, {});
   }
@@ -324,7 +324,7 @@ TEST_F(TestMockImageDeleterSnapshotPurgeRequest, SnapUnprotectError) {
 
 TEST_F(TestMockImageDeleterSnapshotPurgeRequest, SnapRemoveError) {
   {
-    RWLock::WLocker snap_locker(m_local_image_ctx->snap_lock);
+    RWLock::WLocker image_locker(m_local_image_ctx->image_lock);
     m_local_image_ctx->add_snap(cls::rbd::UserSnapshotNamespace{}, "snap1", 1,
                                 0, {}, RBD_PROTECTION_STATUS_UNPROTECTED, 0,
                                 {});
@@ -359,7 +359,7 @@ TEST_F(TestMockImageDeleterSnapshotPurgeRequest, SnapRemoveError) {
 
 TEST_F(TestMockImageDeleterSnapshotPurgeRequest, CloseError) {
   {
-    RWLock::WLocker snap_locker(m_local_image_ctx->snap_lock);
+    RWLock::WLocker image_locker(m_local_image_ctx->image_lock);
     m_local_image_ctx->add_snap(cls::rbd::UserSnapshotNamespace{}, "snap1", 1,
                                 0, {}, RBD_PROTECTION_STATUS_UNPROTECTED, 0,
                                 {});
index ea64d03871355a72482008b7f28fb822143f480b..bdb7c833ae7a3f86f9b161fb36a0e224f9868d76 100644 (file)
@@ -158,7 +158,7 @@ public:
                                   false);
     EXPECT_EQ(0, ictx->state->open(0));
     {
-      RWLock::WLocker snap_locker(ictx->snap_lock);
+      RWLock::WLocker image_locker(ictx->image_lock);
       ictx->set_journal_policy(new librbd::journal::DisabledPolicy());
     }
 
@@ -178,7 +178,7 @@ public:
                                   false);
     EXPECT_EQ(0, ictx->state->open(0));
     {
-      RWLock::WLocker snap_locker(ictx->snap_lock);
+      RWLock::WLocker image_locker(ictx->image_lock);
       ictx->set_journal_policy(new librbd::journal::DisabledPolicy());
     }
 
index fbd3381116d280531640c2bed0e513e2cc3273c6..2503651678ee717d63746f4634417a9481beb8b4 100644 (file)
@@ -289,7 +289,7 @@ TEST_F(TestImageSync, SnapshotStress) {
   for (auto &snap_name : snap_names) {
     uint64_t remote_snap_id;
     {
-      RWLock::RLocker remote_snap_locker(m_remote_image_ctx->snap_lock);
+      RWLock::RLocker remote_image_locker(m_remote_image_ctx->image_lock);
       remote_snap_id = m_remote_image_ctx->get_snap_id(
         cls::rbd::UserSnapshotNamespace{}, snap_name);
     }
@@ -300,14 +300,14 @@ TEST_F(TestImageSync, SnapshotStress) {
       m_remote_image_ctx->state->snap_set(remote_snap_id, &ctx);
       ASSERT_EQ(0, ctx.wait());
 
-      RWLock::RLocker remote_snap_locker(m_remote_image_ctx->snap_lock);
+      RWLock::RLocker remote_image_locker(m_remote_image_ctx->image_lock);
       remote_size = m_remote_image_ctx->get_image_size(
         m_remote_image_ctx->snap_id);
     }
 
     uint64_t local_snap_id;
     {
-      RWLock::RLocker snap_locker(m_local_image_ctx->snap_lock);
+      RWLock::RLocker image_locker(m_local_image_ctx->image_lock);
       local_snap_id = m_local_image_ctx->get_snap_id(
         cls::rbd::UserSnapshotNamespace{}, snap_name);
     }
@@ -318,13 +318,13 @@ TEST_F(TestImageSync, SnapshotStress) {
       m_local_image_ctx->state->snap_set(local_snap_id, &ctx);
       ASSERT_EQ(0, ctx.wait());
 
-      RWLock::RLocker snap_locker(m_local_image_ctx->snap_lock);
+      RWLock::RLocker image_locker(m_local_image_ctx->image_lock);
       local_size = m_local_image_ctx->get_image_size(
         m_local_image_ctx->snap_id);
       bool flags_set;
       ASSERT_EQ(0, m_local_image_ctx->test_flags(m_local_image_ctx->snap_id,
                                                  RBD_FLAG_OBJECT_MAP_INVALID,
-                                                 m_local_image_ctx->snap_lock,
+                                                 m_local_image_ctx->image_lock,
                                                  &flags_set));
       ASSERT_FALSE(flags_set);
     }
index 14d66df135ff3889d6effecae787b89e05831879..6f2b0078e9cddd7b936a1b122904f36db96e7906 100644 (file)
@@ -556,7 +556,7 @@ void ImageReplayer<I>::handle_bootstrap(int r) {
 
   ceph_assert(m_local_journal == nullptr);
   {
-    RWLock::RLocker snap_locker(m_local_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(m_local_image_ctx->image_lock);
     if (m_local_image_ctx->journal != nullptr) {
       m_local_journal = m_local_image_ctx->journal;
       m_local_journal->add_listener(m_journal_listener);
@@ -1229,7 +1229,7 @@ void ImageReplayer<I>::handle_process_entry_ready(int r) {
 
   bool update_status = false;
   {
-    RWLock::RLocker snap_locker(m_local_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(m_local_image_ctx->image_lock);
     if (m_local_image_name != m_local_image_ctx->name) {
       m_local_image_name = m_local_image_ctx->name;
       update_status = true;
index fca5dadc7c43d8f257987661b3ebc89e4a3d7dba..5677f03562864bccc257abac42f8fee293b8158f 100644 (file)
@@ -207,7 +207,7 @@ void ImageSync<I>::send_copy_image() {
   librbd::deep_copy::ObjectNumber object_number;
   int r = 0;
   {
-    RWLock::RLocker snap_locker(m_remote_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(m_remote_image_ctx->image_lock);
     ceph_assert(!m_client_meta->sync_points.empty());
     auto &sync_point = m_client_meta->sync_points.front();
     snap_id_end = m_remote_image_ctx->get_snap_id(
index a0e9fd908976d01b1b34690f933add658635667d..4a59047236e649f5dde2273cf594a93eeec68a9f 100644 (file)
@@ -35,7 +35,7 @@ void SnapshotPurgeRequest<I>::open_image() {
   m_image_ctx = I::create("", m_image_id, nullptr, m_io_ctx, false);
 
   {
-    RWLock::WLocker snap_locker(m_image_ctx->snap_lock);
+    RWLock::WLocker image_locker(m_image_ctx->image_lock);
     m_image_ctx->set_journal_policy(new JournalPolicy());
   }
 
@@ -94,7 +94,7 @@ void SnapshotPurgeRequest<I>::handle_acquire_lock(int r) {
   }
 
   {
-    RWLock::RLocker snap_locker(m_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx->image_lock);
     m_snaps = m_image_ctx->snaps;
   }
   snap_unprotect();
@@ -108,10 +108,10 @@ void SnapshotPurgeRequest<I>::snap_unprotect() {
   }
 
   librados::snap_t snap_id = m_snaps.back();
-  m_image_ctx->snap_lock.get_read();
+  m_image_ctx->image_lock.get_read();
   int r = m_image_ctx->get_snap_namespace(snap_id, &m_snap_namespace);
   if (r < 0) {
-    m_image_ctx->snap_lock.put_read();
+    m_image_ctx->image_lock.put_read();
 
     derr << "failed to get snap namespace: " << cpp_strerror(r) << dendl;
     m_ret_val = r;
@@ -121,7 +121,7 @@ void SnapshotPurgeRequest<I>::snap_unprotect() {
 
   r = m_image_ctx->get_snap_name(snap_id, &m_snap_name);
   if (r < 0) {
-    m_image_ctx->snap_lock.put_read();
+    m_image_ctx->image_lock.put_read();
 
     derr << "failed to get snap name: " << cpp_strerror(r) << dendl;
     m_ret_val = r;
@@ -132,7 +132,7 @@ void SnapshotPurgeRequest<I>::snap_unprotect() {
   bool is_protected;
   r = m_image_ctx->is_snap_protected(snap_id, &is_protected);
   if (r < 0) {
-    m_image_ctx->snap_lock.put_read();
+    m_image_ctx->image_lock.put_read();
 
     derr << "failed to get snap protection status: " << cpp_strerror(r)
          << dendl;
@@ -140,7 +140,7 @@ void SnapshotPurgeRequest<I>::snap_unprotect() {
     close_image();
     return;
   }
-  m_image_ctx->snap_lock.put_read();
+  m_image_ctx->image_lock.put_read();
 
   if (!is_protected) {
     snap_remove();
@@ -186,7 +186,7 @@ void SnapshotPurgeRequest<I>::handle_snap_unprotect(int r) {
 
   {
     // avoid the need to refresh to delete the newly unprotected snapshot
-    RWLock::RLocker snap_locker(m_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(m_image_ctx->image_lock);
     librados::snap_t snap_id = m_snaps.back();
     auto snap_info_it = m_image_ctx->snap_info.find(snap_id);
     if (snap_info_it != m_image_ctx->snap_info.end()) {
index 90a45090874f22e019d05acb64d9c6f484113479..857c744c6875baf5408bd06590d8f856de3f1782 100644 (file)
@@ -184,7 +184,7 @@ void TrashMoveRequest<I>::open_image() {
 
   {
     // don't attempt to open the journal
-    RWLock::WLocker snap_locker(m_image_ctx->snap_lock);
+    RWLock::WLocker image_locker(m_image_ctx->image_lock);
     m_image_ctx->set_journal_policy(new JournalPolicy());
   }
 
index 7ce21b4bfe0783215a073307df0af4603d3e3807..a97cc0fcd3303bcbfb252b07c266649893617bb2 100644 (file)
@@ -311,9 +311,9 @@ void BootstrapRequest<I>::handle_open_local_image(int r) {
 
   I *local_image_ctx = (*m_local_image_ctx);
   {
-    local_image_ctx->snap_lock.get_read();
+    local_image_ctx->image_lock.get_read();
     if (local_image_ctx->journal == nullptr) {
-      local_image_ctx->snap_lock.put_read();
+      local_image_ctx->image_lock.put_read();
 
       derr << "local image does not support journaling" << dendl;
       m_ret_val = -EINVAL;
@@ -323,7 +323,7 @@ void BootstrapRequest<I>::handle_open_local_image(int r) {
 
     r = (*m_local_image_ctx)->journal->is_resync_requested(m_do_resync);
     if (r < 0) {
-      local_image_ctx->snap_lock.put_read();
+      local_image_ctx->image_lock.put_read();
 
       derr << "failed to check if a resync was requested" << dendl;
       m_ret_val = r;
@@ -335,7 +335,7 @@ void BootstrapRequest<I>::handle_open_local_image(int r) {
     m_local_tag_data = local_image_ctx->journal->get_tag_data();
     dout(10) << "local tag=" << m_local_tag_tid << ", "
              << "local tag data=" << m_local_tag_data << dendl;
-    local_image_ctx->snap_lock.put_read();
+    local_image_ctx->image_lock.put_read();
   }
 
   if (m_local_tag_data.mirror_uuid != m_remote_mirror_uuid && !m_primary) {
@@ -481,9 +481,9 @@ void BootstrapRequest<I>::create_local_image() {
   dout(15) << "local_image_id=" << m_local_image_id << dendl;
   update_progress("CREATE_LOCAL_IMAGE");
 
-  m_remote_image_ctx->snap_lock.get_read();
+  m_remote_image_ctx->image_lock.get_read();
   std::string image_name = m_remote_image_ctx->name;
-  m_remote_image_ctx->snap_lock.put_read();
+  m_remote_image_ctx->image_lock.put_read();
 
   Context *ctx = create_context_callback<
     BootstrapRequest<I>, &BootstrapRequest<I>::handle_create_local_image>(
index db934f50586f821979c0acf89d2571cc1c6ffae3..9aef91541650d715f3e8069a32e86976d2e025f8 100644 (file)
@@ -73,7 +73,7 @@ void CreateImageRequest<I>::create_image() {
   Context *ctx = create_context_callback<
     klass, &klass::handle_create_image>(this);
 
-  RWLock::RLocker snap_locker(m_remote_image_ctx->snap_lock);
+  RWLock::RLocker image_locker(m_remote_image_ctx->image_lock);
 
   auto& config{
     reinterpret_cast<CephContext*>(m_local_io_ctx.cct())->_conf};
@@ -323,7 +323,7 @@ void CreateImageRequest<I>::clone_image() {
   std::string snap_name;
   cls::rbd::SnapshotNamespace snap_namespace;
   {
-    RWLock::RLocker remote_snap_locker(m_remote_parent_image_ctx->snap_lock);
+    RWLock::RLocker remote_image_locker(m_remote_parent_image_ctx->image_lock);
     auto it = m_remote_parent_image_ctx->snap_info.find(
       m_remote_parent_spec.snap_id);
     if (it != m_remote_parent_image_ctx->snap_info.end()) {
@@ -407,7 +407,7 @@ void CreateImageRequest<I>::finish(int r) {
 template <typename I>
 int CreateImageRequest<I>::validate_parent() {
   RWLock::RLocker owner_locker(m_remote_image_ctx->owner_lock);
-  RWLock::RLocker snap_locker(m_remote_image_ctx->snap_lock);
+  RWLock::RLocker image_locker(m_remote_image_ctx->image_lock);
 
   m_remote_parent_spec = m_remote_image_ctx->parent_md.spec;
 
index 6314eb7dd35aca752ed0a045c56b6d9232edb51c..aebf1c3d95d9dd96577dfa40fc5c753893b5c2da 100644 (file)
@@ -174,7 +174,7 @@ template <typename I>
 bool EventPreprocessor<I>::prune_snap_map(SnapSeqs *snap_seqs) {
   bool pruned = false;
 
-  RWLock::RLocker snap_locker(m_local_image_ctx.snap_lock);
+  RWLock::RLocker image_locker(m_local_image_ctx.image_lock);
   for (auto it = snap_seqs->begin(); it != snap_seqs->end(); ) {
     auto current_it(it++);
     if (m_local_image_ctx.snap_info.count(current_it->second) == 0) {
index d405e32433600fab55d34234dde6caad6ae1b8a9..35ca37a896bea6cb8299c8961f0c98da9d72eb90 100644 (file)
@@ -46,7 +46,7 @@ struct MirrorExclusiveLockPolicy : public librbd::exclusive_lock::Policy {
     int r = -EROFS;
     {
       RWLock::RLocker owner_locker(image_ctx->owner_lock);
-      RWLock::RLocker snap_locker(image_ctx->snap_lock);
+      RWLock::RLocker image_locker(image_ctx->image_lock);
       if (image_ctx->journal == nullptr || image_ctx->journal->is_tag_owner()) {
         r = 0;
       }
@@ -108,7 +108,7 @@ void OpenLocalImageRequest<I>::send_open_image() {
                                  m_local_io_ctx, false);
   {
     RWLock::WLocker owner_locker((*m_local_image_ctx)->owner_lock);
-    RWLock::WLocker snap_locker((*m_local_image_ctx)->snap_lock);
+    RWLock::WLocker image_locker((*m_local_image_ctx)->image_lock);
     (*m_local_image_ctx)->set_exclusive_lock_policy(
       new MirrorExclusiveLockPolicy<I>(*m_local_image_ctx));
     (*m_local_image_ctx)->set_journal_policy(
index 2cfed5e6b44b192d4fe9cf59f336b266ec3bbe48..3da2987271eaa7c851ca89c1914aedf1855358d6 100644 (file)
@@ -57,7 +57,7 @@ void SyncPointPruneRequest<I>::send() {
   } else {
     // if we have more than one sync point or invalid sync points,
     // trim them off
-    RWLock::RLocker snap_locker(m_remote_image_ctx->snap_lock);
+    RWLock::RLocker image_locker(m_remote_image_ctx->image_lock);
     std::set<std::string> snap_names;
     for (auto it = m_client_meta_copy.sync_points.rbegin();
          it != m_client_meta_copy.sync_points.rend(); ++it) {