mirror_zfs/man/man8
John Gallagher e60e158eff Add subcommand to wait for background zfs activity to complete
Currently the best way to wait for the completion of a long-running
operation in a pool, like a scrub or device removal, is to poll 'zpool
status' and parse its output, which is neither efficient nor convenient.

This change adds a 'wait' subcommand to the zpool command. When invoked,
'zpool wait' will block until a specified type of background activity
completes. Currently, this subcommand can wait for any of the following:

 - Scrubs or resilvers to complete
 - Devices to initialized
 - Devices to be replaced
 - Devices to be removed
 - Checkpoints to be discarded
 - Background freeing to complete

For example, a scrub that is in progress could be waited for by running

    zpool wait -t scrub <pool>

This also adds a -w flag to the attach, checkpoint, initialize, replace,
remove, and scrub subcommands. When used, this flag makes the operations
kicked off by these subcommands synchronous instead of asynchronous.

This functionality is implemented using a new ioctl. The type of
activity to wait for is provided as input to the ioctl, and the ioctl
blocks until all activity of that type has completed. An ioctl was used
over other methods of kernel-userspace communiction primarily for the
sake of portability.

Porting Notes:
This is ported from Delphix OS change DLPX-44432. The following changes
were made while porting:

 - Added ZoL-style ioctl input declaration.
 - Reorganized error handling in zpool_initialize in libzfs to integrate
   better with changes made for TRIM support.
 - Fixed check for whether a checkpoint discard is in progress.
   Previously it also waited if the pool had a checkpoint, instead of
   just if a checkpoint was being discarded.
 - Exposed zfs_initialize_chunk_size as a ZoL-style tunable.
 - Updated more existing tests to make use of new 'zpool wait'
   functionality, tests that don't exist in Delphix OS.
 - Used existing ZoL tunable zfs_scan_suspend_progress, together with
   zinject, in place of a new tunable zfs_scan_max_blks_per_txg.
 - Added support for a non-integral interval argument to zpool wait.

Future work:
ZoL has support for trimming devices, which Delphix OS does not. In the
future, 'zpool wait' could be extended to add the ability to wait for
trim operations to complete.

Reviewed-by: Matt Ahrens <matt@delphix.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: John Gallagher <john.gallagher@delphix.com>
Closes #9162
2019-09-13 18:09:06 -07:00
..
.gitignore Ignore *.o.ur-safe build artifacts 2018-05-13 18:59:02 -07:00
fsck.zfs.8 Fix NAME section of manpages zhack and fsck.zfs. 2014-03-10 09:19:17 -07:00
Makefile.am Tunable directory for zfs runtime scripts 2018-06-07 09:59:59 -07:00
mount.zfs.8 zfs.8 & mount.zfs.8: fix a few typos 2016-05-16 12:26:31 -07:00
vdev_id.8 vdev_id support for device link aliases 2012-12-03 14:04:47 -08:00
zdb.8 Fix typos in man/ 2019-08-30 09:41:35 -07:00
zed.8.in Tunable directory for zfs runtime scripts 2018-06-07 09:59:59 -07:00
zfs-mount-generator.8.in systemd encryption key support 2019-07-15 16:31:47 -07:00
zfs-program.8 Introduce getting holds and listing bookmarks through ZCP 2019-08-12 10:02:34 -07:00
zfs.8 Fix typos in man/ 2019-08-30 09:41:35 -07:00
zgenhostid.8 Correct man page dates 2019-05-08 10:59:32 -07:00
zinject.8 Multiple DVA Scrubbing Fix 2019-03-15 14:14:31 -07:00
zpool.8 Add subcommand to wait for background zfs activity to complete 2019-09-13 18:09:06 -07:00
zstreamdump.8 Eliminate useless double-bolding in man pages 2019-04-24 17:04:35 -07:00