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

scsi: libsas: only clear phy->in_shutdown after shutdown event done

When the event queue is full of phy up and down events and reached the
threshold, we will queue a shutdown-event, and set phy->in_shutdown so that
we will not queue a shutdown-event again. But before the shutdown-event can
be executed, every phy-down event will clear
phy->in_shutdown and a new shutdown-event will be queued. The queue will
be full of these shutdown-events.

Fix this by only clear phy->in_shutdown in sas_phye_shutdown(), that is
after the first shutdown-event has been executed.

Fixes: f12486e06ae8 ("scsi: libsas: shut down the PHY if events reached the threshold")
Signed-off-by: Jason Yan <yanaijie@huawei.com>
CC: John Garry <john.garry@huawei.com>
CC: Johannes Thumshirn <jthumshirn@suse.de>
CC: Ewan Milne <emilne@redhat.com>
CC: Christoph Hellwig <hch@lst.de>
CC: Tomas Henzl <thenzl@redhat.com>
CC: Dan Williams <dan.j.williams@intel.com>
CC: Hannes Reinecke <hare@suse.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Jason Yan and committed by
Martin K. Petersen
04cf8b32 12e750bc

+1 -2
+1 -2
drivers/scsi/libsas/sas_phy.c
··· 35 35 struct asd_sas_event *ev = to_asd_sas_event(work); 36 36 struct asd_sas_phy *phy = ev->phy; 37 37 38 - phy->in_shutdown = 0; 39 38 phy->error = 0; 40 39 sas_deform_port(phy, 1); 41 40 } ··· 44 45 struct asd_sas_event *ev = to_asd_sas_event(work); 45 46 struct asd_sas_phy *phy = ev->phy; 46 47 47 - phy->in_shutdown = 0; 48 48 phy->error = 0; 49 49 } 50 50 ··· 124 126 ret); 125 127 } else 126 128 pr_notice("phy%d is not enabled, cannot shutdown\n", phy->id); 129 + phy->in_shutdown = 0; 127 130 } 128 131 129 132 /* ---------- Phy class registration ---------- */