summaryrefslogtreecommitdiff
path: root/drivers/target
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2014-05-14 15:48:06 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-06-07 13:25:38 -0700
commitc9d6d5c009e96eb257d36b5c43d9c2d94f02cbf8 (patch)
tree513bc9a330e92e26ceec8b33b6756bca4a688d77 /drivers/target
parent8a2629ad0ba7902262df7ae980265d8f93e2dfc2 (diff)
downloadlinux-3.10-c9d6d5c009e96eb257d36b5c43d9c2d94f02cbf8.tar.gz
linux-3.10-c9d6d5c009e96eb257d36b5c43d9c2d94f02cbf8.tar.bz2
linux-3.10-c9d6d5c009e96eb257d36b5c43d9c2d94f02cbf8.zip
target: Don't allow setting WC emulation if device doesn't support
commit 07b8dae38b09bcfede7e726f172e39b5ce8390d9 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=1082675 Reviewed-by: Chris Leech <cleech@redhat.com> Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_device.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 660b109487a..8032917b663 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -796,10 +796,10 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag)
pr_err("emulate_write_cache not supported for pSCSI\n");
return -EINVAL;
}
- if (dev->transport->get_write_cache) {
- pr_warn("emulate_write_cache cannot be changed when underlying"
- " HW reports WriteCacheEnabled, ignoring request\n");
- return 0;
+ if (flag &&
+ dev->transport->get_write_cache) {
+ pr_err("emulate_write_cache not supported for this device\n");
+ return -EINVAL;
}
dev->dev_attrib.emulate_write_cache = flag;