On success aio_discard returns 0.
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
if (ret < 0) {
ctx->reply.error = htonl(-ret);
- } else if (ret != static_cast<int>(ctx->request.len)) {
+ } else if ((ctx->command == NBD_CMD_WRITE || ctx->command == NBD_CMD_READ)
+ && ret != static_cast<int>(ctx->request.len)) {
derr << __func__ << ": " << *ctx << ": unexpected return value: " << ret
<< " (" << ctx->request.len << " expected)" << dendl;
ctx->reply.error = htonl(EIO);