summaryrefslogtreecommitdiff
path: root/usr/src/lib/libdiskmgt/common
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libdiskmgt/common')
-rw-r--r--usr/src/lib/libdiskmgt/common/cache.c18
-rw-r--r--usr/src/lib/libdiskmgt/common/entry.c10
-rw-r--r--usr/src/lib/libdiskmgt/common/inuse_svm.c18
-rw-r--r--usr/src/lib/libdiskmgt/common/libdiskmgt.h4
4 files changed, 43 insertions, 7 deletions
diff --git a/usr/src/lib/libdiskmgt/common/cache.c b/usr/src/lib/libdiskmgt/common/cache.c
index 1670aa3698..1d56c353fa 100644
--- a/usr/src/lib/libdiskmgt/common/cache.c
+++ b/usr/src/lib/libdiskmgt/common/cache.c
@@ -31,10 +31,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libintl.h>
#include <synch.h>
#include <sys/sunddi.h>
#include <sys/types.h>
#include <libgen.h>
+#include <syslog.h>
#include "libdiskmgt.h"
#include "disks_private.h"
@@ -632,10 +634,9 @@ static int
initialize()
{
struct search_args args;
- int status;
if (cache_loaded) {
- return (0);
+ return (0);
}
libdiskmgt_init_debug();
@@ -643,7 +644,7 @@ initialize()
findevs(&args);
if (args.dev_walk_status != 0) {
- return (args.dev_walk_status);
+ return (args.dev_walk_status);
}
disk_listp = args.disk_listp;
@@ -656,11 +657,16 @@ initialize()
* Only start the event thread if we are not doing an install
*/
if (getenv("_LIBDISKMGT_INSTALL") == NULL) {
- if ((status = events_start_event_watcher()) != 0) {
- return (status);
+ if (events_start_event_watcher() != 0) {
+ /*
+ * Log a message about the failure to start
+ * sysevents and continue on.
+ */
+ syslog(LOG_WARNING, dgettext(TEXT_DOMAIN,
+ "libdiskmgt: sysevent thread for cache "
+ "events failed to start\n"));
}
}
-
return (0);
}
diff --git a/usr/src/lib/libdiskmgt/common/entry.c b/usr/src/lib/libdiskmgt/common/entry.c
index ac08b47b7f..bf8f703f42 100644
--- a/usr/src/lib/libdiskmgt/common/entry.c
+++ b/usr/src/lib/libdiskmgt/common/entry.c
@@ -443,7 +443,7 @@ dm_get_stats(dm_descriptor_t desc, int stat_type, int *errp)
* the in use checking if the user has set stat_type
* DM_SLICE_STAT_USE
*/
- if (getenv("NOINUSE_CHECK") != NULL) {
+ if (NOINUSE_SET) {
stats = NULL;
break;
}
@@ -571,9 +571,17 @@ dm_inuse(char *dev_name, char **msg, dm_who_type_t who, int *errp)
int found = 0;
char *dname = NULL;
+
*errp = 0;
*msg = NULL;
+ /*
+ * If the user doesn't want to do in use checking, return.
+ */
+
+ if (NOINUSE_SET)
+ return (0);
+
dname = getfullblkname(dev_name);
/*
* If we cannot find the block name, we cannot check the device
diff --git a/usr/src/lib/libdiskmgt/common/inuse_svm.c b/usr/src/lib/libdiskmgt/common/inuse_svm.c
index d50ba35515..1a335ae55f 100644
--- a/usr/src/lib/libdiskmgt/common/inuse_svm.c
+++ b/usr/src/lib/libdiskmgt/common/inuse_svm.c
@@ -34,11 +34,13 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libintl.h>
#include <synch.h>
#include <thread.h>
#include <dlfcn.h>
#include <link.h>
#include <libsysevent.h>
+#include <syslog.h>
#include <sys/types.h>
#include <sys/sysevent/eventdefs.h>
@@ -157,6 +159,22 @@ inuse_svm(char *slice, nvlist_t *attrs, int *errp)
} else {
*errp = errno;
}
+ if (*errp) {
+ /*
+ * If the sysevent thread fails,
+ * log the error but continue
+ * on. This failing to start
+ * is not catastrophic in
+ * particular for short lived
+ * consumers of libdiskmgt.
+ */
+ syslog(LOG_WARNING,
+ dgettext(TEXT_DOMAIN,
+ "libdiskmgt: sysevent "
+ "thread for SVM failed "
+ "to start\n"));
+ *errp = 0;
+ }
}
}
}
diff --git a/usr/src/lib/libdiskmgt/common/libdiskmgt.h b/usr/src/lib/libdiskmgt/common/libdiskmgt.h
index ee8d1776b7..93998899c1 100644
--- a/usr/src/lib/libdiskmgt/common/libdiskmgt.h
+++ b/usr/src/lib/libdiskmgt/common/libdiskmgt.h
@@ -35,6 +35,8 @@ extern "C" {
#include <libnvpair.h>
+
+
/*
* Holds all the data regarding the device.
* Private to libdiskmgt. Must use dm_xxx functions to set/get data.
@@ -225,6 +227,8 @@ typedef enum {
#define DM_LUN "lun"
#define DM_TARGET "target"
+#define NOINUSE_SET getenv("NOINUSE_CHECK") != NULL
+
void dm_free_descriptors(dm_descriptor_t *desc_list);
void dm_free_descriptor(dm_descriptor_t desc);
void dm_free_name(char *name);