]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: don't attempt to (re-)update the object map for CoW
authorJason Dillaman <dillaman@redhat.com>
Thu, 21 May 2015 19:22:13 +0000 (15:22 -0400)
committerJason Dillaman <dillaman@redhat.com>
Fri, 5 Jun 2015 16:24:27 +0000 (12:24 -0400)
The AbstractWrite state machine has already taken care of updating
the object map to the correct state.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/CopyupRequest.cc

index 689c0cfac15f9fadf5ed664d2f3cbe7265550594..e8b6130f897d84ded8cf9e76ec89f44e6469ef3f 100644 (file)
@@ -270,17 +270,20 @@ private:
       RWLock::RLocker owner_locker(m_ictx->owner_lock);
       RWLock::RLocker snap_locker(m_ictx->snap_lock);
       if (m_ictx->object_map.enabled()) {
+        bool copy_on_read = m_pending_requests.empty();
         if (!m_ictx->image_watcher->is_lock_owner()) {
-         ldout(m_ictx->cct, 20) << "exclusive lock not held for copyup request"
-                                << dendl;
-          assert(m_pending_requests.empty());
+          ldout(m_ictx->cct, 20) << "exclusive lock not held for copyup request"
+                                 << dendl;
+          assert(copy_on_read);
           return true;
         }
 
         RWLock::WLocker object_map_locker(m_ictx->object_map_lock);
-        if (m_ictx->object_map[m_object_no] != OBJECT_EXISTS ||
-            !m_ictx->snaps.empty()) {
+        if (copy_on_read && m_ictx->object_map[m_object_no] != OBJECT_EXISTS) {
+          // CoW already updates the HEAD object map
           m_snap_ids.push_back(CEPH_NOSNAP);
+        }
+        if (!m_ictx->snaps.empty()) {
           m_snap_ids.insert(m_snap_ids.end(), m_ictx->snaps.begin(),
                             m_ictx->snaps.end());
         }