Commit 738981bd authored by David Disseldorp's avatar David Disseldorp Committed by Martin K. Petersen

scsi: target: fix unmap_zeroes_data boolean initialisation

The LIO unmap_zeroes_data device attribute is mapped to the LBPRZ flag in
the READ CAPACITY(16) and Thin Provisioning VPD INQUIRY responses.

The unmap_zeroes_data attribute is exposed via configfs, where any write
value is correctly validated via strtobool(). However, when initialised via
target_configure_unmap_from_queue() it takes the value of the device's
max_write_zeroes_sectors queue limit, which is non-boolean.

A non-boolean value can be read from configfs, but attempting to write the
same value back results in -EINVAL, causing problems for configuration
utilities such as targetcli.

Link: https://marc.info/?l=target-devel&m=158213354011309
Fixes: 2237498f ("target/iblock: Convert WRITE_SAME to blkdev_issue_zeroout")
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarDavid Disseldorp <ddiss@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b417107a
...@@ -829,7 +829,7 @@ bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib, ...@@ -829,7 +829,7 @@ bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib,
attrib->unmap_granularity = q->limits.discard_granularity / block_size; attrib->unmap_granularity = q->limits.discard_granularity / block_size;
attrib->unmap_granularity_alignment = q->limits.discard_alignment / attrib->unmap_granularity_alignment = q->limits.discard_alignment /
block_size; block_size;
attrib->unmap_zeroes_data = (q->limits.max_write_zeroes_sectors); attrib->unmap_zeroes_data = !!(q->limits.max_write_zeroes_sectors);
return true; return true;
} }
EXPORT_SYMBOL(target_configure_unmap_from_queue); EXPORT_SYMBOL(target_configure_unmap_from_queue);
......
...@@ -682,7 +682,7 @@ struct se_dev_attrib { ...@@ -682,7 +682,7 @@ struct se_dev_attrib {
int force_pr_aptpl; int force_pr_aptpl;
int is_nonrot; int is_nonrot;
int emulate_rest_reord; int emulate_rest_reord;
int unmap_zeroes_data; bool unmap_zeroes_data;
u32 hw_block_size; u32 hw_block_size;
u32 block_size; u32 block_size;
u32 hw_max_sectors; u32 hw_max_sectors;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment