qemu/nbd
Eric Blake fb26337641 nbd: Don't trim unrequested bytes
Similar to commit df7b97ff, we are mishandling clients that
give an unaligned NBD_CMD_TRIM request, and potentially
trimming bytes that occur before their request; which in turn
can cause potential unintended data loss (unlikely in
practice, since most clients are sane and issue aligned trim
requests).  However, while we fixed read and write by switching
to the byte interfaces of blk_, we don't yet have a byte
interface for discard.  On the other hand, trim is advisory, so
rounding the user's request to simply ignore the first and last
unaligned sectors (or the entire request, if it is sub-sector
in length) is just fine.

CC: qemu-stable@nongnu.org
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1464173965-9694-1-git-send-email-eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 353ab96973)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2016-08-05 13:28:06 -05:00
..
client.c nbd: Don't fail handshake on NBD_OPT_LIST descriptions 2016-04-15 17:56:56 +02:00
common.c nbd: do not hang nbd_wr_syncv if outside a coroutine and no available data 2016-04-08 00:07:44 +02:00
Makefile.objs
nbd-internal.h nbd: Avoid bitrot in TRACE() usage 2016-04-08 00:07:43 +02:00
server.c nbd: Don't trim unrequested bytes 2016-08-05 13:28:06 -05:00