diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/format/checkdev.c | 10 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/switchout.c | 1 | ||||
-rw-r--r-- | usr/src/lib/libdiskmgt/common/cache.c | 18 | ||||
-rw-r--r-- | usr/src/lib/libdiskmgt/common/entry.c | 10 | ||||
-rw-r--r-- | usr/src/lib/libdiskmgt/common/inuse_svm.c | 18 | ||||
-rw-r--r-- | usr/src/lib/libdiskmgt/common/libdiskmgt.h | 4 | ||||
-rw-r--r-- | usr/src/uts/common/fs/ufs/ufs_vfsops.c | 4 |
7 files changed, 56 insertions, 9 deletions
diff --git a/usr/src/cmd/format/checkdev.c b/usr/src/cmd/format/checkdev.c index 8310abe09c..2ed9774b13 100644 --- a/usr/src/cmd/format/checkdev.c +++ b/usr/src/cmd/format/checkdev.c @@ -284,6 +284,16 @@ checkdevinuse(char *cur_disk_path, diskaddr_t start, diskaddr_t end, int print, char *name; /* + * If the user does not want to do in use checking, return immediately. + * Normally, this is handled in libdiskmgt. For format, there is more + * processing required, so we want to bypass the in use checking + * here. + */ + + if (NOINUSE_SET) + return (0); + + /* * For format, we get basic 'in use' details from libdiskmgt. After * that we must do the appropriate checking to see if the 'in use' * details require a bit of additional work. diff --git a/usr/src/cmd/fs.d/switchout.c b/usr/src/cmd/fs.d/switchout.c index fc9915bdd9..f059661cff 100644 --- a/usr/src/cmd/fs.d/switchout.c +++ b/usr/src/cmd/fs.d/switchout.c @@ -46,6 +46,7 @@ static int match(char **opts, char *s); +static int has_Nflag(char *opts); #define FSTYPE_MAX 8 #define ARGV_MAX 1024 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); diff --git a/usr/src/uts/common/fs/ufs/ufs_vfsops.c b/usr/src/uts/common/fs/ufs/ufs_vfsops.c index 8eb0530839..f205f3d2e5 100644 --- a/usr/src/uts/common/fs/ufs/ufs_vfsops.c +++ b/usr/src/uts/common/fs/ufs/ufs_vfsops.c @@ -552,7 +552,7 @@ remountfs(struct vfs *vfsp, dev_t dev, void *raw_argsp, int args_len) /* cannot remount to RDONLY */ if (vfsp->vfs_flag & VFS_RDONLY) - return (EINVAL); + return (ENOTSUP); /* whoops, wrong dev */ if (vfsp->vfs_dev != dev) @@ -752,7 +752,7 @@ int ufs_maxmaxphys = (1024 * 1024); #include <sys/ddi.h> /* for delay(9f) */ int ufs_mount_error_delay = 20; /* default to 20ms */ -int ufs_mount_timeout = 60; /* default to 1 minute */ +int ufs_mount_timeout = 60000; /* default to 1 minute */ static int mountfs(struct vfs *vfsp, enum whymountroot why, struct vnode *devvp, |