From 45ca53447fde2f014d6d62f6bbbfc0b97ae011dd Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 13 Jan 2019 10:37:25 +0200 Subject: 10215 lofiadm -la fails after lofiadm -a / lofiadm -d Reviewed by: Igor Kozhukhov Reviewed by: Gergő Doma Reviewed by: Andy Fiddaman Approved by: Dan McDonald 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(-) (limited to 'usr/src/uts/common/io/lofi.c') diff --git a/usr/src/uts/common/io/lofi.c b/usr/src/uts/common/io/lofi.c index 95f4cd7254..100dd052fe 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) -- cgit v1.2.3