public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Max R. Carrara" <m.carrara@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-storage 1/9] luncmd: lio: fix various errors by removing caching mechanism
Date: Thu, 25 Jun 2026 18:40:53 +0200	[thread overview]
Message-ID: <20260625164110.706694-2-m.carrara@proxmox.com> (raw)
In-Reply-To: <20260625164110.706694-1-m.carrara@proxmox.com>

When put under stress (such as our testing suite), any ZFS-over-iSCSI
storage using the LIO iSCSI provider will sooner or later end up
having dangling disk images. This is due to the cached remote config
not being updated correctly on LUN creation / deletion.

This also sometimes causes a given storage to report that a virtual
disk already exists when trying to create one, even though it was
previously deleted. Only after ~15 seconds will the cache be
refreshed and creating the disk succeeds.

Note that it is unlikely that anyone will run into these things during
"casual" operation.

Instead of trying hard to get cache invalidation right, remove the
config caching mechanism altogether.

My reasoning behind this is that the average user will most likely not
be bombarding their iSCSI storage with tons of new LUNs / virtual
disks all too frequently -- and even if that is the case, they can
probably afford the bandwidth plus CPU cycles used to transfer and
parse a single JSON file a couple times.

This fixes the plugin from causing things to end up in an inconsistent
state when put under stress.

Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
---
 src/PVE/Storage/LunCmd/LIO.pm | 48 +++--------------------------------
 1 file changed, 3 insertions(+), 45 deletions(-)

diff --git a/src/PVE/Storage/LunCmd/LIO.pm b/src/PVE/Storage/LunCmd/LIO.pm
index 5a53c14d..8e03652c 100644
--- a/src/PVE/Storage/LunCmd/LIO.pm
+++ b/src/PVE/Storage/LunCmd/LIO.pm
@@ -35,8 +35,6 @@ my @CONFIG_FILES = (
 my $BACKSTORE = '/backstores/block';
 
 my $SETTINGS = undef;
-my $SETTINGS_TIMESTAMP = 0;
-my $SETTINGS_MAXAGE = 15; # in seconds
 
 my @ssh_opts = ('-o', 'BatchMode=yes');
 my @ssh_cmd = ('/usr/bin/ssh', @ssh_opts);
@@ -196,36 +194,6 @@ my $get_backstore_prefix = sub {
     return $pool . '-';
 };
 
-# removes the given lu_name from the local list of luns
-my $free_lu_name = sub {
-    my ($scfg, $lu_name) = @_;
-
-    my $new = [];
-    my $target = $get_target_settings->($scfg);
-    foreach my $lun (@{ $target->{luns} }) {
-        if ($lun->{storage_object} ne "$BACKSTORE/$lu_name") {
-            push @$new, $lun;
-        }
-    }
-
-    $target->{luns} = $new;
-};
-
-# locally registers a new lun
-my $register_lun = sub {
-    my ($scfg, $idx, $volname) = @_;
-
-    my $conf = {
-        index => $idx,
-        storage_object => "$BACKSTORE/$volname",
-        is_new => 1,
-    };
-    my $target = $get_target_settings->($scfg);
-    push @{ $target->{luns} }, $conf;
-
-    return $conf;
-};
-
 # extracts the ZFS volume name from a device path
 my $extract_volname = sub {
     my ($scfg, $lunpath) = @_;
@@ -327,8 +295,6 @@ my $create_lun = sub {
         die "unable to determine new LUN index: $res->{msg}";
     }
 
-    $register_lun->($scfg, $lun_idx, $volname);
-
     # step 3: unfortunately, targetcli doesn't always save changes, no matter
     #         if auto_save_on_exit is true or not. So saving to be safe ...
     $execute_remote_command->($scfg, $timeout, $targetcli, 'saveconfig');
@@ -366,9 +332,6 @@ my $delete_lun = sub {
         # step 3: save to be safe ...
         $execute_remote_command->($scfg, $timeout, $targetcli, 'saveconfig');
 
-        # update internal cache
-        $free_lu_name->($scfg, $volname);
-
         last;
     }
 
@@ -407,15 +370,10 @@ my %lun_cmd_map = (
 sub run_lun_command {
     my ($scfg, $timeout, $method, @params) = @_;
 
-    # fetch configuration from target if we haven't yet or if it is stale
-    my $timediff = time - $SETTINGS_TIMESTAMP;
-    my $target = $get_target_settings->($scfg);
-    if (!$target || $timediff > $SETTINGS_MAXAGE) {
-        $SETTINGS_TIMESTAMP = time;
-        $parser->($scfg);
-    }
-
     die "unknown command '$method'" unless exists $lun_cmd_map{$method};
+
+    $parser->($scfg);
+
     my $msg = $lun_cmd_map{$method}->($scfg, $timeout, $method, @params);
 
     return $msg;
-- 
2.47.3





  reply	other threads:[~2026-06-25 16:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25 16:40 [PATCH storage 0/9] Fix ZFS-over-iSCSI plugin w/ LIO Provider Issues Max R. Carrara
2026-06-25 16:40 ` Max R. Carrara [this message]
2026-06-25 16:40 ` [PATCH pve-storage 2/9] luncmd: lio: fix LUN ops failing when passing nonstandard LUN path Max R. Carrara
2026-06-25 16:40 ` [PATCH pve-storage 3/9] luncmd: lio: remove rest of old parsing logic Max R. Carrara
2026-06-25 16:40 ` [PATCH pve-storage 4/9] luncmd: lio: modernize helpers Max R. Carrara
2026-06-25 16:40 ` [PATCH pve-storage 5/9] luncmd: lio: modernize & clean up `list_view()` and `list_lun()` subs Max R. Carrara
2026-06-25 16:40 ` [PATCH pve-storage 6/9] luncmd: lio: modernize sub `create_lun()` Max R. Carrara
2026-06-25 16:40 ` [PATCH pve-storage 7/9] luncmd: lio: modernize sub `delete_lun()` Max R. Carrara
2026-06-25 16:41 ` [PATCH pve-storage 8/9] luncmd: lio: modernize remaining LUN command subroutines Max R. Carrara
2026-06-25 16:41 ` [PATCH pve-storage 9/9] luncmd: lio: use v5.36 and use subroutine signatures Max R. Carrara

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=20260625164110.706694-2-m.carrara@proxmox.com \
    --to=m.carrara@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal