From: cy.l@inwinstack.com Date: Sat, 30 Apr 2016 07:22:29 +0000 (+0800) Subject: rbd-nbd: Fix aio_callback error handling X-Git-Tag: v11.0.0~735^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F8775%2Fhead;p=ceph.git rbd-nbd: Fix aio_callback error handling Change aio_callback return code handling for NBD_CMD_READ command. Tracker: http://tracker.ceph.com/issues/15604 Signed-off-by: Chang-Yi Lee --- ee211295441b126a995c07820176cfc966ab61c5 diff --cc src/tools/rbd_nbd/rbd-nbd.cc index 60192b07eaf3,33f7c3f35094..f7e753175585 --- a/src/tools/rbd_nbd/rbd-nbd.cc +++ b/src/tools/rbd_nbd/rbd-nbd.cc @@@ -186,12 -186,10 +186,13 @@@ private if (ret < 0) { ctx->reply.error = htonl(-ret); - } else if ((ctx->command == NBD_CMD_WRITE) && ret != 0) { - derr << __func__ << ": " << *ctx << ": unexpected return value: " << ret - << dendl; - ctx->reply.error = htonl(EIO); + } else if ((ctx->command == NBD_CMD_READ) && + ret < static_cast(ctx->request.len)) { + int pad_byte_count = static_cast (ctx->request.len) - ret; - ctx->data.append('\x0', pad_byte_count); ++ ctx->data.append_zero(pad_byte_count); + dout(20) << __func__ << ": " << *ctx << ": Pad byte count: " + << pad_byte_count << dendl; ++ ctx->reply.error = 0; } else { ctx->reply.error = htonl(0); }