]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-nbd: Fix aio_callback error handling 8775/head
authorcy.l@inwinstack.com <cy.l@inwinstack.com>
Sat, 30 Apr 2016 07:22:29 +0000 (15:22 +0800)
committercy.l@inwinstack.com <cy.l@inwinstack.com>
Tue, 3 May 2016 07:39:07 +0000 (15:39 +0800)
Change aio_callback return code handling for NBD_CMD_READ command.

Tracker:
http://tracker.ceph.com/issues/15604

Signed-off-by: Chang-Yi Lee <cy.l@inwinstack.com>
1  2 
src/tools/rbd_nbd/rbd-nbd.cc

index 60192b07eaf3ea235dbb29fba19b61eaa4b7311c,33f7c3f35094ffb5dee59170d1192246e9caf36d..f7e7531755851ef7ff1700f121361ecbebb3e6c1
@@@ -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<int>(ctx->request.len)) {
 +      int pad_byte_count = static_cast<int> (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);
      }