mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-04-12 22:51:46 +03:00
zpool clear: remove undocumented rewind flags
Remove the -F, -n, and -X flags from zpool clear. These flags were inherited from OpenSolaris but are not applicable in this context. Unlike zpool import, where the pool is not yet loaded and a specific TXG can be selected, zpool clear operates on an already imported pool whose in-memory state is ahead of what is on disk. Rewinding transactions would require force-exporting the pool first. The rewind policy passed to zpool_clear() is now always ZPOOL_NO_REWIND. Tested on FreeBSD 16.0-CURRENT (amd64). Verified that -F, -n, and -X are properly rejected as invalid options and that the usage output reflects the change. Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Christos Longros <chris.longros@gmail.com> Closes #13825 Closes #18300
This commit is contained in:
parent
65165df129
commit
d35951b18d
@ -458,7 +458,7 @@ get_usage(zpool_help_t idx)
|
||||
return (gettext("\tattach [-fsw] [-o property=value] "
|
||||
"<pool> <vdev> <new-device>\n"));
|
||||
case HELP_CLEAR:
|
||||
return (gettext("\tclear [[--power]|[-nF]] <pool> [device]\n"));
|
||||
return (gettext("\tclear [--power] <pool> [device]\n"));
|
||||
case HELP_CREATE:
|
||||
return (gettext("\tcreate [-fnd] [-o property=value] ... \n"
|
||||
"\t [-O file-system-property=value] ... \n"
|
||||
@ -8251,7 +8251,7 @@ zpool_do_offline(int argc, char **argv)
|
||||
}
|
||||
|
||||
/*
|
||||
* zpool clear [-nF]|[--power] <pool> [device]
|
||||
* zpool clear [--power] <pool> [device]
|
||||
*
|
||||
* Clear all errors associated with a pool or a particular device.
|
||||
*/
|
||||
@ -8260,11 +8260,7 @@ zpool_do_clear(int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
int ret = 0;
|
||||
boolean_t dryrun = B_FALSE;
|
||||
boolean_t do_rewind = B_FALSE;
|
||||
boolean_t xtreme_rewind = B_FALSE;
|
||||
boolean_t is_power_on = B_FALSE;
|
||||
uint32_t rewind_policy = ZPOOL_NO_REWIND;
|
||||
nvlist_t *policy = NULL;
|
||||
zpool_handle_t *zhp;
|
||||
char *pool, *device;
|
||||
@ -8275,18 +8271,9 @@ zpool_do_clear(int argc, char **argv)
|
||||
};
|
||||
|
||||
/* check options */
|
||||
while ((c = getopt_long(argc, argv, "FnX", long_options,
|
||||
while ((c = getopt_long(argc, argv, "", long_options,
|
||||
NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'F':
|
||||
do_rewind = B_TRUE;
|
||||
break;
|
||||
case 'n':
|
||||
dryrun = B_TRUE;
|
||||
break;
|
||||
case 'X':
|
||||
xtreme_rewind = B_TRUE;
|
||||
break;
|
||||
case ZPOOL_OPTION_POWER:
|
||||
is_power_on = B_TRUE;
|
||||
break;
|
||||
@ -8313,24 +8300,8 @@ zpool_do_clear(int argc, char **argv)
|
||||
usage(B_FALSE);
|
||||
}
|
||||
|
||||
if ((dryrun || xtreme_rewind) && !do_rewind) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("-n or -X only meaningful with -F\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
if (dryrun)
|
||||
rewind_policy = ZPOOL_TRY_REWIND;
|
||||
else if (do_rewind)
|
||||
rewind_policy = ZPOOL_DO_REWIND;
|
||||
if (xtreme_rewind)
|
||||
rewind_policy |= ZPOOL_EXTREME_REWIND;
|
||||
|
||||
/* In future, further rewind policy choices can be passed along here */
|
||||
if (nvlist_alloc(&policy, NV_UNIQUE_NAME, 0) != 0 ||
|
||||
nvlist_add_uint32(policy, ZPOOL_LOAD_REWIND_POLICY,
|
||||
rewind_policy) != 0) {
|
||||
if (nvlist_alloc(&policy, NV_UNIQUE_NAME, 0) != 0)
|
||||
return (1);
|
||||
}
|
||||
|
||||
pool = argv[0];
|
||||
device = argc == 2 ? argv[1] : NULL;
|
||||
|
||||
@ -4412,7 +4412,8 @@ zpool_clear(zpool_handle_t *zhp, const char *path, nvlist_t *rewindnvl)
|
||||
zc.zc_cookie = policy.zlp_rewind;
|
||||
|
||||
zcmd_alloc_dst_nvlist(hdl, &zc, zhp->zpool_config_size * 2);
|
||||
zcmd_write_src_nvlist(hdl, &zc, rewindnvl);
|
||||
if (rewindnvl != NULL)
|
||||
zcmd_write_src_nvlist(hdl, &zc, rewindnvl);
|
||||
|
||||
while ((error = zfs_ioctl(hdl, ZFS_IOC_CLEAR, &zc)) != 0 &&
|
||||
errno == ENOMEM)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user