From 70232472bc08d2d130acb947d4cd6d86a26b8a6b Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 27 Oct 2020 07:03:17 +0100 Subject: [PATCH] fix #3097: cifs, nfs: increase connection check timeout to 10s we already have the ZFS pool plugin as precedent to use 10s, at for network with remote off-site storage one can get to 200 - 300ms RTT latency, which means that for a protocol needing multiple rounds of communication, one can easily get over 2s while not being in a broken network. Signed-off-by: Thomas Lamprecht --- PVE/Storage/CIFSPlugin.pm | 8 +++----- PVE/Storage/NFSPlugin.pm | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/PVE/Storage/CIFSPlugin.pm b/PVE/Storage/CIFSPlugin.pm index 6edbc9d..7ec7164 100644 --- a/PVE/Storage/CIFSPlugin.pm +++ b/PVE/Storage/CIFSPlugin.pm @@ -262,14 +262,12 @@ sub check_connection { } else { push @$cmd, '-U', 'Guest','-N'; } - push @$cmd, '-c', 'echo 1 0'; my $out_str; - eval { - run_command($cmd, timeout => 2, outfunc => sub {$out_str .= shift;}, - errfunc => sub {}); - }; + my $out = sub { $out_str .= shift }; + + eval { run_command($cmd, timeout => 10, outfunc => $out, errfunc => sub {}) }; if (my $err = $@) { die "$out_str\n" if defined($out_str) && diff --git a/PVE/Storage/NFSPlugin.pm b/PVE/Storage/NFSPlugin.pm index 6abb24b..c94fb91 100644 --- a/PVE/Storage/NFSPlugin.pm +++ b/PVE/Storage/NFSPlugin.pm @@ -166,9 +166,7 @@ sub check_connection { my $cmd = ['/sbin/showmount', '--no-headers', '--exports', $server]; - eval { - run_command($cmd, timeout => 2, outfunc => sub {}, errfunc => sub {}); - }; + eval { run_command($cmd, timeout => 10, outfunc => sub {}, errfunc => sub {}) }; if (my $err = $@) { return 0; }