lkml.org 
[lkml]   [2018]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] nvmet: fix nvmet_execute_write_zeroes function
Date
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@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
\
 
 \ /
  Last update: 2018-03-30 23:20    [W:0.064 / U:0.948 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site