Commit 50833855 authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

nvme/cuse: install custom log func to silence bad error message



fuse installs signal handlers associated with just one session,
but still calls fuse_remove_signal_handlers() when tearing down
every session. Every session except the first will print an
annoying error message. So install a custom log func that will
specifically ignore the error message in question.

Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
Change-Id: Ic9b2a84b5d7573b80575db4fe3f41d231a7651fe
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/21112


Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 68b467b7
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -1117,6 +1117,22 @@ cuse_nvme_ctrlr_update_namespaces(struct cuse_device *ctrlr_device)
	return 0;
}

#ifdef FUSE_LOG_H_
static void
nvme_fuse_log_func(enum fuse_log_level level, const char *fmt, va_list ap)
{
	/* fuse will unnecessarily print this log message when tearing down
	 * sessions, once for every session after the first. So use this custom
	 * log handler to silence that specific log message.
	 */
	if (strstr(fmt, "fuse_remove_signal_handlers: unknown session") != NULL) {
		return;
	}

	vfprintf(stderr, fmt, ap);
}
#endif

static int
nvme_cuse_start(struct spdk_nvme_ctrlr *ctrlr)
{
@@ -1131,6 +1147,13 @@ nvme_cuse_start(struct spdk_nvme_ctrlr *ctrlr)
			SPDK_ERRLOG("Cannot create bit array\n");
			return -ENOMEM;
		}
#ifdef FUSE_LOG_H_
		/* Older versions of libfuse don't have fuse_set_log_func nor
		 * fuse_log.h, so this is the easiest way to check for it
		 * without adding a separate CONFIG flag.
		 */
		fuse_set_log_func(nvme_fuse_log_func);
#endif
	}

	ctrlr_device = (struct cuse_device *)calloc(1, sizeof(struct cuse_device));