Commit e6d8002d authored by Zhong Jinghua's avatar Zhong Jinghua Committed by Jialin Zhang
Browse files

Revert "scsi: fix iscsi rescan fails to create block"

hulk inclusion
category: bugfix
bugzilla: 188150, https://gitee.com/openeuler/kernel/issues/I643OL



----------------------------------------

This reverts commit 3b649a02.

This commit has a soft lock problem:

watchdog: BUG: soft lockup - CPU#22 stuck for 67s! [iscsid:16369]
 Call Trace:
  scsi_remove_target+0x548/0x7b0
  ? sdev_store_delete+0x90/0x90
  ? __mutex_lock_slowpath+0x10/0x10
  ? device_remove_class_symlinks+0x1b0/0x1b0
  __iscsi_unbind_session+0x16b/0x250 [scsi_transport_iscsi]
  iscsi_remove_session+0x1d3/0x2f0 [scsi_transport_iscsi]
  iscsi_session_remove+0x5c/0x80 [libiscsi]
  iscsi_sw_tcp_session_destroy+0xd3/0x160 [iscsi_tcp]
  iscsi_if_rx+0x2369/0x5060 [scsi_transport_iscsi]

The reason is that if other threads hold the reference count of the
kobject while waiting for the device to be released, it will keep
waiting in a loop.

Fixes: 3b649a02 ("scsi: fix iscsi rescan fails to create block")
Signed-off-by: default avatarZhong Jinghua <zhongjinghua@huawei.com>
Reviewed-by: default avatarHou Tao <houtao1@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parent 1c8d3dec
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -1503,13 +1503,6 @@ void scsi_remove_device(struct scsi_device *sdev)
}
EXPORT_SYMBOL(scsi_remove_device);

static int scsi_device_try_get(struct scsi_device *sdev)
{
	if (!kobject_get_unless_zero(&sdev->sdev_gendev.kobj))
		return -ENXIO;
	return 0;
}

static void __scsi_remove_target(struct scsi_target *starget)
{
	struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
@@ -1528,7 +1521,9 @@ static void __scsi_remove_target(struct scsi_target *starget)
		if (sdev->channel != starget->channel ||
		    sdev->id != starget->id)
			continue;
		if (scsi_device_try_get(sdev))
		if (sdev->sdev_state == SDEV_DEL ||
		    sdev->sdev_state == SDEV_CANCEL ||
		    !get_device(&sdev->sdev_gendev))
			continue;
		spin_unlock_irqrestore(shost->host_lock, flags);
		scsi_remove_device(sdev);