From: "Michał Belczyk" <belczyk@bsd.krakow.pl>
To: Alex Bligh <alex@alex.org.uk>
Cc: Eric Blake <eblake@redhat.com>,
"nbd-general@lists.sourceforge.net"
<nbd-general@lists.sourceforge.net>,
qemu block <qemu-block@nongnu.org>,
"qemu-trivial@nongnu.org" <qemu-trivial@nongnu.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"qemu-stable@nongnu.org" <qemu-stable@nongnu.org>,
Quentin Casasnovas <quentin.casasnovas@oracle.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-trivial] [Nbd] [Qemu-devel] [PATCH] nbd: fix trim/discard commands with a length bigger than NBD_MAX_BUFFER_SIZE
Date: Tue, 10 May 2016 21:13:24 +0200 [thread overview]
Message-ID: <20160510191324.GF94801@foxtrot.belo.io> (raw)
In-Reply-To: <C84A91D0-D90A-4B7B-B72D-A33E1C189354@alex.org.uk>
On Tue, May 10, 2016 at 04:41:27PM +0100, Alex Bligh wrote:
>
>On 10 May 2016, at 16:29, Eric Blake <eblake@redhat.com> wrote:
>
>> So the kernel is currently one of the clients that does NOT honor block
>> sizes, and as such, servers should be prepared for ANY size up to
>> UINT_MAX (other than DoS handling).
>
>Interesting followup question:
>
>If the kernel does not fragment TRIM requests at all (in the
>same way it fragments read and write requests), I suspect
>something bad may happen with TRIM requests over 2^31
>in size (particularly over 2^32 in size), as the length
>field in nbd only has 32 bits.
>
>Whether it supports block size constraints or not, it is
>going to need to do *some* breaking up of requests.
Doesn't the kernel break TRIM requests at max_discard_sectors?
I remember testing the following change in the nbd kmod long time ago:
#if 0
disk->queue->limits.max_discard_sectors = UINT_MAX;
#else
disk->queue->limits.max_discard_sectors = 65536;
#endif
The problem with large TRIM requests is exactly the same as with other
(READ/WRITE) large requests -- they _may_ take loads of time and if the client
wants to support a fast switch over to another replica it must put some
constraints on the timeout value... which may be very easily broken if you
allow things like a 1GB trim request on the server using DIO on the other side
(and say heavily fragmented sparse file over XFS, never mind).
I don't think it's the problem of QEMU NBD server to fix that, the constraint
on the server side is perfectly fine, the problem is to note that a change on
the client side is required to limit the maximum size of the TRIM requests.
The reason for the patch I pasted above was that at the time I looked into it
there was no other way to change the TRIM request size via
/sys/block/$dev/queue/max_discard_sectors, but maybe the more recent kernels
allow that?
Not to mention that the NBD client option to set that at NBD queue setup time
would be nice...
Just my 2p.
--
Michał Belczyk Snr
next prev parent reply other threads:[~2016-05-10 20:51 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-06 8:45 [Qemu-trivial] [PATCH] nbd: fix trim/discard commands with a length bigger than NBD_MAX_BUFFER_SIZE Quentin Casasnovas
2016-05-10 14:01 ` [Qemu-trivial] [Qemu-devel] " Eric Blake
2016-05-10 15:08 ` [Qemu-trivial] [Nbd] " Alex Bligh
2016-05-10 15:29 ` Eric Blake
2016-05-10 15:38 ` Alex Bligh
2016-05-10 15:45 ` Quentin Casasnovas
2016-05-10 15:49 ` Alex Bligh
2016-05-10 16:04 ` Quentin Casasnovas
2016-05-10 16:23 ` Alex Bligh
2016-05-10 16:27 ` Quentin Casasnovas
2016-05-11 9:38 ` Paolo Bonzini
2016-05-11 14:08 ` Eric Blake
2016-05-11 14:55 ` Alex Bligh
2016-05-11 15:08 ` Paolo Bonzini
2016-05-10 17:55 ` Paolo Bonzini
2016-05-11 21:12 ` Wouter Verhelst
2016-05-12 15:33 ` Alex Bligh
2016-05-10 15:41 ` Alex Bligh
2016-05-10 15:46 ` Eric Blake
2016-05-10 15:52 ` Alex Bligh
2016-05-10 15:54 ` Quentin Casasnovas
2016-05-10 16:33 ` Quentin Casasnovas
2016-05-10 20:24 ` Eric Blake
2016-05-10 19:13 ` Michał Belczyk [this message]
2016-05-11 21:10 ` Wouter Verhelst
2016-05-11 21:06 ` Wouter Verhelst
2016-05-12 15:03 ` Alex Bligh
2016-05-10 20:34 ` [Qemu-trivial] " Eric Blake
2016-05-11 8:34 ` Quentin Casasnovas
2016-05-11 14:11 ` Eric Blake
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=20160510191324.GF94801@foxtrot.belo.io \
--to=belczyk@bsd.krakow.pl \
--cc=alex@alex.org.uk \
--cc=eblake@redhat.com \
--cc=nbd-general@lists.sourceforge.net \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=quentin.casasnovas@oracle.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).