diff --git a/cmd/zfsd/case_file.cc b/cmd/zfsd/case_file.cc index 0013cc55f7..5064d3c266 100644 --- a/cmd/zfsd/case_file.cc +++ b/cmd/zfsd/case_file.cc @@ -309,8 +309,16 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev) if (IsSpare()) flags |= ZFS_ONLINE_SPARE; - zpool_vdev_online(pool, vdev->GUIDString().c_str(), - flags, &m_vdevState); + if (zpool_vdev_online(pool, vdev->GUIDString().c_str(), + flags, &m_vdevState) != 0) { + syslog(LOG_ERR, + "Failed to online vdev(%s/%s:%s): %s: %s\n", + zpool_get_name(pool), vdev->GUIDString().c_str(), + devPath.c_str(), libzfs_error_action(g_zfsHandle), + libzfs_error_description(g_zfsHandle)); + return (/*consumed*/false); + } + syslog(LOG_INFO, "Onlined vdev(%s/%s:%s). State now %s.\n", zpool_get_name(pool), vdev->GUIDString().c_str(), devPath.c_str(), @@ -510,8 +518,7 @@ bool CaseFile::ActivateSpare() { nvlist_t *config, *nvroot, *parent_config; nvlist_t **spares; - char *devPath, *vdev_type; - const char *poolname; + const char *devPath, *poolname, *vdev_type; u_int nspares, i; int error; @@ -538,7 +545,7 @@ CaseFile::ActivateSpare() { parent_config = find_parent(config, nvroot, m_vdevGUID); if (parent_config != NULL) { - char *parent_type; + const char *parent_type; /* * Don't activate spares for members of a "replacing" vdev. @@ -1140,7 +1147,7 @@ CaseFile::Replace(const char* vdev_type, const char* path, bool isspare) { nvlist_free(newvd); retval = (zpool_vdev_attach(zhp, oldstr.c_str(), path, nvroot, - /*replace*/B_TRUE, /*detach*/B_FALSE) == 0); + /*replace*/B_TRUE, /*rebuild*/ B_FALSE) == 0); if (retval) syslog(LOG_INFO, "Replacing vdev(%s/%s) with %s\n", poolname, oldstr.c_str(), path); diff --git a/cmd/zfsd/vdev.cc b/cmd/zfsd/vdev.cc index 508af8cda9..a0e089a5bd 100644 --- a/cmd/zfsd/vdev.cc +++ b/cmd/zfsd/vdev.cc @@ -336,7 +336,7 @@ Vdev::Name(zpool_handle_t *zhp, bool verbose) const string Vdev::Path() const { - char *path(NULL); + const char *path(NULL); if ((m_config != NULL) && (nvlist_lookup_string(m_config, ZPOOL_CONFIG_PATH, &path) == 0)) @@ -348,7 +348,7 @@ Vdev::Path() const string Vdev::PhysicalPath() const { - char *path(NULL); + const char *path(NULL); if ((m_config != NULL) && (nvlist_lookup_string(m_config, ZPOOL_CONFIG_PHYS_PATH, &path) == 0)) diff --git a/cmd/zfsd/zfsd.cc b/cmd/zfsd/zfsd.cc index 56c9503162..29c6b1ae22 100644 --- a/cmd/zfsd/zfsd.cc +++ b/cmd/zfsd/zfsd.cc @@ -262,9 +262,9 @@ void ZfsDaemon::RescanSystem() { struct gmesh mesh; - struct gclass *mp = NULL; - struct ggeom *gp = NULL; - struct gprovider *pp = NULL; + struct gclass *mp; + struct ggeom *gp; + struct gprovider *pp; int result; /* @@ -276,7 +276,7 @@ ZfsDaemon::RescanSystem() result = geom_gettree(&mesh); if (result != 0) { syslog(LOG_ERR, "ZfsDaemon::RescanSystem: " - "geom_gettree faild with error %d\n", result); + "geom_gettree failed with error %d\n", result); return; } diff --git a/cmd/zfsd/zfsd_event.cc b/cmd/zfsd/zfsd_event.cc index 9f63dd88e2..45fc7adbb3 100644 --- a/cmd/zfsd/zfsd_event.cc +++ b/cmd/zfsd/zfsd_event.cc @@ -48,9 +48,7 @@ * C++ flush methods */ #undef flush -/* Likewise for __init */ -#undef __init - +#undef __init #include #include #include diff --git a/cmd/zfsd/zfsd_exception.cc b/cmd/zfsd/zfsd_exception.cc index 7ebb74ca8c..e83dd0f6e5 100644 --- a/cmd/zfsd/zfsd_exception.cc +++ b/cmd/zfsd/zfsd_exception.cc @@ -106,7 +106,7 @@ ZfsdException::Log() const output << "Pool "; - char *poolName; + const char *poolName; if (nvlist_lookup_string(m_poolConfig, ZPOOL_CONFIG_POOL_NAME, &poolName) == 0) output << poolName; diff --git a/cmd/zfsd/zpool_list.h b/cmd/zfsd/zpool_list.h index 6ee30892ae..7d1b176ac7 100644 --- a/cmd/zfsd/zpool_list.h +++ b/cmd/zfsd/zpool_list.h @@ -95,7 +95,7 @@ public: static PoolFilter_t ZpoolByName; /** - * \brief ZpoolList contructor + * \brief ZpoolList constructor * * \param filter The filter function to use when constructing * the ZpoolList. This may be one of the static