summaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_transport.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-04-20 15:00:30 +0200
committerNicholas Bellinger <nab@linux-iscsi.org>2015-05-30 22:41:44 -0700
commit814e5b45182f4aaf6c0b0deac7104bc2cba5109e (patch)
treea0cfcd51f0854718d2f8de018c893e5f65b3a8f7 /drivers/target/target_core_transport.c
parentc04a6091c951c88636a569cdd29feb65fb5003af (diff)
downloadlinux-stable-814e5b45182f4aaf6c0b0deac7104bc2cba5109e.tar.gz
linux-stable-814e5b45182f4aaf6c0b0deac7104bc2cba5109e.tar.bz2
linux-stable-814e5b45182f4aaf6c0b0deac7104bc2cba5109e.zip
target: fix DPO and FUA bit checks
Drivers may override the WCE flag, in which case the DPOFUA flag in MODE SENSE might differ from the check used to reject invalid FUA bits in sbc_check_dpofua. Also now that we reject invalid FUA bits early there is no need to duplicate the same buggy check down in the fileio code. As the DPOFUA flag controls th support for FUA bits on read and write commands as well as DPO key off all the checks off a single helper, and deprecate the emulate_dpo and emulate_fua_read attributs. This fixes various failures in the libiscsi testsuite. Personally I'd prefer to also remove the emulate_fua_write attribute as there is no good reason to disable it, but I'll leave that for a separate discussion. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_transport.c')
-rw-r--r--drivers/target/target_core_transport.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 105f4fd0fad4..231812d61357 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -3075,3 +3075,22 @@ int transport_generic_handle_tmr(
return 0;
}
EXPORT_SYMBOL(transport_generic_handle_tmr);
+
+bool
+target_check_wce(struct se_device *dev)
+{
+ bool wce = false;
+
+ if (dev->transport->get_write_cache)
+ wce = dev->transport->get_write_cache(dev);
+ else if (dev->dev_attrib.emulate_write_cache > 0)
+ wce = true;
+
+ return wce;
+}
+
+bool
+target_check_fua(struct se_device *dev)
+{
+ return target_check_wce(dev) && dev->dev_attrib.emulate_fua_write > 0;
+}