]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: report error and quit correctly when disk error happens.
authorPan Liu <wanjun.lp@alibaba-inc.com>
Wed, 6 Sep 2017 10:09:55 +0000 (18:09 +0800)
committerSage Weil <sage@redhat.com>
Tue, 6 Feb 2018 12:56:16 +0000 (06:56 -0600)
Signed-off-by: Pan Liu <wanjun.lp@alibaba-inc.com>
(cherry picked from commit ed3175895fa92929089f7507e7d173f557d61e27)

src/os/bluestore/KernelDevice.cc

index 05e46311949a0894b0dcf6648f6966c07eb084c9..4dd2f9ca03e478671874528de7b51af938f97810 100644 (file)
@@ -350,6 +350,7 @@ void KernelDevice::_aio_thread()
                                         aio, max);
     if (r < 0) {
       derr << __func__ << " got " << cpp_strerror(r) << dendl;
+      assert(0 == "got unexpected error from io_getevents");
     }
     if (r > 0) {
       dout(30) << __func__ << " got " << r << " completed aios" << dendl;
@@ -370,11 +371,21 @@ void KernelDevice::_aio_thread()
        io_since_flush.store(true);
 
        int r = aio[i]->get_return_value();
-       dout(10) << __func__ << " finished aio " << aio[i] << " r " << r
-                << " ioc " << ioc
-                << " with " << (ioc->num_running.load() - 1)
-                << " aios left" << dendl;
-       assert(r >= 0);
+       if (r < 0) {
+         derr << __func__ << " got " << cpp_strerror(r) << dendl;
+         assert(0 == "got unexpected error from io_getevents");
+       }
+       
+       if (aio[i]->length != (uint64_t)r) {
+         derr << "aio to " << aio[i]->offset << "~" << aio[i]->length
+              << " but returned: " << r << dendl;
+         assert(0 == "unexpected aio error");
+       }
+
+       dout(10) << __func__ << " finished aio " << aio[i] << " r " << r
+                << " ioc " << ioc
+                << " with " << (ioc->num_running.load() - 1)
+                << " aios left" << dendl;
 
        // NOTE: once num_running and we either call the callback or
        // call aio_wake we cannot touch ioc or aio[] as the caller