linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] target: Don't allow setting WC emulation if device doesn't support
@ 2014-05-14 22:48 Andy Grover
  2014-05-14 22:48 ` [PATCH 2/2] target: Fix a comment in emulate_evpd_86 Andy Grover
  2014-05-15  0:07 ` [PATCH 1/2] target: Don't allow setting WC emulation if device doesn't support Nicholas A. Bellinger
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Grover @ 2014-05-14 22:48 UTC (permalink / raw)
  To: target-devel; +Cc: linux-scsi

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>
---
 drivers/target/target_core_device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 65001e1..d461ecb 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -798,10 +798,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;
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-05-15  2:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-14 22:48 [PATCH 1/2] target: Don't allow setting WC emulation if device doesn't support Andy Grover
2014-05-14 22:48 ` [PATCH 2/2] target: Fix a comment in emulate_evpd_86 Andy Grover
2014-05-15  0:07 ` [PATCH 1/2] target: Don't allow setting WC emulation if device doesn't support Nicholas A. Bellinger
2014-05-15  0:22   ` Andy Grover
2014-05-15  0:57     ` Nicholas A. Bellinger
2014-05-15  2:07       ` Andy Grover

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).