From f9f9e1b105167e6991f80b8d6e6b4973ea56ca31 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 28 Jul 2015 13:24:00 -0400 Subject: [PATCH] os/newstore: debug io_submit EAGAIN Signed-off-by: Sage Weil --- src/os/fs/FS.h | 6 ++++-- src/os/newstore/NewStore.cc | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/os/fs/FS.h b/src/os/fs/FS.h index 51c6363f13f..4b527324226 100644 --- a/src/os/fs/FS.h +++ b/src/os/fs/FS.h @@ -71,7 +71,7 @@ public: int max_iodepth; io_context_t ctx; - aio_queue_t(unsigned max_iodepth = 8) + aio_queue_t(unsigned max_iodepth) : max_iodepth(max_iodepth), ctx(0) { } @@ -91,7 +91,7 @@ public: } } - int submit(aio_t &aio) { + int submit(aio_t &aio, int *retries) { int attempts = 10; iocb *piocb = &aio.iocb; do { @@ -99,10 +99,12 @@ public: if (r < 0) { if (r == -EAGAIN && attempts-- > 0) { usleep(500); + (*retries)++; continue; } return r; } + assert(r == 1); } while (false); return 0; } diff --git a/src/os/newstore/NewStore.cc b/src/os/newstore/NewStore.cc index 1367e6e5bc1..6d75a3459b4 100644 --- a/src/os/newstore/NewStore.cc +++ b/src/os/newstore/NewStore.cc @@ -2624,7 +2624,8 @@ int NewStore::queue_transactions( void NewStore::_txc_aio_submit(TransContext *txc) { int num = txc->aios.size(); - dout(10) << __func__ << " submitting " << num << " aios" << dendl; + dout(10) << __func__ << " txc " << txc << " submitting " << num << dendl; + assert(num > 0); txc->num_aio.set(num); for (list::iterator p = txc->aios.begin(); p != txc->aios.end(); @@ -2636,7 +2637,10 @@ void NewStore::_txc_aio_submit(TransContext *txc) << " len " << q->iov_len << dendl; dout(30) << " fd " << aio.fd << " offset " << lseek64(aio.fd, 0, SEEK_CUR) << dendl; - int r = aio_queue.submit(*p); + int retries = 0; + int r = aio_queue.submit(*p, &retries); + if (retries) + derr << __func__ << " retries " << retries << dendl; if (r) { derr << " aio submit got " << cpp_strerror(r) << dendl; assert(r == 0);