nvmet: fix discover log page when offsets are used
authorKeith Busch <keith.busch@intel.com>
Tue, 9 Apr 2019 16:03:59 +0000 (10:03 -0600)
committerChristoph Hellwig <hch@lst.de>
Thu, 11 Apr 2019 15:28:30 +0000 (17:28 +0200)
commitd808b7f759b50acf0784ce6230ffa63e12ef465d
tree6e5d46c670e1ed35f4cddadfec3f7b8c563d23cb
parent67f471b6ed3b09033c4ac77ea03f92afdb1989fe
nvmet: fix discover log page when offsets are used

The nvme target hadn't been taking the Get Log Page offset parameter
into consideration, and so has been returning corrupted log pages when
offsets are used. Since many tools, including nvme-cli, split the log
request to 4k, we've been breaking discovery log responses when more
than 3 subsystems exist.

Fix the returned data by internally generating the entire discovery
log page and copying only the requested bytes into the user buffer. The
command log page offset type has been modified to a native __le64 to
make it easier to extract the value from a command.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Tested-by: Minwoo Im <minwoo.im@samsung.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/admin-cmd.c
drivers/nvme/target/discovery.c
drivers/nvme/target/nvmet.h
include/linux/nvme.h