On 10/17/2017 04:17 PM, Eric Blake wrote: > On 10/17/2017 07:57 AM, Vladimir Sementsov-Ogievskiy wrote: >> Minimal implementation: for structured error only error_report error >> message. >> >> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> >> ---
> But in the client, I then perform 'w 0 0' (a zero-byte write, which > should fail because the server is read-only). I see: > > C: 19481@1508268433.381446:nbd_send_request Sending request to server: { > .from = 0, .len = 0, .handle = 93997172956880, .flags = 0x1, .type = 1 > (write) } > S: 19479@1508268433.381516:nbd_receive_request Got request: { magic = > 0x25609513, .flags = 0x1, .type = 0x1, from = 0, len = 0 } > S: 19479@1508268433.381527:nbd_co_receive_request_decode_type Decoding > type: handle = 93997172956880, type = 1 (write) > S: 19479@1508268433.381540:nbd_co_receive_request_payload_received > Payload received: handle = 93997172956880, len = 0 > S: 19479@1508268433.381564:nbd_co_send_structured_error Send structured > error reply: handle = 93997172956880, error = 1 (EPERM), msg = '' > C: 19481@1508268433.381622:nbd_receive_structured_reply_chunk Got > structured reply chunk: { flags = 0x1, type = 32769, handle = > 93997172956880, length = 6 } > C: wrote 0/0 bytes at offset 0 > C: 0 bytes, 1 ops; 0.0002 sec (0 bytes/sec and 4291.8455 ops/sec) > > Oops - the client claimed success, even though the server replied with > EPERM. And the server didn't do a good job of including details on the > error message. So there's still some tweaks needed. The server not sending details is a separate pre-existing issue; in server.c, we set errp for NBD_CMD_WRITE_ZEROES but not for NBD_CMD_WRITE. You can get the server to cough up a message by using 'w -z 0 1' instead. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature