summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/io/scsi/targets/sd.c
diff options
context:
space:
mode:
authorbo zhou - Sun Microsystems - Beijing China <Bo.Zhou@Sun.COM>2009-11-07 15:27:17 +0800
committerbo zhou - Sun Microsystems - Beijing China <Bo.Zhou@Sun.COM>2009-11-07 15:27:17 +0800
commit02cdfdd69aa5f84ff667bb2a2cb2a0387a3accba (patch)
treece6ac52a8d91d7a502b84d3e50b34ead59c60247 /usr/src/uts/common/io/scsi/targets/sd.c
parent7516146ed49224feaa58356b12207b2808ac4235 (diff)
downloadillumos-gate-02cdfdd69aa5f84ff667bb2a2cb2a0387a3accba.tar.gz
6880784 Using format -e to change the disk cache settings does not update the device softstate, confusing sd
Diffstat (limited to 'usr/src/uts/common/io/scsi/targets/sd.c')
-rw-r--r--usr/src/uts/common/io/scsi/targets/sd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/usr/src/uts/common/io/scsi/targets/sd.c b/usr/src/uts/common/io/scsi/targets/sd.c
index 93b2d05519..cab4b1ab64 100644
--- a/usr/src/uts/common/io/scsi/targets/sd.c
+++ b/usr/src/uts/common/io/scsi/targets/sd.c
@@ -22930,6 +22930,7 @@ skip_ready_valid:
case DKIOCSETWCE: {
int wce, sync_supported;
+ int cur_wce = 0;
if (ddi_copyin((void *)arg, &wce, sizeof (wce), flag)) {
err = EFAULT;
@@ -22962,6 +22963,18 @@ skip_ready_valid:
un->un_f_wcc_inprog = 1;
+ mutex_exit(SD_MUTEX(un));
+
+ /*
+ * Get the current write cache state
+ */
+ if ((err = sd_get_write_cache_enabled(ssc, &cur_wce)) != 0) {
+ break;
+ }
+
+ mutex_enter(SD_MUTEX(un));
+ un->un_f_write_cache_enabled = (cur_wce != 0);
+
if (un->un_f_write_cache_enabled && wce == 0) {
/*
* Disable the write cache. Don't clear