nbd: Zero from and len fields in NBD_CMD_DISCONNECT.
Subsystems (2)
PATCH 1/1 nbd: Zero from and len fields in NBD_CMD_DISCONNECT.
Len field is already set to zero, but not the from field which is sent as 0xfffffffffffffe00. This makes no sense, and may cause confuse server implementations doing sanity checks (qemu-nbd is an example.)
--- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/nbd.c +1 -1
@@ -246,7 +246,7 @@ static int nbd_send_req(struct nbd_device *nbd, struct request *req) request.magic =htonl (NBD_REQUEST_MAGIC ); request.type =htonl (nbd_cmd (req)); -if (nbd_cmd (req) ==NBD_CMD_FLUSH ) { +if (nbd_cmd (req) ==NBD_CMD_FLUSH ||nbd_cmd (req) ==NBD_CMD_DISC ) {/* Other values are reserved for FLUSH requests. */ request.from =0 ; request.len =0 ;
Signature · 1 line
1.8.3.2
A message that is not in the archive (sent off-list or not yet received): CAECXXi4_RJ-yk8Ct=sPPe-pq=shdU-4cKvRTT3yNvsoY42-8_Q@mail.gmail.com
Quoted 3 lines · Paul Clements
Agreed. But better yet, the request structure should just be zeroed when it's allocated.
It is already initialized in __nbd_ioctl() with the blk_rq_init() call which sets the __sector value to -1 (which is 0xfffffffffffffe00 after the left shifts.)
This is the only (non-ugly / non-intrusive) way to do it afaict.
Quoted 34 lines
--
PaulQuoted 28 lines · Hani Benhabiles
Len field is already set to zero, but not the from field which is sent as
0xfffffffffffffe00. This makes no sense, and may cause confuse server implementations doing sanity checks (qemu-nbd is an example.)Signed-off-by Hani Benhabiles <[email protected]>--- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/block/nbd.c +1
-1@@ -246,7 +246,7 @@ static int nbd_send_req(struct nbd_device *nbd, struct request *req) request.magic = htonl(NBD_REQUEST_MAGIC); request.type =htonl (nbd_cmd (req)); -if (nbd_cmd (req) ==NBD_CMD_FLUSH ) { +if (nbd_cmd (req) ==NBD_CMD_FLUSH ||nbd_cmd (req) ==NBD_CMD_DISC ) {/* Other values are reserved for FLUSH requests. */ request.from = 0; request.len = 0;--
1.8.3.2
Quoted 10 lines · Hani Benhabiles
Quoted 3 lines · Paul Clements
Agreed. But better yet, the request structure should just be zeroed when it's allocated.
It is already initialized in
__nbd_ioctl()with theblk_rq_init()call which sets the__sectorvalue to -1 (which is0xfffffffffffffe00after the left shifts.)This is the only (non-ugly / non-intrusive) way to do it afaict.
Ping!
Anything blocking this patch ?
Thanks.
Quoted 34 lines
Quoted 34 lines
--
PaulQuoted 28 lines · Hani Benhabiles
Len field is already set to zero, but not the from field which is sent as
0xfffffffffffffe00. This makes no sense, and may cause confuse server implementations doing sanity checks (qemu-nbd is an example.)Signed-off-by Hani Benhabiles <[email protected]>--- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/block/nbd.c +1
-1@@ -246,7 +246,7 @@ static int nbd_send_req(struct nbd_device *nbd, struct request *req) request.magic = htonl(NBD_REQUEST_MAGIC); request.type =htonl (nbd_cmd (req)); -if (nbd_cmd (req) ==NBD_CMD_FLUSH ) { +if (nbd_cmd (req) ==NBD_CMD_FLUSH ||nbd_cmd (req) ==NBD_CMD_DISC ) {/* Other values are reserved for FLUSH requests. */ request.from = 0; request.len = 0;--
1.8.3.2
Quoted 9 lines · Hani Benhabiles
Quoted 8 lines · Hani Benhabiles
Quoted 3 lines · Paul Clements
Agreed. But better yet, the request structure should just be zeroed when it's allocated.
It is already initialized in
__nbd_ioctl()with theblk_rq_init()call which sets the__sectorvalue to -1 (which is0xfffffffffffffe00after the left shifts.)
Quoted 6 lines
Quoted 2 lines
This is the only (non-ugly / non-intrusive) way to do it afaict.
Ping!
Anything blocking this patch ?
It's cleaner to just zero the struct and get rid of the conditional zeroing of specific fields. I'll prepare a patch in the next few days.
Thanks,
Paul
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines · Hani Benhabiles
Quoted 29 lines
Len field is already set to zero, but not the from field which is sent as
0xfffffffffffffe00. This makes no sense, and may cause confuse server implementations doing sanity checks (qemu-nbd is an example.)Signed-off-by Hani Benhabiles <[email protected]>--- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/block/nbd.c +1
-1@@ -246,7 +246,7 @@ static int nbd_send_req(struct nbd_device *nbd, struct request *req) request.magic = htonl(NBD_REQUEST_MAGIC); request.type =htonl (nbd_cmd (req)); -if (nbd_cmd (req) ==NBD_CMD_FLUSH ) { +if (nbd_cmd (req) ==NBD_CMD_FLUSH ||nbd_cmd (req) ==NBD_CMD_DISC ) {/* Other values are reserved for FLUSH requests. */ request.from = 0; request.len = 0;--
1.8.3.2
Quoted 13 lines · Paul Clements
Quoted 12 lines · Hani Benhabiles
Quoted 10 lines · Hani Benhabiles
Quoted 3 lines · Paul Clements
Agreed. But better yet, the request structure should just be zeroed when it's allocated.
It is already initialized in
__nbd_ioctl()with theblk_rq_init()call which sets the__sectorvalue to -1 (which is0xfffffffffffffe00after the left shifts.)This is the only (non-ugly / non-intrusive) way to do it afaict.
Quoted 7 lines
Quoted 3 lines
Ping!
Anything blocking this patch ?
It's cleaner to just zero the struct and get rid of the conditional zeroing of specific fields. I'll prepare a patch in the next few days.
Sorry, I misunderstood which struct you were talking about!
Will send a v2 shortly.
Quoted 33 lines
Thanks,
PaulQuoted 30 lines
Quoted 30 lines
Quoted 30 lines · Hani Benhabiles
Quoted 29 lines
Len field is already set to zero, but not the from field which is sent as
0xfffffffffffffe00. This makes no sense, and may cause confuse server implementations doing sanity checks (qemu-nbd is an example.)Signed-off-by Hani Benhabiles <[email protected]>--- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/block/nbd.c +1
-1@@ -246,7 +246,7 @@ static int nbd_send_req(struct nbd_device *nbd, struct request *req) request.magic = htonl(NBD_REQUEST_MAGIC); request.type =htonl (nbd_cmd (req)); -if (nbd_cmd (req) ==NBD_CMD_FLUSH ) { +if (nbd_cmd (req) ==NBD_CMD_FLUSH ||nbd_cmd (req) ==NBD_CMD_DISC ) {/* Other values are reserved for FLUSH requests. */ request.from = 0; request.len = 0;--
1.8.3.2