text stringlengths 0 14.1k |
|---|
if (islog && version < SPA_VERSION_HOLES) { |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
""pool must be upgrade to support log removal"")); |
return (zfs_error(hdl, EZFS_BADVERSION, msg)); |
} |
verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID, &zc.zc_guid) == 0); |
if (zfs_ioctl(hdl, ZFS_IOC_VDEV_REMOVE, &zc) == 0) |
return (0); |
return (zpool_standard_error(hdl, errno, msg)); |
} |
/* |
* Clear the errors for the pool, or the particular device if specified. |
*/ |
int |
zpool_clear(zpool_handle_t *zhp, const char *path, nvlist_t *rewindnvl) |
{ |
zfs_cmd_t zc = { 0 }; |
char msg[1024]; |
nvlist_t *tgt; |
zpool_rewind_policy_t policy; |
boolean_t avail_spare, l2cache; |
libzfs_handle_t *hdl = zhp->zpool_hdl; |
nvlist_t *nvi = NULL; |
if (path) |
(void) snprintf(msg, sizeof (msg), |
dgettext(TEXT_DOMAIN, ""cannot clear errors for %s""), |
path); |
else |
(void) snprintf(msg, sizeof (msg), |
dgettext(TEXT_DOMAIN, ""cannot clear errors for %s""), |
zhp->zpool_name); |
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); |
if (path) { |
if ((tgt = zpool_find_vdev(zhp, path, &avail_spare, |
&l2cache, NULL)) == 0) |
return (zfs_error(hdl, EZFS_NODEVICE, msg)); |
/* |
* Don't allow error clearing for hot spares. Do allow |
* error clearing for l2cache devices. |
*/ |
if (avail_spare) |
return (zfs_error(hdl, EZFS_ISSPARE, msg)); |
verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID, |
&zc.zc_guid) == 0); |
} |
zpool_get_rewind_policy(rewindnvl, &policy); |
zc.zc_cookie = policy.zrp_request; |
if (zcmd_alloc_dst_nvlist(hdl, &zc, 8192) != 0) |
return (-1); |
if (zcmd_write_src_nvlist(zhp->zpool_hdl, &zc, rewindnvl) != 0) |
return (-1); |
if (zfs_ioctl(hdl, ZFS_IOC_CLEAR, &zc) == 0 || |
((policy.zrp_request & ZPOOL_TRY_REWIND) && |
errno != EPERM && errno != EACCES)) { |
if (policy.zrp_request & |
(ZPOOL_DO_REWIND | ZPOOL_TRY_REWIND)) { |
(void) zcmd_read_dst_nvlist(hdl, &zc, &nvi); |
zpool_rewind_exclaim(hdl, zc.zc_name, |
((policy.zrp_request & ZPOOL_TRY_REWIND) != 0), |
nvi); |
nvlist_free(nvi); |
} |
zcmd_free_nvlists(&zc); |
return (0); |
} |
zcmd_free_nvlists(&zc); |
return (zpool_standard_error(hdl, errno, msg)); |
} |
/* |
* Similar to zpool_clear(), but takes a GUID (used by fmd). |
*/ |
int |
zpool_vdev_clear(zpool_handle_t *zhp, uint64_t guid) |
{ |
zfs_cmd_t zc = { 0 }; |
char msg[1024]; |
libzfs_handle_t *hdl = zhp->zpool_hdl; |
(void) snprintf(msg, sizeof (msg), |
dgettext(TEXT_DOMAIN, ""cannot clear errors for %llx""), |
(longlong_t) guid); |
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); |
zc.zc_guid = guid; |
if (ioctl(hdl->libzfs_fd, ZFS_IOC_CLEAR, &zc) == 0) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.