Port latest zfsd changes from upstream FreeBSD
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
This commit is contained in:
parent
06029e211c
commit
e3b5817448
|
@ -309,8 +309,16 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev)
|
||||||
|
|
||||||
if (IsSpare())
|
if (IsSpare())
|
||||||
flags |= ZFS_ONLINE_SPARE;
|
flags |= ZFS_ONLINE_SPARE;
|
||||||
zpool_vdev_online(pool, vdev->GUIDString().c_str(),
|
if (zpool_vdev_online(pool, vdev->GUIDString().c_str(),
|
||||||
flags, &m_vdevState);
|
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",
|
syslog(LOG_INFO, "Onlined vdev(%s/%s:%s). State now %s.\n",
|
||||||
zpool_get_name(pool), vdev->GUIDString().c_str(),
|
zpool_get_name(pool), vdev->GUIDString().c_str(),
|
||||||
devPath.c_str(),
|
devPath.c_str(),
|
||||||
|
@ -510,8 +518,7 @@ bool
|
||||||
CaseFile::ActivateSpare() {
|
CaseFile::ActivateSpare() {
|
||||||
nvlist_t *config, *nvroot, *parent_config;
|
nvlist_t *config, *nvroot, *parent_config;
|
||||||
nvlist_t **spares;
|
nvlist_t **spares;
|
||||||
char *devPath, *vdev_type;
|
const char *devPath, *poolname, *vdev_type;
|
||||||
const char *poolname;
|
|
||||||
u_int nspares, i;
|
u_int nspares, i;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
@ -538,7 +545,7 @@ CaseFile::ActivateSpare() {
|
||||||
|
|
||||||
parent_config = find_parent(config, nvroot, m_vdevGUID);
|
parent_config = find_parent(config, nvroot, m_vdevGUID);
|
||||||
if (parent_config != NULL) {
|
if (parent_config != NULL) {
|
||||||
char *parent_type;
|
const char *parent_type;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't activate spares for members of a "replacing" vdev.
|
* 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);
|
nvlist_free(newvd);
|
||||||
|
|
||||||
retval = (zpool_vdev_attach(zhp, oldstr.c_str(), path, nvroot,
|
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)
|
if (retval)
|
||||||
syslog(LOG_INFO, "Replacing vdev(%s/%s) with %s\n",
|
syslog(LOG_INFO, "Replacing vdev(%s/%s) with %s\n",
|
||||||
poolname, oldstr.c_str(), path);
|
poolname, oldstr.c_str(), path);
|
||||||
|
|
|
@ -336,7 +336,7 @@ Vdev::Name(zpool_handle_t *zhp, bool verbose) const
|
||||||
string
|
string
|
||||||
Vdev::Path() const
|
Vdev::Path() const
|
||||||
{
|
{
|
||||||
char *path(NULL);
|
const char *path(NULL);
|
||||||
|
|
||||||
if ((m_config != NULL)
|
if ((m_config != NULL)
|
||||||
&& (nvlist_lookup_string(m_config, ZPOOL_CONFIG_PATH, &path) == 0))
|
&& (nvlist_lookup_string(m_config, ZPOOL_CONFIG_PATH, &path) == 0))
|
||||||
|
@ -348,7 +348,7 @@ Vdev::Path() const
|
||||||
string
|
string
|
||||||
Vdev::PhysicalPath() const
|
Vdev::PhysicalPath() const
|
||||||
{
|
{
|
||||||
char *path(NULL);
|
const char *path(NULL);
|
||||||
|
|
||||||
if ((m_config != NULL) && (nvlist_lookup_string(m_config,
|
if ((m_config != NULL) && (nvlist_lookup_string(m_config,
|
||||||
ZPOOL_CONFIG_PHYS_PATH, &path) == 0))
|
ZPOOL_CONFIG_PHYS_PATH, &path) == 0))
|
||||||
|
|
|
@ -262,9 +262,9 @@ void
|
||||||
ZfsDaemon::RescanSystem()
|
ZfsDaemon::RescanSystem()
|
||||||
{
|
{
|
||||||
struct gmesh mesh;
|
struct gmesh mesh;
|
||||||
struct gclass *mp = NULL;
|
struct gclass *mp;
|
||||||
struct ggeom *gp = NULL;
|
struct ggeom *gp;
|
||||||
struct gprovider *pp = NULL;
|
struct gprovider *pp;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -276,7 +276,7 @@ ZfsDaemon::RescanSystem()
|
||||||
result = geom_gettree(&mesh);
|
result = geom_gettree(&mesh);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
syslog(LOG_ERR, "ZfsDaemon::RescanSystem: "
|
syslog(LOG_ERR, "ZfsDaemon::RescanSystem: "
|
||||||
"geom_gettree faild with error %d\n", result);
|
"geom_gettree failed with error %d\n", result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,9 +48,7 @@
|
||||||
* C++ flush methods
|
* C++ flush methods
|
||||||
*/
|
*/
|
||||||
#undef flush
|
#undef flush
|
||||||
/* Likewise for __init */
|
#undef __init
|
||||||
#undef __init
|
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
|
@ -106,7 +106,7 @@ ZfsdException::Log() const
|
||||||
|
|
||||||
output << "Pool ";
|
output << "Pool ";
|
||||||
|
|
||||||
char *poolName;
|
const char *poolName;
|
||||||
if (nvlist_lookup_string(m_poolConfig, ZPOOL_CONFIG_POOL_NAME,
|
if (nvlist_lookup_string(m_poolConfig, ZPOOL_CONFIG_POOL_NAME,
|
||||||
&poolName) == 0)
|
&poolName) == 0)
|
||||||
output << poolName;
|
output << poolName;
|
||||||
|
|
|
@ -95,7 +95,7 @@ public:
|
||||||
static PoolFilter_t ZpoolByName;
|
static PoolFilter_t ZpoolByName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief ZpoolList contructor
|
* \brief ZpoolList constructor
|
||||||
*
|
*
|
||||||
* \param filter The filter function to use when constructing
|
* \param filter The filter function to use when constructing
|
||||||
* the ZpoolList. This may be one of the static
|
* the ZpoolList. This may be one of the static
|
||||||
|
|
Loading…
Reference in New Issue