Skip to content

Commit e2a49a9

Browse files
mikechristiemartinkpetersen
authored andcommitted
scsi: target: core: Use RCU helpers for INQUIRY t10_alua_tg_pt_gp
Fix the sparse warnings about t10_alua_tg_pt_gp accesses in target_core_spc.c caused by commit 7324f47 ("scsi: target: Replace lun_tg_pt_gp_lock with rcu in I/O path") That commit replaced the lun_tg_pt_gp_lock use in the I/O path, but it didn't update the INQUIRY code. Link: https://lore.kernel.org/r/[email protected] Reported-by: kernel test robot <[email protected]> Reviewed-by: Maurizio Lombardi <[email protected]> Signed-off-by: Mike Christie <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 5ecae9f commit e2a49a9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/target/target_core_spc.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ static void spc_fill_alua_data(struct se_lun *lun, unsigned char *buf)
4040
*
4141
* See spc4r17 section 6.4.2 Table 135
4242
*/
43-
spin_lock(&lun->lun_tg_pt_gp_lock);
44-
tg_pt_gp = lun->lun_tg_pt_gp;
43+
rcu_read_lock();
44+
tg_pt_gp = rcu_dereference(lun->lun_tg_pt_gp);
4545
if (tg_pt_gp)
4646
buf[5] |= tg_pt_gp->tg_pt_gp_alua_access_type;
47-
spin_unlock(&lun->lun_tg_pt_gp_lock);
47+
rcu_read_unlock();
4848
}
4949

5050
static u16
@@ -325,14 +325,14 @@ spc_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf)
325325
* Get the PROTOCOL IDENTIFIER as defined by spc4r17
326326
* section 7.5.1 Table 362
327327
*/
328-
spin_lock(&lun->lun_tg_pt_gp_lock);
329-
tg_pt_gp = lun->lun_tg_pt_gp;
328+
rcu_read_lock();
329+
tg_pt_gp = rcu_dereference(lun->lun_tg_pt_gp);
330330
if (!tg_pt_gp) {
331-
spin_unlock(&lun->lun_tg_pt_gp_lock);
331+
rcu_read_unlock();
332332
goto check_lu_gp;
333333
}
334334
tg_pt_gp_id = tg_pt_gp->tg_pt_gp_id;
335-
spin_unlock(&lun->lun_tg_pt_gp_lock);
335+
rcu_read_unlock();
336336

337337
buf[off] = tpg->proto_id << 4;
338338
buf[off++] |= 0x1; /* CODE SET == Binary */

0 commit comments

Comments
 (0)