]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: AioRequest::send no longer returns a result
authorJason Dillaman <dillaman@redhat.com>
Thu, 9 Apr 2015 17:33:09 +0000 (13:33 -0400)
committerJason Dillaman <dillaman@redhat.com>
Fri, 24 Jul 2015 13:59:56 +0000 (09:59 -0400)
The librados calls used by AioRequest::send should always return
zero unless there is a bug.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit c77bce3311ab62892eb8c1d883263ba7ed663b20)

Conflicts:
src/librbd/AioRequest.cc: trivial resolution
src/librbd/AioRequest.h: trivial resolution
src/librbd/internal.cc: trivial resolution

src/librbd/AioRequest.cc
src/librbd/AioRequest.h
src/librbd/internal.cc

index 5cf9a11d3b53f69f25c0d5bf55246a44d259e92a..dee6eba12f69a9e7c5ec92a9bc0731db058e7d1f 100644 (file)
@@ -85,8 +85,9 @@ namespace librbd {
     return true;
   }
 
-  int AioRead::send() {
-    ldout(m_ictx->cct, 20) << "send " << this << " " << m_oid << " " << m_object_off << "~" << m_object_len << dendl;
+  void AioRead::send() {
+    ldout(m_ictx->cct, 20) << "send " << this << " " << m_oid << " "
+                           << m_object_off << "~" << m_object_len << dendl;
 
     librados::AioCompletion *rados_completion =
       librados::Rados::aio_create_completion(this, rados_req_cb, NULL);
@@ -99,10 +100,11 @@ namespace librbd {
     } else {
       op.read(m_object_off, m_object_len, &m_read_data, NULL);
     }
+
     r = m_ioctx->aio_operate(m_oid, rados_completion, &op, flags, NULL);
+    assert(r == 0);
 
     rados_completion->release();
-    return r;
   }
 
   /** write **/
@@ -224,16 +226,17 @@ namespace librbd {
     return finished;
   }
 
-  int AbstractWrite::send() {
-    ldout(m_ictx->cct, 20) << "send " << this << " " << m_oid << " " << m_object_off << "~" << m_object_len << dendl;
+  void AbstractWrite::send() {
+    ldout(m_ictx->cct, 20) << "send " << this << " " << m_oid << " "
+                           << m_object_off << "~" << m_object_len << dendl;
     librados::AioCompletion *rados_completion =
       librados::Rados::aio_create_completion(this, NULL, rados_req_cb);
     int r;
     assert(m_write.size());
     r = m_ioctx->aio_operate(m_oid, rados_completion, &m_write,
                             m_snap_seq, m_snaps);
+    assert(r == 0);
     rados_completion->release();
-    return r;
   }
 
   void AbstractWrite::send_copyup() {
index d6103f9a195cfba50b992870b1ac5885139f314a..882b5359c828e796193327eb0792abd47b99fd58 100644 (file)
@@ -43,7 +43,7 @@ namespace librbd {
     }
 
     virtual bool should_complete(int r) = 0;
-    virtual int send() = 0;
+    virtual void send() = 0;
 
   protected:
     void read_from_parent(vector<pair<uint64_t,uint64_t> >& image_extents);
@@ -73,7 +73,7 @@ namespace librbd {
     }
     virtual ~AioRead() {}
     virtual bool should_complete(int r);
-    virtual int send();
+    virtual void send();
 
     ceph::bufferlist &data() {
       return m_read_data;
@@ -100,7 +100,7 @@ namespace librbd {
                  bool hide_enoent);
     virtual ~AbstractWrite() {}
     virtual bool should_complete(int r);
-    virtual int send();
+    virtual void send();
     void guard_write();
 
     bool has_parent() const {
index 69ebbea25a2357674f51fbe7e9d47193c1a5dc6d..7ae02bd5e621f395454a29666f8440e9177920b1 100644 (file)
@@ -2214,6 +2214,10 @@ reprotect_and_return_err:
     SimpleThrottle throttle(cct->_conf->rbd_concurrent_management_ops, false);
 
     for (uint64_t ono = 0; ono < overlap_objects; ono++) {
+      if (throttle.pending_error()) {
+        return throttle.wait_for_ret();
+      }
+
       {
        RWLock::RLocker l(ictx->parent_lock);
        // stop early if the parent went away - it just means
@@ -2237,12 +2241,7 @@ reprotect_and_return_err:
       Context *comp = new C_SimpleThrottle(&throttle);
       AioWrite *req = new AioWrite(ictx, oid, ono, 0, objectx, object_overlap,
                                   bl, snapc, CEPH_NOSNAP, comp);
-      r = req->send();
-      if (r < 0) {
-       lderr(cct) << "failed to flatten object " << oid << dendl;
-       goto err;
-      }
-
+      req->send();
       prog_ctx.update_progress(ono, overlap_objects);
     }
 
@@ -2987,8 +2986,7 @@ reprotect_and_return_err:
                                     objectx, object_overlap,
                                     bl, snapc, snap_id, req_comp);
        c->add_request();
-       r = req->send();
-        assert(r == 0);
+       req->send();
       }
     }
 
@@ -3070,10 +3068,10 @@ reprotect_and_return_err:
                          snapc, snap_id, req_comp);
       }
 
-      r = req->send();
-      assert(r == 0);
+      req->send();
     }
 
+    r = 0;
     if (ictx->object_cacher) {
       Mutex::Locker l(ictx->cache_lock);
       ictx->object_cacher->discard_set(ictx->object_set, extents);
@@ -3164,13 +3162,12 @@ reprotect_and_return_err:
                                    q->length, q->offset,
                                    cache_comp);
        } else {
-         r = req->send();
-          assert(r == 0);
+         req->send();
        }
       }
     }
 
-    c->finish_adding_requests(cct);
+    c->finish_adding_requests(ictx->cct);
     c->put();
 
     ictx->perfcounter->inc(l_librbd_aio_rd);