Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751677AbdGZVTX (ORCPT ); Wed, 26 Jul 2017 17:19:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:32827 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751651AbdGZVTT (ORCPT ); Wed, 26 Jul 2017 17:19:19 -0400 Subject: Re: nowait aio return value To: Jason Baron Cc: jack@suse.cz, axboe@kernel.dk, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org References: <04be5a78-3428-c09e-bc63-5061fa568ea5@akamai.com> From: Goldwyn Rodrigues Message-ID: <08dcc9f7-2460-c262-3194-062a25052bc3@suse.de> Date: Wed, 26 Jul 2017 16:19:34 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <04be5a78-3428-c09e-bc63-5061fa568ea5@akamai.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1064 Lines: 32 Hi Jason, On 07/26/2017 01:45 PM, Jason Baron wrote: > Hi, > > In testing nowait aio on ext4, I found that when appending to a file > the return value is EAGAIN/EWOULDBLOCK, because as mentioned in the > commit this will potentially trigger an allocation. However, the EAGAIN, > seems somewhat misleading to me, in that if I continuously try the > write, it will never succeed. > > The relevant commit is: > 728fbc0 ext4: nowait aio support > > As you can see there, failure to get the inode lock is treated as > EAGAIN, which seems more appropriate to me, as its very likely > to succeed on subsequent calls. > > Perhaps, it could be switched to -EINVAL, or something else? > Thanks for testing this. I would suggest read it as -EWOULDBLOCK. The idea is to pass on IOCB_NOWAIT when we don't want the I/O process to wait, and if it does return -EWOULDBLOCK. If it returns EWOULDBLOCK in case of allocation, you may want to allocate your file space before performing the I/O. I would return EINVAL in case the parameters passed are incorrect. -- Goldwyn