git: 53b438b2425c - main - zfsd: Check for error from zpool_vdev_online

Ryan Moeller freqlabs at FreeBSD.org
Tue Jul 6 16:07:05 UTC 2021


The branch main has been updated by freqlabs:

URL: https://cgit.FreeBSD.org/src/commit/?id=53b438b2425c374f6147ac80b3330a9ec08432bb

commit 53b438b2425c374f6147ac80b3330a9ec08432bb
Author:     Ryan Moeller <freqlabs at FreeBSD.org>
AuthorDate: 2021-07-06 16:00:18 +0000
Commit:     Ryan Moeller <freqlabs at FreeBSD.org>
CommitDate: 2021-07-06 16:00:18 +0000

    zfsd: Check for error from zpool_vdev_online
    
    Onlining a vdev can fail. Log the error if it does.
    
    Reviewed by:    mav, asomers
    MFC after:      1 week
    Sponsored by:   iXsystems, Inc.
    Differential Revision:  https://reviews.freebsd.org/D30882
---
 cddl/usr.sbin/zfsd/case_file.cc | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/cddl/usr.sbin/zfsd/case_file.cc b/cddl/usr.sbin/zfsd/case_file.cc
index da2125b4d716..8da711fc10cb 100644
--- a/cddl/usr.sbin/zfsd/case_file.cc
+++ b/cddl/usr.sbin/zfsd/case_file.cc
@@ -280,9 +280,17 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev)
 	   || vdev->PoolGUID() == Guid::InvalidGuid())
 	 && vdev->GUID() == m_vdevGUID) {
 
-		zpool_vdev_online(pool, vdev->GUIDString().c_str(),
-				  ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE,
-				  &m_vdevState);
+		if (zpool_vdev_online(pool, vdev->GUIDString().c_str(),
+		    ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE,
+		    &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(),


More information about the dev-commits-src-all mailing list