From 97382ed9d8ab2caf3af58b07ee1691dc37062ae7 Mon Sep 17 00:00:00 2001 From: Jim Salter Date: Mon, 17 Nov 2014 10:22:20 -0500 Subject: [PATCH] added iszfsbusy check to pruning routine --- sanoid | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sanoid b/sanoid index 30d4c02..5d6ce1d 100755 --- a/sanoid +++ b/sanoid @@ -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;