diff options
author | Tim Chase <[email protected]> | 2013-12-23 14:06:34 -0600 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-01-07 09:00:26 -0800 |
commit | fb8e608d9dacf2f6703da8c853f6086e4dd79824 (patch) | |
tree | ebd6b931056bc41da0006c4c112aa5974832c909 /cmd/zfs/zfs_main.c | |
parent | 5d862cb0d9a4b6dcc97a88fa0d5a7a717566e5ab (diff) |
Fix the creation of ZPOOL_HIST_CMD pool history entries.
Move the libzfs_fini() after the zpool_log_history() call so the
ZPOOL_HIST_CMD entry can get written.
Fix the handling of saved_poolname in zfsdev_ioctl()
which was broken as part of the stack-reduction work in
a16878805388c4d96cb8a294de965071d138a47b.
Since ZoL destroys the TSD data in which the previously successful
ioctl()'s pool name is stored following every vop, the ZFS_IOC_LOG_HISTORY
ioctl has a very important restriction: it can only successfully write
a long entry following a successful ioctl() if no intervening vops have
been performed. Some of zfs subcommands do perform intervening vops and
to do the logging themselves. At the moment, the "create" and "clone"
subcommands have been modified appropriately.
Signed-off-by: Tim Chase <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #1998
Diffstat (limited to 'cmd/zfs/zfs_main.c')
-rw-r--r-- | cmd/zfs/zfs_main.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 3f54985b9..cea421238 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -649,6 +649,11 @@ zfs_do_clone(int argc, char **argv) if (ret == 0) { zfs_handle_t *clone; + if (log_history) { + (void) zpool_log_history(g_zfs, history_str); + log_history = B_FALSE; + } + clone = zfs_open(g_zfs, argv[1], ZFS_TYPE_DATASET); if (clone != NULL) { if (zfs_get_type(clone) != ZFS_TYPE_VOLUME) @@ -828,6 +833,11 @@ zfs_do_create(int argc, char **argv) if (zfs_create(g_zfs, argv[0], type, props) != 0) goto error; + if (log_history) { + (void) zpool_log_history(g_zfs, history_str); + log_history = B_FALSE; + } + if ((zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_DATASET)) == NULL) goto error; @@ -6481,11 +6491,12 @@ main(int argc, char **argv) usage(B_FALSE); ret = 1; } - libzfs_fini(g_zfs); if (ret == 0 && log_history) (void) zpool_log_history(g_zfs, history_str); + libzfs_fini(g_zfs); + /* * The 'ZFS_ABORT' environment variable causes us to dump core on exit * for the purposes of running ::findleaks. |