[PATCH] Increase SMB/CIFS file attribute cache time

Matt Corallo lpxdfsfs at mattcorallo.com
Tue Aug 16 05:16:16 CEST 2022


For those using SMB for long-distance remote backups, the default
cache setting of 1 second for file attributes causes the GUI
"backup" tabs to time-out long before they finishing loading.

Because Proxmox isn't likely to be accessing SMB shares with file
attributes changing at high rates where the changes need to be
visible immediately, simply bumping the attribute cache time is a
safe, simple change.

e.g. for my remote-backup site (~70ms away), loading a backup list
with only 200 files in the `dump` directory does not work at all
with the default cache time, with 60 seconds it loads just fine.

Signed-off-by: Matt Corallo <git at bluematt.me>
---
  PVE/Storage/CIFSPlugin.pm | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/Storage/CIFSPlugin.pm b/PVE/Storage/CIFSPlugin.pm
index 982040a..dcc53e0 100644
--- a/PVE/Storage/CIFSPlugin.pm
+++ b/PVE/Storage/CIFSPlugin.pm
@@ -69,7 +69,7 @@ sub cifs_mount {
      $server = "[$server]" if Net::IP::ip_is_ipv6($server);
      my $source = "//${server}/$share";

-    my $cmd = ['/bin/mount', '-t', 'cifs', $source, $mountpoint, '-o', 'soft', '-o'];
+    my $cmd = ['/bin/mount', '-t', 'cifs', $source, $mountpoint, '-o', 'soft', '-o', 'actimeo=60', '-o'];

      if (my $cred_file = get_cred_file($storeid)) {
  	push @$cmd, "username=$user", '-o', "credentials=$cred_file";
-- 
2.35.1




More information about the pve-devel mailing list