From: Jeremy Allison <[email protected]>
To: Stefan Metzmacher <[email protected]>, Jens Axboe <[email protected]>,
Anoop C S <[email protected]>,
Samba Technical <[email protected]>,
io-uring <[email protected]>
Subject: Re: Data Corruption bug with Samba's vfs_iouring and Linux 5.6.7/5.7rc3
Date: Wed, 6 May 2020 10:13:04 -0700 [thread overview]
Message-ID: <20200506171304.GC3447@jeremy-acer> (raw)
In-Reply-To: <20200506170344.GA32399@jeremy-acer>
On Wed, May 06, 2020 at 10:03:44AM -0700, Jeremy Allison via samba-technical wrote:
>
> Well we pay attention to the amount of data returned
> and only increment the next read request by the amount
> actually returned.
>
> I'm amazed that the Windows client doesn't seem to
> check this !
>
> > The attached test against liburing (git://git.kernel.dk/liburing) should
> > be able to demonstrate the problem. It can also be found in
> > https://github.com/metze-samba/liburing/tree/implicit-rwf-nowaithttps://github.com/metze-samba/liburing/commit/eb06dcfde747e46bd08bedf9def2e6cb536c39e3
> >
> >
> > I added the sqe->rw_flags = RWF_NOWAIT; line in order to demonstrate it
> > against the Ubuntu 5.3 and 5.4 kernels. They both seem to have the bug.
> >
> > Can someone run the unmodified test/implicit-rwf_nowait against
> > a newer kernel?
>
> Aha. I wondered about the short read issue when this
> was first reported but I could never catch it in the
> act.
>
> If the Windows client doesn't check and the kernel
> returns short reads I guess we'll have to add logic
> similar to tstream_readv_send()/tstream_writev_send()
> that ensure all bytes requested/send actually go through
> the interface and from/into the kernel unless a read
> returns 0 (EOF) or a write returns an error.
>
> What a pain though :-(. SMB2+ server implementors
> really need to take note that Windows clients will corrupt
> files if they get a short read/write return.
>
> The fact that early kernels don't return short
> reads on io_uring but later kernels do makes it
> even worse :-(.
>
> There's even an SMB2 protocol field in SMB2_READ:
>
> "MinimumCount (4 bytes): The minimum number of bytes to be read for this operation to be
> successful. If fewer than the minimum number of bytes are read by the server, the server
> MUST return an error rather than the bytes read."
>
> We correctly return EOF if the amount read from
> the kernel is less than SMB2_READ.MinimumCount
> so I'm guessing they're not using it or looking
> at it (or setting it to zero).
>
> MinimumCount is supposed to allow the client to cope with
> this. Anoop, do you have wireshark traces so we can
> see what the Windows clients are setting here ?
Just did a quick check myself and Windows10 clients
are setting Minimumcount==0 on read, so any amount
should be good here.
next prev parent reply other threads:[~2020-05-06 17:13 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-05 10:04 Data Corruption bug with Samba's vfs_iouring and Linux 5.6.7/5.7rc3 Stefan Metzmacher
2020-05-05 14:41 ` Jens Axboe
2020-05-05 15:44 ` Jens Axboe
2020-05-05 16:53 ` Jens Axboe
2020-05-05 17:39 ` Jens Axboe
2020-05-05 17:48 ` Jeremy Allison
2020-05-05 17:50 ` Jens Axboe
[not found] ` <[email protected]>
2020-05-06 10:33 ` Stefan Metzmacher
2020-05-06 10:41 ` Stefan Metzmacher
[not found] ` <[email protected]>
2020-05-06 14:08 ` Stefan Metzmacher
2020-05-06 14:43 ` Andreas Schneider
2020-05-06 14:46 ` Andreas Schneider
2020-05-06 15:06 ` Stefan Metzmacher
2020-05-06 17:03 ` Jeremy Allison
2020-05-06 17:13 ` Jeremy Allison [this message]
2020-05-06 18:01 ` Jeremy Allison
2020-05-05 20:19 ` Stefan Metzmacher
2020-05-06 12:55 ` Pavel Begunkov
2020-05-06 15:20 ` Stefan Metzmacher
2020-05-06 15:42 ` Pavel Begunkov
2020-05-07 16:43 ` Jens Axboe
2020-05-07 16:48 ` Jeremy Allison
2020-05-07 16:50 ` Jens Axboe
2020-05-07 18:31 ` Jeremy Allison
2020-05-07 18:35 ` Jens Axboe
2020-05-07 18:55 ` Jeremy Allison
2020-05-07 18:58 ` 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=20200506171304.GC3447@jeremy-acer \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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