]> git.proxmox.com Git - pve-storage.git/commitdiff
fix bug #602: now zfs will wait 5 sec if error msg is "dataset is busy"
authorWolfgang Link <w.link@proxmox.com>
Fri, 6 Mar 2015 08:38:30 +0000 (09:38 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 6 Mar 2015 09:15:40 +0000 (10:15 +0100)
Signed-off-by: Wolfgang Link <w.link@proxmox.com>
PVE/Storage/ZFSPoolPlugin.pm

index b9b3bf029c5a8ed9a7dd45ae3ea6343efd132e3d..39fc3484b95697a503ec0ff802b24355602e0099 100644 (file)
@@ -166,7 +166,7 @@ sub zfs_request {
         $msg .= "$line\n";
     };
 
-    run_command($cmd, outfunc => $output, timeout => $timeout);
+    run_command($cmd, errmsg => "zfs error", outfunc => $output, timeout => $timeout);
 
     return $msg;
 }
@@ -293,7 +293,23 @@ sub zfs_create_zvol {
 sub zfs_delete_zvol {
     my ($class, $scfg, $zvol) = @_;
 
-    $class->zfs_request($scfg, undef, 'destroy', '-r', "$scfg->{pool}/$zvol");
+    my $err;
+
+    for (my $i = 0; $i < 6; $i++) {
+
+       eval { $class->zfs_request($scfg, undef, 'destroy', '-r', "$scfg->{pool}/$zvol"); };
+       if ($err = $@) {
+           if ($err =~ m/^zfs error:(.*): dataset is busy.*/) {
+               sleep(1);
+           } else {
+               die $err;
+           }
+       } else {
+           last;
+       }
+    }
+
+    die $err if $err;
 }
 
 sub zfs_list_zvol {