Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvmet: fix nvmet_execute_write_zeroes function
@ 2018-03-30 21:18 Rodrigo R. Galvao
  2018-03-30 21:24 ` Keith Busch
  2018-04-02 13:47 ` Keith Busch
  0 siblings, 2 replies; 8+ messages in thread
From: Rodrigo R. Galvao @ 2018-03-30 21:18 UTC (permalink / raw)


When trying to issue write_zeroes command against TARGET the nr_sector is
being incremented by 1, which ends up hitting the following condition at
__blkdev_issue_zeroout:

     if ((sector | nr_sects) & bs_mask)
                return -EINVAL;

Causing the command to always fail. Removing the increment makes the
command to work properly.

Signed-off-by: Rodrigo R. Galvao <rosattig at linux.vnet.ibm.com>
---
 drivers/nvme/target/io-cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/io-cmd.c b/drivers/nvme/target/io-cmd.c
index 28bbdff..8d72686 100644
--- a/drivers/nvme/target/io-cmd.c
+++ b/drivers/nvme/target/io-cmd.c
@@ -174,7 +174,7 @@ static void nvmet_execute_write_zeroes(struct nvmet_req *req)
 	sector = le64_to_cpu(write_zeroes->slba) <<
 		(req->ns->blksize_shift - 9);
 	nr_sector = (((sector_t)le16_to_cpu(write_zeroes->length)) <<
-		(req->ns->blksize_shift - 9)) + 1;
+		(req->ns->blksize_shift - 9));
 
 	if (__blkdev_issue_zeroout(req->ns->bdev, sector, nr_sector,
 				GFP_KERNEL, &bio, 0))
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-04-02 14:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-30 21:18 [PATCH] nvmet: fix nvmet_execute_write_zeroes function Rodrigo R. Galvao
2018-03-30 21:24 ` Keith Busch
2018-03-30 21:48   ` Rodrigo Rosatti Galvão
2018-04-02  8:03     ` chaitany kulkarni
2018-04-02 13:47       ` Rodrigo Rosatti Galvao
2018-04-02 14:21         ` Keith Busch
2018-04-02 14:50           ` Rodrigo Rosatti Galvao
2018-04-02 13:47 ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox