From 93686a1e2cbe9bdcb1d8d3bf1870465ba0a43b1c Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 29 Jun 2022 18:06:55 -0400 Subject: 14782 sd.c warning message: "Unable to clean up memory" misguided Reviewed by: Joyce McIntosh Reviewed by: Sam Zaydel Reviewed by: Andy Fiddaman Reviewed by: Toomas Soome Approved by: Richard Lowe --- usr/src/uts/common/io/scsi/targets/sd.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'usr/src/uts/common') 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; } } } -- cgit v1.2.3