]> git.proxmox.com Git - pve-storage.git/commitdiff
Fixes: #1415 do not block pvestatd when nfsd is stopped on the server side
authorEmmanuel Kasper <e.kasper@proxmox.com>
Thu, 29 Jun 2017 12:48:13 +0000 (14:48 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 29 Jun 2017 13:16:08 +0000 (15:16 +0200)
Wrap the -d test with run_or_get_killed sub this test
can make pvestatd hang on I/O wait when a nfsd process is stopped

This might help with other file based storages, for instance
directory storages on unplugged USB devices.

PVE/Storage/Plugin.pm

index b640712a8eaad6dd29288995d1fa77487af66d4f..6f72ceed1f44676780e83f958de41363a756b1c9 100644 (file)
@@ -853,8 +853,13 @@ sub activate_storage {
 
     die "storage definintion has no path\n" if !$path;
 
-    die "unable to activate storage '$storeid' - " .
-       "directory '$path' does not exist\n" if ! -d $path;
+    # this path test may hang indefinitely on unresponsive mounts
+    my $timeout = 2;
+    if (! PVE::Tools::run_fork_with_timeout($timeout, sub {-d $path})) {
+       die "unable to activate storage '$storeid' - " .
+       "directory '$path' does not exist or is unreachable\n";
+    }
+
 
     return if defined($scfg->{mkdir}) && !$scfg->{mkdir};