Port latest zfsd changes from upstream FreeBSD

Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
This commit is contained in:
Ameer Hamza 2023-06-20 16:38:07 +05:00
parent 06029e211c
commit e3b5817448
6 changed files with 22 additions and 17 deletions

View File

@ -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);

View File

@ -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))

View File

@ -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;
}

View File

@ -48,9 +48,7 @@
* C++ flush methods
*/
#undef flush
/* Likewise for __init */
#undef __init
#include <list>
#include <map>
#include <sstream>

View File

@ -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;

View File

@ -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