All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Dave Chinner <david@fromorbit.com>
Cc: Christoph Hellwig <hch@lst.de>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH RFC] iomap: only return IO error if no data has been transferred
Date: Wed, 18 Nov 2020 08:26:50 -0700	[thread overview]
Message-ID: <9ef0f890-f115-41f3-15fc-28f21810379f@kernel.dk> (raw)
In-Reply-To: <20201118071941.GN7391@dread.disaster.area>

On 11/18/20 12:19 AM, Dave Chinner wrote:
> On Tue, Nov 17, 2020 at 03:17:18PM -0700, Jens Axboe wrote:
>> If we've successfully transferred some data in __iomap_dio_rw(),
>> don't mark an error for a latter segment in the dio.
>>
>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>>
>> ---
>>
>> Debugging an issue with io_uring, which uses IOCB_NOWAIT for the
>> IO. If we do parts of an IO, then once that completes, we still
>> return -EAGAIN if we ran into a problem later on. That seems wrong,
>> normal convention would be to return the short IO instead. For the
>> -EAGAIN case, io_uring will retry later parts without IOCB_NOWAIT
>> and complete it successfully.
> 
> So you are getting a write IO that is split across an allocated
> extent and a hole, and the second mapping is returning EAGAIN
> because allocation would be required? This sort of split extent IO
> is fairly common, so I'm not sure that splitting them into two
> separate IOs may not be the best approach.

The case I seem to be hitting is this one:

if (iocb->ki_flags & IOCB_NOWAIT) {
	if (filemap_range_has_page(mapping, pos, end)) {
                  ret = -EAGAIN;
                  goto out_free_dio;
	}
	flags |= IOMAP_NOWAIT;
}

in __iomap_dio_rw(), which isn't something we can detect upfront like IO
over a multiple extents...

> I'd kinda like to avoid have NOWAIT IO return different results to a
> non-NOWAIT IO with exactly the same setup contexts i.e. either we
> get -EAGAIN or the IO completes as a whole just like a non-NOWAIT IO
> would.
> 
> So perhaps it would be better to fix the IOMAP_NOWAIT handling in XFS
> to return EAGAIN if the mapping found doesn't span the entire range
> of the IO. That way we avoid the potential "partial NOWAIT"
> behaviour for IOs that span extent boundaries....
> 
> Thoughts?

I don't think it's unreasonable to expect NOWAIT to return short IO,
there are various cases that can lead to that (we've identified two
already). There's just no way to always know upfront if we'd need to
block to satisfy a given range, and returning -EAGAIN in general when IO
has been done is misleading imho.

-- 
Jens Axboe


  parent reply	other threads:[~2020-11-18 15:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17 22:17 [PATCH RFC] iomap: only return IO error if no data has been transferred Jens Axboe
2020-11-18  7:09 ` Christoph Hellwig
2020-11-18  7:19 ` Dave Chinner
2020-11-18  7:55   ` Dave Chinner
2020-11-18 15:26   ` Jens Axboe [this message]
2020-11-18 20:37     ` Dave Chinner
2020-11-18 21:00       ` Jens Axboe
2020-11-18 21:15         ` Dave Chinner
2020-11-18 21:19           ` Jens Axboe
2020-11-18 21:33             ` Dave Chinner
2020-11-18 21:36               ` Jens Axboe
2020-11-18 21:48                 ` Dave Chinner
2020-11-18 21:55                   ` Jens Axboe
2020-11-18 22:21                     ` Dave Chinner
2020-11-26 14:00 ` [iomap] b258228a4e: Assertion_failed kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9ef0f890-f115-41f3-15fc-28f21810379f@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.