svn commit: r256359 - projects/zfsd/head/cddl/sbin/zfsd
Alan Somers
asomers at FreeBSD.org
Fri Oct 11 23:02:47 UTC 2013
Author: asomers
Date: Fri Oct 11 23:02:46 2013
New Revision: 256359
URL: http://svnweb.freebsd.org/changeset/base/256359
Log:
Zfsd will now activate a spare when it gets added to an already degraded pool.
cddl/sbin/zfsd/case_file.cc
* Keep a casefile for a removed drive open if it can't be
immediately resolved by activating a spare.
* Add a log message when degrading vdevs.
cddl/sbin/zfsd/dev_ctl_event.cc
* Fix replaying log messages in response to a config sync event.
The event's name is different under FreeBSD than under
Illumos.
* Fix two printf formatting bugs in the log messages of
EventBuffer::ExtractEvent().
Submitted by: asomers
Approved by: ken (mentor)
Sponsored by: Spectra Logic Corporation
Modified:
projects/zfsd/head/cddl/sbin/zfsd/case_file.cc
projects/zfsd/head/cddl/sbin/zfsd/dev_ctl_event.cc
Modified: projects/zfsd/head/cddl/sbin/zfsd/case_file.cc
==============================================================================
--- projects/zfsd/head/cddl/sbin/zfsd/case_file.cc Fri Oct 11 22:54:02 2013 (r256358)
+++ projects/zfsd/head/cddl/sbin/zfsd/case_file.cc Fri Oct 11 23:02:46 2013 (r256359)
@@ -331,6 +331,7 @@ CaseFile::ReEvaluate(const ZfsEvent &eve
}
if (event.Value("class") == "resource.fs.zfs.removed") {
+ bool spare_activated;
/*
* Discard any tentative I/O error events for
@@ -340,7 +341,7 @@ CaseFile::ReEvaluate(const ZfsEvent &eve
PurgeTentativeEvents();
/* Try to activate spares if they are available */
- ActivateSpare();
+ spare_activated = ActivateSpare();
/*
* Rescan the drives in the system to see if a recent
@@ -348,7 +349,13 @@ CaseFile::ReEvaluate(const ZfsEvent &eve
*/
ZfsDaemon::RequestSystemRescan();
- consumed = true;
+ /*
+ * Consume the event if we successfully activated a spare.
+ * Otherwise, leave it in the unconsumed events list so that the
+ * future addition of a spare to this pool might be able to
+ * close the case
+ */
+ consumed = spare_activated;
} else if (event.Value("class") == "ereport.fs.zfs.io"
|| event.Value("class") == "ereport.fs.zfs.checksum") {
@@ -792,9 +799,17 @@ CaseFile::OnGracePeriodEnded()
/* Degrade the vdev and close the case. */
if (zpool_vdev_degrade(zpl.front(), (uint64_t)m_vdevGUID,
VDEV_AUX_ERR_EXCEEDED) == 0) {
+ syslog(LOG_INFO, "Degrading vdev(%s/%s)",
+ PoolGUIDString().c_str(), VdevGUIDString().c_str());
Close();
return;
}
+ else {
+ syslog(LOG_ERR, "Degrade vdev(%s/%s): %s: %s\n",
+ PoolGUIDString().c_str(), VdevGUIDString().c_str(),
+ libzfs_error_action(g_zfsHandle),
+ libzfs_error_description(g_zfsHandle));
+ }
}
Serialize();
}
Modified: projects/zfsd/head/cddl/sbin/zfsd/dev_ctl_event.cc
==============================================================================
--- projects/zfsd/head/cddl/sbin/zfsd/dev_ctl_event.cc Fri Oct 11 22:54:02 2013 (r256358)
+++ projects/zfsd/head/cddl/sbin/zfsd/dev_ctl_event.cc Fri Oct 11 23:02:46 2013 (r256359)
@@ -612,7 +612,7 @@ ZfsEvent::Process() const
}
/* On config syncs, replay any queued events first. */
- if (Value("type").find("ESC_ZFS_config_sync") == 0)
+ if (Value("type").find("misc.fs.zfs.config_sync") == 0)
ZfsDaemon::ReplayUnconsumedEvents();
Log(LOG_INFO);
@@ -676,7 +676,17 @@ ZfsEvent::Process() const
Vdev vdev(zpl.front(), vdevConfig);
caseFile = &CaseFile::Create(vdev);
- caseFile->ReEvaluate(*this);
+ if ( caseFile->ReEvaluate(*this) == false) {
+ stringstream msg;
+ bool queued = ZfsDaemon::SaveEvent(*this);
+ int priority = queued ? LOG_INFO : LOG_ERR;
+ msg << "ZfsEvent::Process: Unconsumed event for vdev(";
+ msg << zpool_get_name(zpl.front()) << ",";
+ msg << vdev.GUID() << ") ";
+ msg << (queued ? "queued" : "dropped");
+ syslog(priority, msg.str().c_str());
+ return;
+ }
}
//- ZfsEvent Protected Methods -------------------------------------------------
More information about the svn-src-projects
mailing list