Skip to content

Commit

Permalink
scsi: target: core: Use RCU helpers for INQUIRY t10_alua_tg_pt_gp
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
mikechristie authored and martinkpetersen committed Nov 19, 2021
1 parent 5ecae9f commit e2a49a9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions drivers/target/target_core_spc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit e2a49a9

Please sign in to comment.