---
nbd.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/nbd.c b/nbd.c
index 274e2f7..37949be 100644
--- a/nbd.c
+++ b/nbd.c
@@ -247,8 +247,14 @@ static int nbd_send_req(struct nbd_device *lo, struct
request *req)
request.type = htonl(nbd_cmd(req) |
(( (req->cmd_flags & REQ_FUA) && (lo->flags &
NBD_FLAG_SEND_FUA)) ?
NBD_CMD_FLAG_FUA : 0));
- request.from = cpu_to_be64((u64)blk_rq_pos(req) << 9);
- request.len = htonl(size);
+ /* Send from & len as zero on FLUSH - other values reserved per
protocol */
+ if (request.type == NBD_CMD_FLUSH) {
+ request.from = 0;
+ request.len = 0;
+ } else {
+ request.from = cpu_to_be64((u64)blk_rq_pos(req) << 9);
+ request.len = htonl(size);
+ }
memcpy(request.handle, &req, sizeof(req));
dprintk(DBG_TX, "%s: request %p: sending control (%s@%llu,%uB)\n",
--
1.7.4.1
------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its
next-generation tools to help Windows* and Linux* C/C++ and Fortran
developers boost performance applications - including clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Nbd-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nbd-general