lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 27 May 2014 19:39:14 +0800
From:	Vaughan Cao <vaughan.cao@...cle.com>
To:	JBottomley@...allels.com
Cc:	linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
	vaughan.cao@...cle.com
Subject: [PATCH] notify block layer when using temporary change to cache_type

This is a fix for commit:
  39c60a0948cc06139e2fbfe084f83cb7e7deae3b sd: fix array cache flushing bug causing performance problems
We must notify the block layer via q->flush_flags after temporary change the cache_type to write through.
If not, SYNCHRONIZE CACHE command will still be generated.

Signed-off-by: Vaughan Cao <vaughan.cao@...cle.com>
---
 drivers/scsi/sd.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 6146b9d..366e48b 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -144,6 +144,7 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr,
 	struct scsi_sense_hdr sshdr;
 	static const char temp[] = "temporary ";
 	int len;
+	unsigned flush;
 
 	if (sdp->type != TYPE_DISK)
 		/* no cache control on RBC devices; theoretically they
@@ -174,6 +175,17 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr,
 	if (sdkp->cache_override) {
 		sdkp->WCE = wce;
 		sdkp->RCD = rcd;
+
+		/* set flush_flags to notify the block layer */
+		flush = 0;
+		if (sdkp->WCE) {
+			flush |= REQ_FLUSH;
+			if (sdkp->DPOFUA)
+				flush |= REQ_FUA;
+		}
+
+		blk_queue_flush(sdkp->disk->queue, flush);
+
 		return count;
 	}
 
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ