Skip snapshot in zfs_iter_mounted()
authoryouzhongyang <youzhong@gmail.com>
Wed, 20 Oct 2021 23:07:19 +0000 (19:07 -0400)
committerGitHub <noreply@github.com>
Wed, 20 Oct 2021 23:07:19 +0000 (16:07 -0700)
commitec64fdb93d144ab1884097cfd36e18b62a2db848
treeb0f072cb457e720ab25a074989440e55845f72a3
parent1886cdfcfb970d57d4a2ae40b56d2dab2f029e2b
Skip snapshot in zfs_iter_mounted()

The intention of the zfs_iter_mounted() is to traverse the dataset
and its descendants, not the snapshots. The current code can cause
a mounted snapshot to be included and thus zfs_open() on the snapshot
with ZFS_TYPE_FILESYSTEM would print confusing message such as "cannot
open 'rpool/fs@snap': snapshot delimiter '@' is not expected here".

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Youzhong Yang <yyang@mathworks.com>
Closes #12447
Closes #12448
lib/libzfs/libzfs_iter.c
tests/test-runner/include/logapi.shlib
tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_nested.ksh