Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: device_handler: alua: Revert "Move a scsi_device_put() call out of alua_check_vpd()"

There is a bug in commit 0b25e17e9018 ("scsi: alua: Move a
scsi_device_put() call out of alua_check_vpd()"): that patch may cause
alua_rtpg_queue() callers to call scsi_device_put() even if that function
should not be called. Revert that commit to prepare for a different
solution.

Cc: Hannes Reinecke <hare@suse.de>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Sachin Sant <sachinp@linux.ibm.com>
Cc: Benjamin Block <bblock@linux.ibm.com>
Reported-by: Sachin Sant <sachinp@linux.ibm.com>
Reported-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20221117183626.2656196-2-bvanassche@acm.org
Tested-by: Sachin Sant <sachinp@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
a500c4cc e118df49

+8 -15
+8 -15
drivers/scsi/device_handler/scsi_dh_alua.c
··· 324 324 struct alua_port_group *pg, *old_pg = NULL; 325 325 bool pg_updated = false; 326 326 unsigned long flags; 327 - bool put_sdev; 328 327 329 328 group_id = scsi_vpd_tpg_id(sdev, &rel_port); 330 329 if (group_id < 0) { ··· 373 374 list_add_rcu(&h->node, &pg->dh_list); 374 375 spin_unlock_irqrestore(&pg->lock, flags); 375 376 376 - put_sdev = alua_rtpg_queue(rcu_dereference_protected(h->pg, 377 + alua_rtpg_queue(rcu_dereference_protected(h->pg, 377 378 lockdep_is_held(&h->pg_lock)), 378 379 sdev, NULL, true); 379 380 spin_unlock(&h->pg_lock); 380 - 381 - if (put_sdev) 382 - scsi_device_put(sdev); 383 381 384 382 if (old_pg) 385 383 kref_put(&old_pg->kref, release_port_group); ··· 978 982 * RTPG already has been scheduled. 979 983 * 980 984 * Returns true if and only if alua_rtpg_work() will be called asynchronously. 981 - * That function is responsible for calling @qdata->fn(). If this function 982 - * returns true, the caller is responsible for invoking scsi_device_put(@sdev). 985 + * That function is responsible for calling @qdata->fn(). 983 986 */ 984 - static bool __must_check alua_rtpg_queue(struct alua_port_group *pg, 987 + static bool alua_rtpg_queue(struct alua_port_group *pg, 985 988 struct scsi_device *sdev, 986 989 struct alua_queue_data *qdata, bool force) 987 990 { ··· 1019 1024 else 1020 1025 kref_put(&pg->kref, release_port_group); 1021 1026 } 1027 + if (sdev) 1028 + scsi_device_put(sdev); 1022 1029 1023 1030 return true; 1024 1031 } ··· 1127 1130 rcu_read_unlock(); 1128 1131 mutex_unlock(&h->init_mutex); 1129 1132 1130 - if (alua_rtpg_queue(pg, sdev, qdata, true)) { 1131 - scsi_device_put(sdev); 1133 + if (alua_rtpg_queue(pg, sdev, qdata, true)) 1132 1134 fn = NULL; 1133 - } else { 1135 + else 1134 1136 err = SCSI_DH_DEV_OFFLINED; 1135 - } 1136 1137 kref_put(&pg->kref, release_port_group); 1137 1138 out: 1138 1139 if (fn) ··· 1156 1161 return; 1157 1162 } 1158 1163 rcu_read_unlock(); 1159 - 1160 - if (alua_rtpg_queue(pg, sdev, NULL, force)) 1161 - scsi_device_put(sdev); 1164 + alua_rtpg_queue(pg, sdev, NULL, force); 1162 1165 kref_put(&pg->kref, release_port_group); 1163 1166 } 1164 1167