mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qiliang Yuan <qiliang.yuan@linux.dev>
To: "Martin K. Petersen" <mkp@kernel.org>
Cc: Mike Christie <michael.christie@oracle.com>,
	linux-scsi@vger.kernel.org,  target-devel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	 Qiliang Yuan <qiliang.yuan@linux.dev>
Subject: [PATCH 2/2] scsi: target: alua: Drop the grace period wait from LUN detach
Date: Tue, 10 Nov 2026 08:29:34 -0500	[thread overview]
Message-ID: <20261110-bug-target-alua-lun-gp-v1-2-127a46efdae9@linux.dev> (raw)
In-Reply-To: <20261110-bug-target-alua-lun-gp-v1-0-127a46efdae9@linux.dev>

core_tpg_remove_lun() detaches a LUN from its ALUA target port group
once transport_clear_lun_ref() has drained its I/O, and
target_detach_tg_pt_gp() then waits for an RCU grace period.

Nothing that wait could protect is freed here: the group lives on until
core_alua_free_tg_pt_gp(), which waits for a grace period of its own
before freeing it, and the se_lun is freed with call_rcu(). Every LUN
removed through configfs still pays a grace period for it.

Remove the synchronize_rcu() call.

Removing 256 LUNs from an iSCSI TPG through configfs, five rounds
alternating with and without this patch, takes (median, min-max in
parentheses):

  LUNs  before (ms)       after (ms)        change
   256  5222 (5165-5244)  3551 (3436-3810)    -32%

Signed-off-by: Qiliang Yuan <qiliang.yuan@linux.dev>
---
 drivers/target/target_core_alua.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index 35d36cd36db6c..4e22f988bb83f 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -1858,7 +1858,6 @@ void target_detach_tg_pt_gp(struct se_lun *lun)
 		rcu_assign_pointer(lun->lun_tg_pt_gp, NULL);
 	}
 	spin_unlock(&lun->lun_tg_pt_gp_lock);
-	synchronize_rcu();
 }
 
 static void target_swap_tg_pt_gp(struct se_lun *lun,

-- 
2.43.0


      parent reply	other threads:[~2026-11-10 13:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 13:29 [PATCH 0/2] scsi: target: alua: Skip grace periods on LUN add and remove Qiliang Yuan
2026-11-10 13:29 ` [PATCH 1/2] scsi: target: alua: Don't wait for a grace period when attaching a LUN Qiliang Yuan
2026-11-10 13:29 ` Qiliang Yuan [this message]

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=20261110-bug-target-alua-lun-gp-v1-2-127a46efdae9@linux.dev \
    --to=qiliang.yuan@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michael.christie@oracle.com \
    --cc=mkp@kernel.org \
    --cc=target-devel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®