diff options
author | Arkadiusz Bubała <[email protected]> | 2017-10-26 21:26:09 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-10-26 12:26:09 -0700 |
commit | d3f2cd7e3b70679f127dd471ea6d37ece27463f2 (patch) | |
tree | c83555f629c501dd5742272c62888caa785b7468 /lib/libzfs/libzfs_pool.c | |
parent | 3ad59c015dce45965fa309a0364a46c6f8bdda9f (diff) |
Added no_scrub_restart flag to zpool reopen
Added -n flag to zpool reopen that allows a running scrub
operation to continue if there is a device with Dirty Time Log.
By default if a component device has a DTL and zpool reopen
is executed all running scan operations will be restarted.
Added functional tests for `zpool reopen`
Tests covers following scenarios:
* `zpool reopen` without arguments,
* `zpool reopen` with pool name as argument,
* `zpool reopen` while scrubbing,
* `zpool reopen -n` while scrubbing,
* `zpool reopen -n` while resilvering,
* `zpool reopen` with bad arguments.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tom Caputi <[email protected]>
Signed-off-by: Arkadiusz Bubała <[email protected]>
Closes #6076
Closes #6746
Diffstat (limited to 'lib/libzfs/libzfs_pool.c')
-rw-r--r-- | lib/libzfs/libzfs_pool.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index bfb26d674..aa77b547a 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -25,6 +25,7 @@ * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov <[email protected]> * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2017 Open-E, Inc. All Rights Reserved. */ #include <ctype.h> @@ -3370,20 +3371,20 @@ zpool_reguid(zpool_handle_t *zhp) * Reopen the pool. */ int -zpool_reopen(zpool_handle_t *zhp) +zpool_reopen_one(zpool_handle_t *zhp, void *data) { - zfs_cmd_t zc = {"\0"}; - char msg[1024]; - libzfs_handle_t *hdl = zhp->zpool_hdl; + libzfs_handle_t *hdl = zpool_get_handle(zhp); + const char *pool_name = zpool_get_name(zhp); + boolean_t *scrub_restart = data; + int error; - (void) snprintf(msg, sizeof (msg), - dgettext(TEXT_DOMAIN, "cannot reopen '%s'"), - zhp->zpool_name); + error = lzc_reopen(pool_name, *scrub_restart); + if (error) { + return (zpool_standard_error_fmt(hdl, error, + dgettext(TEXT_DOMAIN, "cannot reopen '%s'"), pool_name)); + } - (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); - if (zfs_ioctl(hdl, ZFS_IOC_POOL_REOPEN, &zc) == 0) - return (0); - return (zpool_standard_error(hdl, errno, msg)); + return (0); } /* call into libzfs_core to execute the sync IOCTL per pool */ |