summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <gdamore@racktopsystems.com>2022-06-29 18:06:55 -0400
committerGarrett D'Amore <garrett@damore.org>2022-07-10 22:40:44 -0400
commit93686a1e2cbe9bdcb1d8d3bf1870465ba0a43b1c (patch)
tree7dd4488b0ddf19a44e1e9c68b563ecfe49074305
parentec6d8ca621f19d1cd1a46117b9b0fde4831c5794 (diff)
downloadillumos-joyent-93686a1e2cbe9bdcb1d8d3bf1870465ba0a43b1c.tar.gz
14782 sd.c warning message: "Unable to clean up memory" misguided
Reviewed by: Joyce McIntosh <jmcintosh@racktopsystems.com> Reviewed by: Sam Zaydel <szaydel@racktopsystems.com> Reviewed by: Andy Fiddaman <andy@omnios.org> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Richard Lowe <richlowe@richlowe.net>
-rw-r--r--usr/src/uts/common/io/scsi/targets/sd.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/usr/src/uts/common/io/scsi/targets/sd.c b/usr/src/uts/common/io/scsi/targets/sd.c
index 95440f6c73..0ea5202758 100644
--- a/usr/src/uts/common/io/scsi/targets/sd.c
+++ b/usr/src/uts/common/io/scsi/targets/sd.c
@@ -10469,25 +10469,16 @@ sdclose(dev_t dev, int flag, int otyp, cred_t *cred_p)
/*
* Destroy the cache (if it exists) which was
- * allocated for the write maps since this is
- * the last close for this media.
+ * allocated for the write maps, as long as no
+ * other outstanding commands for the device exist.
+ * (If we don't destroy it here, we will do so later
+ * on detach. More likely we'll just reuse it on
+ * a future open.)
*/
- if (un->un_wm_cache) {
- /*
- * Check if there are pending commands.
- * and if there are give a warning and
- * do not destroy the cache.
- */
- if (un->un_ncmds_in_driver > 0) {
- scsi_log(SD_DEVINFO(un),
- sd_label, CE_WARN,
- "Unable to clean up memory "
- "because of pending I/O\n");
- } else {
- kmem_cache_destroy(
- un->un_wm_cache);
- un->un_wm_cache = NULL;
- }
+ if ((un->un_wm_cache != NULL) &&
+ (un->un_ncmds_in_driver == 0)) {
+ kmem_cache_destroy(un->un_wm_cache);
+ un->un_wm_cache = NULL;
}
}
}