filters: Fix .trim with FUA
It is very unusual for a client to request FUA on a trim (the main use
for FUA is to ensure disk changes have settled; but since trim is
advisory, there is no guarantee as to WHAT contents are being
settled). Still, the spec allows it, so we should support it.
Unfortunately, the rarity of the combination means we've missed that
we have a broken implementation since v1.2:
$ ./nbdkit -U - sh script \
--run 'nbdsh --connect nbd+unix:///?socket=$unixsocket
-c "h.trim(1024,1024,nbd.CMD_FLAG_FUA)"'
$ ./nbdkit -U - --filter=offset sh script \
--run 'nbdsh --connect nbd+unix:///?socket=$unixsocket
-c "h.trim(1024,1024,nbd.CMD_FLAG_FUA)"'
nbdkit: filters.c:647: filter_trim: Assertion `flags == 0' failed.
Traceback (most recent call last):
...
nbd.Error: nbd_trim: trim: command failed: Transport endpoint is not connected (ENOTCONN)
The breakage was only present for filters up to 1.14, but more
recently copied over to plugins as well.
Fixes:
dcf87173
Fixes:
11f79789
Signed-off-by: Eric Blake <eblake@redhat.com>