nbd/client: Accept 64-bit block status chunks
commitcf065a67cbeddcddecdc6125b32d56fb550b3666
authorEric Blake <eblake@redhat.com>
Sat, 20 Nov 2021 14:02:50 +0000 (20 08:02 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 29 Aug 2023 17:38:22 +0000 (29 12:38 -0500)
tree7ff25a8f77cb9da145ce204938b40b5a450d37f6
parentca3b00cd87329d6a39cfa9a4ade51148157d9fa8
nbd/client: Accept 64-bit block status chunks

Once extended mode is enabled, we need to accept 64-bit status replies
(even for replies that don't exceed a 32-bit length).  It is easier to
normalize narrow replies into wide format so that the rest of our code
only has to handle one width.  Although a server is non-compliant if
it sends a 64-bit reply in compact mode, or a 32-bit reply in extended
mode, it is still easy enough to tolerate these mismatches.

In normal execution, we are only requesting "base:allocation" which
never exceeds 32 bits for flag values. But during testing with
x-dirty-bitmap, we can force qemu to connect to some other context
that might have 64-bit status bit; however, we ignore those upper bits
(other than mapping qemu:allocation-depth into something that
'qemu-img map --output=json' can expose), and since that only affects
testing, we really don't bother with checking whether more than the
two least-significant bits are set.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---

v5: factor out duplicate length calculation [Vladimir], add R-b

v4: tweak comments and error message about count mismatch, fix setting
of wide in loop [Vladimir]
block/nbd.c
block/trace-events