From f6cc2b62c6f1a18c352d2f7358e887d503f7d779 Mon Sep 17 00:00:00 2001 From: Alex Bligh Date: Sun, 22 May 2011 11:08:35 +0100 Subject: [PATCH] Use zeros for req.from and req.len in NBD_CMD_FLUSH --- nbd.c | 10 ++++++++-- 1 file 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.10.4