On 8/30/19 8:24 AM, Richard W.M. Jones wrote:
On Thu, Aug 29, 2019 at 10:08:26PM -0500, Eric Blake wrote:
@@ -232,8 +257,8 @@ handle_request (struct connection *conn, void *buf, struct nbdkit_extents *extents) { uint32_t f = 0; - bool fua = conn->can_fua && (flags & NBD_CMD_FLAG_FUA); int err = 0; + int r;
/* Clear the error, so that we know if the plugin calls * nbdkit_set_error() or relied on errno. */ @@ -246,7 +271,7 @@ handle_request (struct connection *conn, break;
case NBD_CMD_WRITE: - if (fua) + if (flags & NBD_CMD_FLAG_FUA) f |= NBDKIT_FLAG_FUA;
So don't we need to keep the backend_can_fua() test here and later in this function?
handle_request() is run after validate_request(), which already rejected any use of NBD_CMD_FLAG_FUA when it was not advertised. And since the flag is advertised only when backend_can_fua() succeeded, it is redundant to check it here. (You do have a point that we don't want to call into a backend without checking the flag, and thus backend_can_fua() _also_ needs to check things - but that's done in patch 9 when we actually start enforcing things between backends; until then, this patch is not a change in behavior). -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org