svn commit: r292378 - in projects/zfsd/head: cddl/sbin/zfsd tests/sys/cddl/zfs/tests/zfsd
Alan Somers
asomers at FreeBSD.org
Wed Dec 16 22:01:27 UTC 2015
Author: asomers
Date: Wed Dec 16 22:01:26 2015
New Revision: 292378
URL: https://svnweb.freebsd.org/changeset/base/292378
Log:
zfsd(8) should activate spares at startup
cddl/sbin/zfsd/zfsd.cc
On startup, or after the devd event buffer overflows, generate
synthetic config_sync events for every zpool. This will force any
open casefiles on those pools to be reevaluated. This fixes a bug
where zfsd wouldn't activate a spare for disks that failed while
zfsd was not running, or if the disk failure generated an event
storm that caused zfsd to drop devd events.
tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh
Clear the expected failure
Sponsored by: Spectra Logic Corp
Modified:
projects/zfsd/head/cddl/sbin/zfsd/zfsd.cc
projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh
Modified: projects/zfsd/head/cddl/sbin/zfsd/zfsd.cc
==============================================================================
--- projects/zfsd/head/cddl/sbin/zfsd/zfsd.cc Wed Dec 16 21:58:48 2015 (r292377)
+++ projects/zfsd/head/cddl/sbin/zfsd/zfsd.cc Wed Dec 16 22:01:26 2015 (r292378)
@@ -212,14 +212,48 @@ ZfsDaemon::VdevAddCaseFile(Vdev &vdev, v
void
ZfsDaemon::BuildCaseFiles()
{
- /* Add CaseFiles for vdevs with issues. */
ZpoolList zpl;
+ ZpoolList::iterator pool;
- for (ZpoolList::iterator pool = zpl.begin(); pool != zpl.end(); pool++)
+ /* Add CaseFiles for vdevs with issues. */
+ for (pool = zpl.begin(); pool != zpl.end(); pool++)
VdevIterator(*pool).Each(VdevAddCaseFile, NULL);
/* De-serialize any saved cases. */
CaseFile::DeSerialize();
+
+ /* Simulate config_sync events to force CaseFile reevaluation */
+ for (pool = zpl.begin(); pool != zpl.end(); pool++) {
+ char evString[160];
+ Event *event;
+ nvlist_t *config;
+ uint64_t poolGUID;
+ const char *poolname;
+
+ poolname = zpool_get_name(*pool);
+ config = zpool_get_config(*pool, NULL);
+ if (config == NULL) {
+ syslog(LOG_ERR, "ZFSDaemon::BuildCaseFiles: Could not "
+ "find pool config for pool %s", poolname);
+ continue;
+ }
+ if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID,
+ &poolGUID) != 0) {
+ syslog(LOG_ERR, "ZFSDaemon::BuildCaseFiles: Could not "
+ "find pool guid for pool %s", poolname);
+ continue;
+ }
+
+
+ snprintf(evString, 160, "!system=ZFS subsystem=ZFS "
+ "type=misc.fs.zfs.config_sync sub_type=synthesized "
+ "pool_name=%s pool_guid=%lu\n", poolname, poolGUID);
+ event = Event::CreateEvent(GetFactory(), string(evString));
+ if (event != NULL) {
+ event->Process();
+ delete event;
+ }
+ }
}
void
@@ -254,10 +288,11 @@ ZfsDaemon::RescanSystem()
string evString(evStart + pp->lg_name + "\n");
event = Event::CreateEvent(GetFactory(),
evString);
- if (event != NULL)
+ if (event != NULL) {
if (event->Process())
SaveEvent(*event);
delete event;
+ }
}
}
}
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh Wed Dec 16 21:58:48 2015 (r292377)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh Wed Dec 16 22:01:26 2015 (r292378)
@@ -326,7 +326,6 @@ zfsd_hotspare_007_pos_head()
}
zfsd_hotspare_007_pos_body()
{
- atf_expect_fail "P3_28731: ZFSD will not replace a vdev that dissappears while power is off"
export TESTCASE_ID=$(echo $(atf_get ident) | cksum -o 2 | cut -f 1 -d " ")
. $(atf_get_srcdir)/../../include/default.cfg
. $(atf_get_srcdir)/../hotspare/hotspare.kshlib
More information about the svn-src-projects
mailing list