[PATCH pve-storage] tree-wide: change /var/lock to /run/lock

Jing Luo jing at jing.rocks
Sat Mar 22 16:17:18 CET 2025


Let's use /run/lock for lock files. Also, pve-iscsi-rescan.lock doesn't
seem to be used by any other package. "/var/lock" is deprecated.

Signed-off-by: Jing Luo <jing at jing.rocks>
---
 src/PVE/Storage/ISCSIPlugin.pm | 2 +-
 src/PVE/Storage/Plugin.pm      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Storage/ISCSIPlugin.pm b/src/PVE/Storage/ISCSIPlugin.pm
index eb70453..49114a8 100644
--- a/src/PVE/Storage/ISCSIPlugin.pm
+++ b/src/PVE/Storage/ISCSIPlugin.pm
@@ -159,7 +159,7 @@ sub iscsi_logout {
     run_command([$ISCSIADM, '--mode', 'node', '--targetname', $target, '--logout']);
 }
 
-my $rescan_filename = "/var/run/pve-iscsi-rescan.lock";
+my $rescan_filename = "/run/lock/pve-iscsi-rescan.lock";
 
 sub iscsi_session_rescan {
     my $session_list = shift;
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 65cf43f..0c8f7d0 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -617,7 +617,7 @@ sub cluster_lock_storage {
     my $res;
     if (!$shared) {
 	my $lockid = "pve-storage-$storeid";
-	my $lockdir = "/var/lock/pve-manager";
+	my $lockdir = "/run/lock/pve-manager";
 	mkdir $lockdir;
 	$res = PVE::Tools::lock_file("$lockdir/$lockid", $timeout, $func, @param);
 	die $@ if $@;
-- 
2.49.0





More information about the pve-devel mailing list