From: Hugo via pve-devel <pve-devel@lists.proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Hugo <hugo@pml.blue>
Subject: [pve-devel] [PATCH] fix #4499: prevent superblock read errors for containers on CIFS storage
Date: Fri, 21 Mar 2025 11:52:09 +0100 [thread overview]
Message-ID: <mailman.42.1742554361.359.pve-devel@lists.proxmox.com> (raw)
[-- Attachment #1: Type: message/rfc822, Size: 5329 bytes --]
From: Hugo <hugo@pml.blue>
To: pve-devel@lists.proxmox.com
Subject: [PATCH] fix #4499: prevent superblock read errors for containers on CIFS storage
Date: Fri, 21 Mar 2025 11:52:09 +0100
Message-ID: <20250321105209.626382-1-hugo@pml.blue>
Signed-off-by: Hugo <hugo@pml.blue>
---
src/PVE/Storage/CIFSPlugin.pm | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/src/PVE/Storage/CIFSPlugin.pm b/src/PVE/Storage/CIFSPlugin.pm
index 475065a..9a8a02c 100644
--- a/src/PVE/Storage/CIFSPlugin.pm
+++ b/src/PVE/Storage/CIFSPlugin.pm
@@ -78,13 +78,17 @@ sub cifs_mount : prototype($$$$$) {
my $cmd = ['/bin/mount', '-t', 'cifs', $source, $mountpoint, '-o', 'soft', '-o'];
if (my $cred_file = get_cred_file($storeid)) {
- push @$cmd, "username=$user", '-o', "credentials=$cred_file";
- push @$cmd, '-o', "domain=$domain" if defined($domain);
+ push @$cmd, "username=$user", '-o', "credentials=$cred_file";
+ push @$cmd, '-o', "domain=$domain" if defined($domain);
} else {
- push @$cmd, 'guest,username=guest';
+ push @$cmd, 'guest,username=guest';
}
- push @$cmd, '-o', defined($smbver) ? "vers=$smbver" : "vers=default";
+ push @$cmd, '-o', defined($smbver) ? "vers=$smbver" : "vers=3.0";
+
+ # Fix inode issue
+ push @$cmd, '-o', 'noserverino,cache=none,actimeo=0';
+
push @$cmd, '-o', $options if $options;
run_command($cmd, errmsg => "mount error");
@@ -248,13 +252,27 @@ sub deactivate_storage {
my ($class, $storeid, $scfg, $cache) = @_;
$cache->{mountdata} = PVE::ProcFSTools::parse_proc_mounts()
- if !$cache->{mountdata};
+ if !$cache->{mountdata};
my $path = $scfg->{path};
if (cifs_is_mounted($scfg, $cache->{mountdata})) {
- my $cmd = ['/bin/umount', $path];
- run_command($cmd, errmsg => 'umount error');
+ system('/bin/sync');
+
+ my $output = `lsof +D $path 2>/dev/null`;
+ if ($output) {
+ warn "Warning: Processes still using CIFS mount at $path. Trying lazy unmount...\n";
+ system('/bin/umount', '-l', $path);
+ } else {
+ system('/bin/umount', $path);
+ }
+
+
+ sleep 1; # Give time for unmount
+ if (cifs_is_mounted($scfg, PVE::ProcFSTools::parse_proc_mounts())) {
+ warn "Unmount failed, forcing unmount...\n";
+ system('/bin/umount', '-f', $path);
+ }
}
}
--
2.48.1
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
reply other threads:[~2025-03-21 10:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mailman.42.1742554361.359.pve-devel@lists.proxmox.com \
--to=pve-devel@lists.proxmox.com \
--cc=hugo@pml.blue \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal