[Nbd] [PATCH 2/2] NBD: Use zeros for req.from and req.len in NBD_CMD_FLUSH
- To: nbd-general@lists.sourceforge.net
- Subject: [Nbd] [PATCH 2/2] NBD: Use zeros for req.from and req.len in NBD_CMD_FLUSH
- From: Alex Bligh <alex@...872...>
- Date: Sun, 22 May 2011 11:18:26 +0100
- Message-id: <1306059506-22179-2-git-send-email-alex@...872...>
- In-reply-to: <1306059506-22179-1-git-send-email-alex@...872...>
- References: <1306059506-22179-1-git-send-email-alex@...872...>
---
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
Reply to: