]> Git Repo - qemu.git/commit - nbd/server.c
nbd: Limit nbdflags to 16 bits
authorEric Blake <[email protected]>
Thu, 21 Jul 2016 19:34:46 +0000 (13:34 -0600)
committerPaolo Bonzini <[email protected]>
Wed, 3 Aug 2016 16:44:56 +0000 (18:44 +0200)
commit7423f417827146f956df820f172d0bf80a489495
treec344d494cc4fab46a7bb1daacb0088bc35e9ee1f
parent5bee0f4717c4c67394aaade0c5a9cee3d42cc614
nbd: Limit nbdflags to 16 bits

Rather than asserting that nbdflags is within range, just give
it the correct type to begin with :)  nbdflags corresponds to
the per-export portion of NBD Protocol "transmission flags", which
is 16 bits in response to NBD_OPT_EXPORT_NAME and NBD_OPT_GO.

Furthermore, upstream NBD has never passed the global flags to
the kernel via ioctl(NBD_SET_FLAGS) (the ioctl was first
introduced in NBD 2.9.22; then a latent bug in NBD 3.1 actually
tried to OR the global flags with the transmission flags, with
the disaster that the addition of NBD_FLAG_NO_ZEROES in 3.9
caused all earlier NBD 3.x clients to treat every export as
read-only; NBD 3.10 and later intentionally clip things to 16
bits to pass only transmission flags).  Qemu should follow suit,
since the current two global flags (NBD_FLAG_FIXED_NEWSTYLE
and NBD_FLAG_NO_ZEROES) have no impact on the kernel's behavior
during transmission.

CC: [email protected]
Signed-off-by: Eric Blake <[email protected]>
Message-Id: <1469129688[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
block/nbd-client.h
include/block/nbd.h
nbd/client.c
nbd/server.c
qemu-nbd.c
This page took 0.027118 seconds and 4 git commands to generate.