bdev: check desc->write in spdk_bdev_write_zeores_blocks

We should not allow write_zeroes commands if the descriptor
was not opened for writing.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I56bc729d12089df90637b202dfe25f5505e9b712

Reviewed-on: https://review.gerrithub.io/414896
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Jim Harris 2018-06-12 09:02:00 -07:00
parent a6e3c8e90b
commit 7fe2855651

View File

@ -1818,6 +1818,10 @@ spdk_bdev_write_zeroes_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channe
uint64_t len;
bool split_request = false;
if (!desc->write) {
return -EBADF;
}
if (!spdk_bdev_io_valid_blocks(bdev, offset_blocks, num_blocks)) {
return -EINVAL;
}