From 4cd9b85d1518a3cc84137aa3edbdc5b2c003ac48 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Thu, 23 Dec 2021 13:06:22 +0100 Subject: [PATCH] fix #3803: ZFSPoolPlugin: zfs_request: increase minimum timeout in worker Since most zfs operations can take a while (under certain conditions), increase the minimum timeout for zfs_request in workers to 5 minutes. We cannot increase the timeouts in synchronous api calls, since they are hard limited to 30 seconds, but in worker we do not have such limits. The existing default timeout does not change (60minutes in worker, 5seconds otherwise), but all zfs_requests with a set timeout (<5minutes) will use the increased 5 minutes in a worker. Signed-off-by: Dominik Csapak --- PVE/Storage/ZFSPoolPlugin.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm index 343f833..b1ee420 100644 --- a/PVE/Storage/ZFSPoolPlugin.pm +++ b/PVE/Storage/ZFSPoolPlugin.pm @@ -178,7 +178,12 @@ sub zfs_request { my $msg = ''; my $output = sub { $msg .= "$_[0]\n" }; - $timeout = PVE::RPCEnvironment->is_worker() ? 60*60 : 5 if !$timeout; + if (PVE::RPCEnvironment->is_worker()) { + $timeout = 60*60 if !$timeout; + $timeout = 60*5 if $timeout < 60*5; + } else { + $timeout = 5 if !$timeout; + } run_command($cmd, errmsg => "zfs error", outfunc => $output, timeout => $timeout);