Commit 1b8b4d6d authored by Andy Grover's avatar Andy Grover Committed by Jiri Slaby

target: Don't allow setting WC emulation if device doesn't support

commit 07b8dae3 upstream.

Just like for pSCSI, if the transport sets get_write_cache, then it is
not valid to enable write cache emulation for it. Return an error.

see https://bugzilla.redhat.com/show_bug.cgi?id=1082675Reviewed-by: default avatarChris Leech <cleech@redhat.com>
Signed-off-by: default avatarAndy Grover <agrover@redhat.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 730cef68
...@@ -799,10 +799,10 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) ...@@ -799,10 +799,10 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag)
pr_err("emulate_write_cache not supported for pSCSI\n"); pr_err("emulate_write_cache not supported for pSCSI\n");
return -EINVAL; return -EINVAL;
} }
if (dev->transport->get_write_cache) { if (flag &&
pr_warn("emulate_write_cache cannot be changed when underlying" dev->transport->get_write_cache) {
" HW reports WriteCacheEnabled, ignoring request\n"); pr_err("emulate_write_cache not supported for this device\n");
return 0; return -EINVAL;
} }
dev->dev_attrib.emulate_write_cache = flag; dev->dev_attrib.emulate_write_cache = flag;
......
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