From: Brian Behlendorf Date: Mon, 8 Apr 2019 16:14:45 +0000 (-0700) Subject: Fix 'zfs list -t snapshot' depth X-Git-Tag: zfs-0.8.0~85 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;ds=sidebyside;h=c375c69ecad41f68610ad1186355822e28744476;p=mirror_zfs.git Fix 'zfs list -t snapshot' depth Commit df583073 introduced the ability to list the snapshots for a specified dataset. This change inadvertently resulted in only the top- level snapshots being listed when no dataset was specified. Fix this issue by adding an additional check to determine if a dataset was provided to avoid incorrectly restricting the depth. Reviewed-by: George Melikov Reviewed-by: Tom Caputi Reviewed-by: Alek Pinchuk Signed-off-by: Brian Behlendorf Closes #8591 Closes #8594 --- diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 57eb30528..5df206293 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -1926,7 +1926,7 @@ zfs_do_get(int argc, char **argv) * Handle users who want to get all snapshots of the current * dataset (ex. 'zfs get -t snapshot refer '). */ - if (types == ZFS_TYPE_SNAPSHOT && + if (types == ZFS_TYPE_SNAPSHOT && argc > 1 && (flags & ZFS_ITER_RECURSE) == 0 && limit == 0) { flags |= (ZFS_ITER_DEPTH_LIMIT | ZFS_ITER_RECURSE); limit = 1; @@ -3430,7 +3430,7 @@ zfs_do_list(int argc, char **argv) * Handle users who want to list all snapshots of the current * dataset (ex. 'zfs list -t snapshot '). */ - if (types == ZFS_TYPE_SNAPSHOT && + if (types == ZFS_TYPE_SNAPSHOT && argc > 0 && (flags & ZFS_ITER_RECURSE) == 0 && limit == 0) { flags |= (ZFS_ITER_DEPTH_LIMIT | ZFS_ITER_RECURSE); limit = 1;