From: Goldwyn Rodrigues <rgoldwyn@suse.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Andreas Dilger <adilger@dilger.ca>,
Goldwyn Rodrigues <rgoldwyn@suse.com>,
Andi Kleen <ak@linux.intel.com>,
linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
darrick.wong@oracle.com
Subject: Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O
Date: Mon, 22 Jan 2018 21:18:55 -0600 [thread overview]
Message-ID: <2b11e24d-d09c-f7c4-db6d-6ecc1ce40719@suse.de> (raw)
In-Reply-To: <175784d7-70e7-3be1-47f0-ae67ab37e921@kernel.dk>
On 01/22/2018 01:13 PM, Jens Axboe wrote:
> On 1/22/18 12:10 PM, Andreas Dilger wrote:
>>
>>> On Jan 20, 2018, at 8:07 PM, Jens Axboe <axboe@kernel.dk> wrote:
>>>
>>> On 1/20/18 7:23 PM, Goldwyn Rodrigues wrote:
>>>>
>>>>
>>>> On 01/20/2018 08:11 PM, Andi Kleen wrote:
>>>>>
>>>>> It's likely there's a lot of code in user space that does
>>>>>
>>>>> if (write(..., N) < 0) handle error
>>>>>
>>>>> With your change it would need to be
>>>>>
>>>>> if (write(..., N) != N) handle error
>>>>>
>>>>> How much code is actually doing that?
>>>>>
>>>>> I can understand it fixes your artifical test suite, but it seems to me your
>>>>> change has a high potential to break a lot of existing user code
>>>>> in subtle ways. So it seems to be a bad idea.
>>>>
>>>>
>>>> Quoting 'man 2 write':
>>>>
>>>> RETURN VALUE
>>>> On success, the number of bytes written is returned (zero indicates
>>>> nothing was written). It is not an error if this number is smaller
>>>> than the number of bytes requested; this may happen for example because
>>>> the disk device was filled. See also NOTES.
>>>
>>> You can quote as much man page as you want - Andi is well aware of how
>>> read/write system call works, as I'm sure all of us are, that is not the
>>> issue. The issue is that there are potentially LOTS of applications out
>>> there that do not check for short writes, they do exactly what Andi
>>> speculated above. If you break it with this change, it doesn't matter
>>> what's in the man page. What matters is previous behavior, and that
>>> you are breaking user space. At that point nobody cares what's in the
>>> man page.
>>
>> Applications that don't handle partial writes are already broken with
>> buffered I/O, this change doesn't really make them more broken.
>
> Not disagreeing that they are broken, of course they are. But if you've
> been doing direct IO and not seeing short writes, then this could break
> your application. And if that's the case, it doesn't really help to say
I started exploring short writes and how direct I/O behaves on errors
after your suggestion to incorporate short writes in a previous
conversation [1]. I started looking into how midway errors with direct
I/O's are handled now and I stumble upon this issue.
> that their application was "already broken". I'd hate for a kernel
> upgrade to break them.
>
> I do wish we could make the change, and maybe we can. But it probably
> needs some safe guard proc entry to toggle the behavior, something we
> can drop in a few years when we're confident it won't break real
> applications.
Assuming we call it /proc/sys/fs/dio_short_writes(better names/paths?),
should it be enabled or disabled by default?
[1] https://www.spinics.net/lists/linux-block/msg15910.html
--
Goldwyn
next prev parent reply other threads:[~2018-01-23 3:18 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-19 0:57 [PATCH v5 1/2] Return bytes transferred for partial direct I/O Goldwyn Rodrigues
2018-01-19 0:57 ` [PATCH 2/2] xfs: remove assert to check bytes returned Goldwyn Rodrigues
2018-01-19 3:57 ` Dave Chinner
2018-01-19 4:23 ` Raphael Carvalho
2018-01-19 4:51 ` Dave Chinner
2018-01-19 2:13 ` [PATCH v5 1/2] Return bytes transferred for partial direct I/O Al Viro
2018-01-19 3:59 ` Dave Chinner
2018-01-19 6:31 ` Darrick J. Wong
2018-01-19 6:33 ` Al Viro
2018-01-20 19:47 ` Al Viro
2018-01-21 2:57 ` Goldwyn Rodrigues
2018-01-21 2:11 ` Andi Kleen
2018-01-21 2:23 ` Goldwyn Rodrigues
2018-01-21 3:07 ` Jens Axboe
2018-01-21 12:06 ` Goldwyn Rodrigues
2018-01-22 18:08 ` Andi Kleen
2018-01-22 19:10 ` Andreas Dilger
2018-01-22 19:13 ` Jens Axboe
2018-01-23 3:18 ` Goldwyn Rodrigues [this message]
2018-01-23 3:28 ` Jens Axboe
2018-01-23 6:35 ` Matthew Wilcox
2018-01-25 18:01 ` Goldwyn Rodrigues
2018-01-24 0:19 ` Andreas Dilger
2018-01-22 22:25 ` Elliott, Robert (Persistent Memory)
2018-01-22 23:14 ` Jens Axboe
2018-01-22 23:24 ` Bart Van Assche
2018-01-22 23:27 ` Jens Axboe
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=2b11e24d-d09c-f7c4-db6d-6ecc1ce40719@suse.de \
--to=rgoldwyn@suse.de \
--cc=adilger@dilger.ca \
--cc=ak@linux.intel.com \
--cc=axboe@kernel.dk \
--cc=darrick.wong@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=rgoldwyn@suse.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).