mirror of https://github.com/jimsalterjrs/sanoid
Merge pull request #450 from phreaker0/fix-dataset-detection
improve dataset detection by only including mounted datasets
This commit is contained in:
commit
03e523ff01
9
findoid
9
findoid
|
|
@ -102,14 +102,19 @@ sub getdataset {
|
||||||
|
|
||||||
my ($path) = @_;
|
my ($path) = @_;
|
||||||
|
|
||||||
open FH, "$zfs list -Ho mountpoint |";
|
open FH, "$zfs list -H -t filesystem -o mountpoint,mounted |";
|
||||||
my @datasets = <FH>;
|
my @datasets = <FH>;
|
||||||
close FH;
|
close FH;
|
||||||
|
|
||||||
my @matchingdatasets;
|
my @matchingdatasets;
|
||||||
foreach my $dataset (@datasets) {
|
foreach my $dataset (@datasets) {
|
||||||
chomp $dataset;
|
chomp $dataset;
|
||||||
if ( $path =~ /^$dataset/ ) { push @matchingdatasets, $dataset; }
|
my ($mountpoint, $mounted) = ($dataset =~ m/([^\t]*)\t*(.*)/);
|
||||||
|
if ($mounted ne "yes") {
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $path =~ /^$mountpoint/ ) { push @matchingdatasets, $mountpoint; }
|
||||||
}
|
}
|
||||||
|
|
||||||
my $bestmatch = '';
|
my $bestmatch = '';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue