mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
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
This commit is contained in:
@@ -575,8 +575,11 @@ zfs_iter_mounted(zfs_handle_t *zhp, zfs_iter_f func, void *data)
|
||||
|
||||
/* Ignore datasets not within the provided dataset */
|
||||
if (strncmp(entry.mnt_special, zhp->zfs_name, namelen) != 0 ||
|
||||
(entry.mnt_special[namelen] != '/' &&
|
||||
entry.mnt_special[namelen] != '@'))
|
||||
entry.mnt_special[namelen] != '/')
|
||||
continue;
|
||||
|
||||
/* Skip snapshot of any child dataset */
|
||||
if (strchr(entry.mnt_special, '@') != NULL)
|
||||
continue;
|
||||
|
||||
if ((mtab_zhp = zfs_open(zhp->zfs_hdl, entry.mnt_special,
|
||||
|
||||
Reference in New Issue
Block a user