[PATCH 1/2] scsi: target: alua: Don't wait for a grace period when attaching a LUN

From: Qiliang Yuan

Date: Tue Nov 10 2026 - 09:34:14 EST


core_tpg_add_lun() attaches a new LUN to the default ALUA target port
group before adding it to the device and TPG lists, and
target_attach_tg_pt_gp() then waits for an RCU grace period.

The wait protects nothing: lun->lun_tg_pt_gp goes from NULL to a live
group, nothing is freed, and no reader can reach the LUN yet. It still
costs a grace period for every LUN created through configfs, which
dominates the time spent exporting many LUNs.

Remove the synchronize_rcu() call. Group changes through
core_alua_store_tg_pt_gp_info() keep their own grace period.

Adding 256 LUNs to 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 3144 (3104-3175) 1379 (1277-1393) -56%

Signed-off-by: Qiliang Yuan <qiliang.yuan@xxxxxxxxx>
---
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 140154d93c430..35d36cd36db6c 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -1833,7 +1833,6 @@ void target_attach_tg_pt_gp(struct se_lun *lun,
spin_lock(&lun->lun_tg_pt_gp_lock);
__target_attach_tg_pt_gp(lun, tg_pt_gp);
spin_unlock(&lun->lun_tg_pt_gp_lock);
- synchronize_rcu();
}

static void __target_detach_tg_pt_gp(struct se_lun *lun,

--
2.43.0