From patchwork Thu Jul 2 17:12:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bryn M. Reeves" X-Patchwork-Id: 33730 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n62H75X2001332 for ; Thu, 2 Jul 2009 17:07:06 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id E125561ACDE; Thu, 2 Jul 2009 13:07:04 -0400 (EDT) Received: from int-mx2.corp.redhat.com ([172.16.27.26]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n62H73nt007532 for ; Thu, 2 Jul 2009 13:07:03 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n62H723i006777 for ; Thu, 2 Jul 2009 13:07:02 -0400 Received: from [10.33.0.40] (breeves.fab.redhat.com [10.33.0.40]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n62H71Kq016165 for ; Thu, 2 Jul 2009 13:07:01 -0400 From: "Bryn M. Reeves" To: dm-devel@redhat.com Date: Thu, 02 Jul 2009 18:12:19 +0100 Message-Id: <1246554739.20189.156.camel@breeves.fab.redhat.com> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 X-loop: dm-devel@redhat.com Subject: [dm-devel] [RFC] directio and aio-max-nr X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com The number of available aio contexts is limited by the fs.aio-max-nr sysctl. This means it's possible for the io_setup() call that the directio path checker uses in its libcheck_init() to fail with EAGAIN if there are already aio-max-nr outstanding event contexts allocated. On a system with several users of the aio interface it's possible for this to happen, e.g. when running multipath -ll, leading to output like this: sdb: ownership set to 200a0d1c5f449bf01 sdb: not found in pathvec sdb: mask = 0xc sdb: path checker = directio (config file default) io_setup failed sda: ownership set to 200a0d1c5f449bf01 sda: not found in pathvec sda: mask = 0xc sda: path checker = directio (config file default) io_setup failed [...] create: 200a0d1c5f449bf01 n/a Inventec,IX3150-FS200 [size=1.6T][features=0][hwhandler=0] \_ round-robin 0 [prio=0][undef] \_ 1:0:0:0 sdb 8:16 [undef][faulty] \_ round-robin 0 [prio=0][undef] \_ 0:0:0:0 sda 8:0 [undef][faulty] There's nothing wrong with the paths but since the checker cannot allocate an aio context it is unable to determine the path status and reports them as faulty. Of course, the administrator should be monitoring the use of aio on the system and setting fs.aio-max-nr to an appropriate value but we're seeing quite frequent reports of this problem (particularly for Oracle users with NetApp storage as the NetApp defaults to the directio checker) and the use of aio by the directio checker is not currently documented. I think it's worth documenting this interaction in the FAQ (patch attached). It think it may also be worth trying to make this more robust or at least warning the administrator of the problem. So far, the reports I've seen of this problem have affected users running multipath -ll manually since this will create new checkers for each path. Since multipathd starts before most aio-using applications will start it's able to grab the contexts that it needs. In principal though it would be possible for multipathd to run into problems if for e.g. a user added new storage to the system post-boot. In this situation I'm not sure if it's best to keep trying to allocate an aio context indefinitely in the checker thread or to fail immediately and warn the administrator of the situation? Regards, Bryn. The fs.aio-max-nr parameter interacts with the directio path checker and other users of the aio interfaces on the system. Document the parameter and the errors seen when it is set too low in the FAQ. --- FAQ | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/FAQ b/FAQ index 35dc2f9..5ceb32b 100644 --- a/FAQ +++ b/FAQ @@ -63,3 +63,34 @@ current/default config like so: lvm dumpconfig > /etc/lvm/lvm.conf (tip from Christophe Saout) + +4. I see a lot of "io_setup failed" message using the directio checker +====================================================================== + +The directio path checker makes use of the asynchronous I/O API (aio) provided +by modern Linux systems. Asynchronous I/O allows an application to submit I/O +requests asynchronously and be notified later of their completion status. To +allow this, we must allocate an asynchronous I/O context (an object of type +aio_context_t) and this task is handled by the io_setup system call. + +A system wide limit on the number of AIO contexts that may be active +simultaneously is imposed via the aio-max-nr sysctl parameter. + +Once this limit has been reached further calls to io_setup will fail with the +error number EAGAIN leading to the "io_setup failed" messages seen for e.g. when +running "multipath -ll". + +To avoid this problem the number of available aio contexts should be increased +by setting the aio-max-nr parameter. This can be set on a one-time basis via the +/proc file system, for e.g.: + + # echo 131072 > /proc/sys/fs/aio-max-nr + +Doubles the number of available contexts from the default value of 65536. + +To make this setting persistent a line may be added to /etc/sysctl.conf: + + fs.aio-max-nr = 131072 + +Consult appropriate application and operating system tuning recommendations for +guidance on appropriate values for this parameter.