nvmet: Do not check for sg_cnt being zero for read/write commands.
Subsystems (2)
PATCH 1/1 nvmet: Do not check for sg_cnt being zero for read/write commands.
sg_cnt cannot be zero for inline or sge mode from the fabric drivers because nvme read/write commands have minimum of one block to be read or written. (nlb dw12 is 0 based value).
So sg_cnt check for 0 is not useful.
--- drivers/nvme/target/io-cmd.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/nvme/target/io-cmd.c +0 -5
@@ -49,11 +49,6 @@ static void nvmet_execute_rw(struct nvmet_req *req)blk_qc_t cookie;int op, op_flags =0 , i; -if (!req->sg_cnt) { -nvmet_req_complete (req,0 ); -return ; - } -if (req->cmd->rw.opcode == nvme_cmd_write) { op =REQ_OP_WRITE ; op_flags =REQ_SYNC |REQ_IDLE ;
Signature · 1 line
1.8.3.1
Christoph Hellwig
maintainerPATCH 1/1 nvmet: Do not check for sg_cnt being zero for read/write commands.
Quoted 4 lines · Parav Pandit
sg_cntcannot be zero for inline or sge mode from the fabric drivers because nvme read/write commands have minimum of one block to be read or written. (nlb dw12 is 0 based value).
Sosg_cntcheck for 0 is not useful.
Except that we currently don't verify the data transfer in the SGL matches that in the command. It's been on my todo list for a while, so maybe you can take it off my plate first before we'll aply this patch.
Sagi Grimberg
maintainerPATCH 1/1 nvmet: Do not check for sg_cnt being zero for read/write commands.
Quoted 5 lines
Except that we currently don't verify the data transfer in the SGL matches that in the command. It's been on my todo list for a while, so maybe you can take it off my plate first before we'll aply this patch.
Any reason not to take it as is and add the sgl validity check incrementally?
Christoph Hellwig
maintainerPATCH 1/1 nvmet: Do not check for sg_cnt being zero for read/write commands.
Quoted 8 lines · Sagi Grimberg
Quoted 5 lines
Except that we currently don't verify the data transfer in the SGL matches that in the command. It's been on my todo list for a while, so maybe you can take it off my plate first before we'll aply this patch.
Any reason not to take it as is and add the sgl validity check incrementally?
Because that would allow a bad actor host to crash the target easily.
PATCH 1/1 nvmet: Do not check for sg_cnt being zero for read/write commands.
In reply to Christoph HellwigQuoted 12 lines
-----Original Message-----
From: Christoph Hellwig [mailto:hch at lst.de]
Sent: Wednesday, February 8, 2017 2:24 AM
To: Parav Pandit <parav at mellanox.com>
Cc: hch at lst.de; sagi at grimberg.me; linux-nvme at lists.infradead.org
Subject: Re: [PATCH] nvmet: Do not check forsg_cntbeing zero for read/write commands.Quoted 2 lines · Parav Pandit
sg_cntcannot be zero for inline or sge mode from the fabric drivers because nvme read/write commands have minimum of one block to be
Quoted 7 lines
read
Quoted 2 lines
or written. (nlb dw12 is 0 based value).
Sosg_cntcheck for 0 is not useful.Except that we currently don't verify the data transfer in the SGL matches that in the command. It's been on my todo list for a while, so maybe you can take it off my plate first before we'll aply this patch.
Yes. I hit an error when there was a mismatch between nlba and sge length. That check is needed to fail the nvme requests. I will post that patch soon.
PATCH 1/1 nvmet: Do not check for sg_cnt being zero for read/write commands.
In reply to Christoph HellwigQuoted 26 lines
-----Original Message-----
From: Parav Pandit
Sent: Wednesday, February 8, 2017 9:11 AM
To: 'Christoph Hellwig' <hch at lst.de>
Cc: sagi at grimberg.me; linux-nvme at lists.infradead.org
Subject: RE: [PATCH] nvmet: Do not check forsg_cntbeing zero for read/write commands.Quoted 15 lines
-----Original Message-----
From: Christoph Hellwig [mailto:hch at lst.de]
Sent: Wednesday, February 8, 2017 2:24 AM
To: Parav Pandit <parav at mellanox.com>
Cc: hch at lst.de; sagi at grimberg.me; linux-nvme at lists.infradead.org
Subject: Re: [PATCH] nvmet: Do not check forsg_cntbeing zero for read/write commands.Quoted 2 lines · Parav Pandit
sg_cntcannot be zero for inline or sge mode from the fabric drivers because nvme read/write commands have minimum of one block to beread
Quoted 2 lines
or written. (nlb dw12 is 0 based value).
Sosg_cntcheck for 0 is not useful.
Quoted 6 lines
Quoted 3 lines
Except that we currently don't verify the data transfer in the SGL matches that in the command. It's been on my todo list for a while, so maybe you can take it off my plate first before we'll aply this patch.
Yes. I hit an error when there was a mismatch between nlba and sge length. That check is needed to fail the nvme requests. I will post that patch soon.
However check for sg_cnt being not zero doesn't catch that error either, so both the checks are unrelated. I think this patch still holds fine?