From 45ca53447fde2f014d6d62f6bbbfc0b97ae011dd Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 13 Jan 2019 10:37:25 +0200 Subject: [PATCH] =?UTF-8?q?10215=20lofiadm=20-la=20fails=20after=20lofiadm?= =?UTF-8?q?=20-a=20/=20lofiadm=20-d=20Reviewed=20by:=20Igor=20Kozhukhov=20?= =?UTF-8?q?=20Reviewed=20by:=20Gerg=C5=91=20Doma=20=20Reviewed=20by:=20Andy=20Fiddaman=20=20Approved=20by:=20Dan=20McDonald=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/src/uts/common/io/lofi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/usr/src/uts/common/io/lofi.c b/usr/src/uts/common/io/lofi.c index 95f4cd7254ac..100dd052fec1 100644 --- a/usr/src/uts/common/io/lofi.c +++ b/usr/src/uts/common/io/lofi.c @@ -173,7 +173,7 @@ #define SIZE_PROP_NAME "Size" #define ZONE_PROP_NAME "zone" -#define SETUP_C_DATA(cd, buf, len) \ +#define SETUP_C_DATA(cd, buf, len) \ (cd).cd_format = CRYPTO_DATA_RAW; \ (cd).cd_offset = 0; \ (cd).cd_miscdata = NULL; \ @@ -2954,6 +2954,7 @@ lofi_unmap_file(struct lofi_ioctl *ulip, int byfilename, { struct lofi_state *lsp; struct lofi_ioctl *klip; + char namebuf[MAXNAMELEN]; int err; err = copy_in_lofi_ioctl(ulip, &klip, ioctl_flag); @@ -2979,6 +2980,7 @@ lofi_unmap_file(struct lofi_ioctl *ulip, int byfilename, } klip->li_id = LOFI_MINOR2ID(getminor(lsp->ls_dev)); + (void) snprintf(namebuf, sizeof (namebuf), "%u", klip->li_id); /* * If it's still held open, we'll do one of three things: @@ -3023,6 +3025,10 @@ lofi_unmap_file(struct lofi_ioctl *ulip, int byfilename, lofi_destroy(lsp, credp); } + /* Remove name from devlink cache */ + mutex_enter(&lofi_devlink_cache.ln_lock); + (void) nvlist_remove_all(lofi_devlink_cache.ln_data, namebuf); + mutex_exit(&lofi_devlink_cache.ln_lock); done: mutex_exit(&lofi_lock); if (err == 0)