target: Use RCU helpers for INQUIRY t10_alua_tg_pt_gp use
Subsystems (2)
PATCH 1/1 target: Use RCU helpers for INQUIRY t10_alua_tg_pt_gp use
This fixes the sparse warnings about t10_alua_tg_pt_gp accesses in target_core_spc.c from:
commit 7324f47d4293 ("scsi: target: Replace lun_tg_pt_gp_lock with rcu in I/O path")
That patch replaced the lun_tg_pt_gp_lock use in the IO path, but didn't update the INQUIRY code.
--- drivers/target/target_core_spc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/target/target_core_spc.c +7 -7
@@ -40,11 +40,11 @@ static void spc_fill_alua_data(struct se_lun *lun, unsigned char *buf)* * See spc4r17 section 6.4.2 Table 135 */ -spin_lock (&lun->lun_tg_pt_gp_lock); - tg_pt_gp = lun->lun_tg_pt_gp; +rcu_read_lock (); + tg_pt_gp =rcu_dereference (lun->lun_tg_pt_gp);if (tg_pt_gp) buf[5 ] |= tg_pt_gp->tg_pt_gp_alua_access_type; -spin_unlock (&lun->lun_tg_pt_gp_lock); +rcu_read_unlock (); } static u16
@@ -325,14 +325,14 @@ spc_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf)* Get the PROTOCOL IDENTIFIER as defined by spc4r17 * section 7.5.1 Table 362 */ -spin_lock (&lun->lun_tg_pt_gp_lock); - tg_pt_gp = lun->lun_tg_pt_gp; +rcu_read_lock (); + tg_pt_gp =rcu_dereference (lun->lun_tg_pt_gp);if (!tg_pt_gp) { -spin_unlock (&lun->lun_tg_pt_gp_lock); +rcu_read_unlock (); goto check_lu_gp; } tg_pt_gp_id = tg_pt_gp->tg_pt_gp_id; -spin_unlock (&lun->lun_tg_pt_gp_lock); +rcu_read_unlock (); buf[off] = tpg->proto_id <<4 ; buf[off++] |=0x1 ;/* CODE SET == Binary */
Signature · 1 line
2.25.1
Quoted 56 lines · Mike Christie
This fixes the sparse warnings about
t10_alua_tg_pt_gpaccesses intarget_core_spc.cfrom:commit
7324f47d4293("scsi: target: Replacelun_tg_pt_gp_lockwith rcu in I/O path")That patch replaced the
lun_tg_pt_gp_lockuse in the IO path, but didn't update the INQUIRY code.Reported-by kernel test robot <[email protected]>Signed-off-by Mike Christie <[email protected]>--- drivers/target/target_core_spc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)drivers/target/target_core_spc.c +7
-7@@ -40,11 +40,11 @@ static void spc_fill_alua_data(struct se_lun *lun, unsigned char *buf)* * See spc4r17 section 6.4.2 Table 135 */ -spin_lock (&lun->lun_tg_pt_gp_lock); - tg_pt_gp = lun->lun_tg_pt_gp; +rcu_read_lock (); + tg_pt_gp =rcu_dereference (lun->lun_tg_pt_gp);if (tg_pt_gp) buf[5 ] |= tg_pt_gp->tg_pt_gp_alua_access_type; -spin_unlock (&lun->lun_tg_pt_gp_lock); +rcu_read_unlock (); } static u16@@ -325,14 +325,14 @@ spc_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf)* Get the PROTOCOL IDENTIFIER as defined by spc4r17 * section 7.5.1 Table 362 */ -spin_lock (&lun->lun_tg_pt_gp_lock); - tg_pt_gp = lun->lun_tg_pt_gp; +rcu_read_lock (); + tg_pt_gp =rcu_dereference (lun->lun_tg_pt_gp);if (!tg_pt_gp) { -spin_unlock (&lun->lun_tg_pt_gp_lock); +rcu_read_unlock (); goto check_lu_gp; } tg_pt_gp_id = tg_pt_gp->tg_pt_gp_id; -spin_unlock (&lun->lun_tg_pt_gp_lock); +rcu_read_unlock (); buf[off] = tpg->proto_id <<4 ; buf[off++] |=0x1 ;/* CODE SET == Binary */ Signature · 1 line
2.25.1
Looks ok,
Martin K. Petersen
AppliedQuoted 10 lines · Mike Christie
This fixes the sparse warnings about
t10_alua_tg_pt_gpaccesses intarget_core_spc.cfrom:commit
7324f47d4293("scsi: target: Replacelun_tg_pt_gp_lockwith rcu in I/O path")That patch replaced the
lun_tg_pt_gp_lockuse in the IO path, but didn't update the INQUIRY code.[...]
Applied to 5.16/scsi-fixes, thanks!
[1/1] target: Use RCU helpers for INQUIRY t10_alua_tg_pt_gp use
https://git.kernel.org/mkp/scsi/c/e2a49a95b571
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering