zfs: list zvol: limit recursion depth to 1

To be correct in all cases, it's still necessary to filter by "pool"
in zfs_parse_zvol_list(), because $scfg->{pool} could be e.g.
'foo/vm-123-disk-0' which looks like an image name and would pass the
other "should skip"-checks in zfs_parse_zvol_list().

No change in the result of zfs_list_zvol() is intended.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fiona Ebner
2023-01-10 13:52:43 +01:00
committed by Wolfgang Bumiller
parent 4c82e7b61c
commit d05015f887

View File

@ -377,9 +377,12 @@ sub zfs_list_zvol {
'name,volsize,origin,type,refquota',
'-t',
'volume,filesystem',
'-Hrp',
'-d1',
'-Hp',
$scfg->{pool},
);
# It's still required to have zfs_parse_zvol_list filter by pool, because -d1 lists
# $scfg->{pool} too and while unlikely, it could be named to be mistaken for a volume.
my $zvols = zfs_parse_zvol_list($text, $scfg->{pool});
return {} if !$zvols;