From: Alexey Sheplyakov Date: Fri, 12 Feb 2016 17:56:02 +0000 (+0300) Subject: FileJournal::_open: return the correct error code X-Git-Tag: v11.0.0~526^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7469ef3cba436299692fabef91afaf6f6d6d56c2;p=ceph.git FileJournal::_open: return the correct error code .. and print a more helpful error message. Unlike most of IO routines (open, creat, write*, read, close) io_setup does NOT set the errno, instead it returns the negated error code. Also -EAGAIN indicates the limit of available events has been exceeded. Signed-off-by: Alexey Sheplyakov --- diff --git a/src/os/filestore/FileJournal.cc b/src/os/filestore/FileJournal.cc index 7763c6f95f4d..ed93598a5e63 100644 --- a/src/os/filestore/FileJournal.cc +++ b/src/os/filestore/FileJournal.cc @@ -103,9 +103,16 @@ int FileJournal::_open(bool forwrite, bool create) aio_ctx = 0; ret = io_setup(128, &aio_ctx); if (ret < 0) { - ret = errno; - derr << "FileJournal::_open: unable to setup io_context " << cpp_strerror(ret) << dendl; - ret = -ret; + switch (ret) { + // Contrary to naive expectations -EAGIAN means ... + case -EAGAIN: + derr << "FileJournal::_open: user's limit of aio events exceeded. " + << "Try increasing /proc/sys/fs/aio-max-nr" << dendl; + break; + default: + derr << "FileJournal::_open: unable to setup io_context " << cpp_strerror(-ret) << dendl; + break; + } goto out_fd; } }