]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/KernelDevice: helpful warning when aio limit exhausted 15116/head
authorSage Weil <sage@redhat.com>
Wed, 17 May 2017 13:38:51 +0000 (09:38 -0400)
committerSage Weil <sage@redhat.com>
Wed, 17 May 2017 13:38:51 +0000 (09:38 -0400)
Suggested-by: Dan Van Der Ster <daniel.vanderster@cern.ch>
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/KernelDevice.cc
src/os/fs/aio.h

index 52cab96bbdd4f0e38251b4a6ec6541a7f3dc9fdf..54795efd416ee36e6cf5ec79b99381180ded58bb 100644 (file)
@@ -145,15 +145,17 @@ int KernelDevice::open(const string& p)
     }
   }
 
+  r = _aio_start();
+  if (r < 0) {
+    goto out_fail;
+  }
+
   fs = FS::create_by_fd(fd_direct);
   assert(fs);
 
   // round size down to an even block
   size &= ~(block_size - 1);
 
-  r = _aio_start();
-  assert(r == 0);
-
   dout(1) << __func__
          << " size " << size
          << " (0x" << std::hex << size << std::dec << ", "
@@ -308,7 +310,12 @@ int KernelDevice::_aio_start()
     dout(10) << __func__ << dendl;
     int r = aio_queue.init();
     if (r < 0) {
-      derr << __func__ << " failed: " << cpp_strerror(r) << dendl;
+      if (r == -EAGAIN) {
+       derr << __func__ << " io_setup(2) failed with EAGAIN; "
+            << "try increasing /proc/sys/fs/aio-max-nr" << dendl;
+      } else {
+       derr << __func__ << " io_setup(2) failed: " << cpp_strerror(r) << dendl;
+      }
       return r;
     }
     aio_thread.create("bstore_aio");
index 35d99f2c94f5664c095a5e6171cadc00d2cefcfc..c4757158cc90aa076699a09fe2db627d0133eae5 100644 (file)
@@ -65,7 +65,14 @@ struct aio_queue_t {
 
   int init() {
     assert(ctx == 0);
-    return io_setup(max_iodepth, &ctx);
+    int r = io_setup(max_iodepth, &ctx);
+    if (r < 0) {
+      if (ctx) {
+       io_destroy(ctx);
+       ctx = 0;
+      }
+    }
+    return r;
   }
   void shutdown() {
     if (ctx) {