added iszfsbusy check to pruning routine

This commit is contained in:
Jim Salter 2014-11-17 10:22:20 -05:00
parent 763e63e5c2
commit 97382ed9d8
1 changed files with 5 additions and 1 deletions

6
sanoid
View File

@ -201,7 +201,11 @@ sub prune_snapshots {
writelock('sanoid_pruning');
foreach my $snap( @prunesnaps ){
print "pruning $snap ... \n";
system($zfs, "destroy","-Rr",$snap) == 0 or die "could not remove $snap : $?";
if (iszfsbusy($path)) {
print "INFO: deferring pruning of $snap - $path is currently in zfs send or receive.\n";
} else {
system($zfs, "destroy","-Rr",$snap) == 0 or die "could not remove $snap : $?";
}
}
removelock('sanoid_pruning');
$forcecacheupdate = 1;