aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/libsas.h
diff options
context:
space:
mode:
authorJason Yan <yanaijie@huawei.com>2017-12-08 04:42:04 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2018-01-08 21:59:28 -0500
commit1c393b970e0f4070e4376d45f89a2d19a5c895d0 (patch)
tree41706d1df454c4d020a6beaf335b30c27f5f4e20 /include/scsi/libsas.h
parent6f5c592ce936b2a2f5d05d3112b550bb039050f2 (diff)
scsi: libsas: Use dynamic alloced work to avoid sas event lost
Now libsas hotplug work is static, every sas event type has its own static work, LLDD driver queues the hotplug work into shost->work_q. If LLDD driver burst posts lots hotplug events to libsas, the hotplug events may pending in the workqueue like shost->work_q new work[PORTE_BYTES_DMAED] --> |[PHYE_LOSS_OF_SIGNAL][PORTE_BYTES_DMAED] -> processing |<-------wait worker to process-------->| In this case, a new PORTE_BYTES_DMAED event coming, libsas try to queue it to shost->work_q, but this work is already pending, so it would be lost. Finally, libsas delete the related sas port and sas devices, but LLDD driver expect libsas add the sas port and devices(last sas event). This patch use dynamic allocated work to avoid this issue. Signed-off-by: Yijing Wang <wangyijing@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> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Jason Yan <yanaijie@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'include/scsi/libsas.h')
-rw-r--r--include/scsi/libsas.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 0f9cbf96c093..ee1b25299dd6 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -292,6 +292,7 @@ struct asd_sas_port {
292struct asd_sas_event { 292struct asd_sas_event {
293 struct sas_work work; 293 struct sas_work work;
294 struct asd_sas_phy *phy; 294 struct asd_sas_phy *phy;
295 int event;
295}; 296};
296 297
297static inline struct asd_sas_event *to_asd_sas_event(struct work_struct *work) 298static inline struct asd_sas_event *to_asd_sas_event(struct work_struct *work)
@@ -301,17 +302,21 @@ static inline struct asd_sas_event *to_asd_sas_event(struct work_struct *work)
301 return ev; 302 return ev;
302} 303}
303 304
305static inline void INIT_SAS_EVENT(struct asd_sas_event *ev,
306 void (*fn)(struct work_struct *),
307 struct asd_sas_phy *phy, int event)
308{
309 INIT_SAS_WORK(&ev->work, fn);
310 ev->phy = phy;
311 ev->event = event;
312}
313
314
304/* The phy pretty much is controlled by the LLDD. 315/* The phy pretty much is controlled by the LLDD.
305 * The class only reads those fields. 316 * The class only reads those fields.
306 */ 317 */
307struct asd_sas_phy { 318struct asd_sas_phy {
308/* private: */ 319/* private: */
309 struct asd_sas_event port_events[PORT_NUM_EVENTS];
310 struct asd_sas_event phy_events[PHY_NUM_EVENTS];
311
312 unsigned long port_events_pending;
313 unsigned long phy_events_pending;
314
315 int error; 320 int error;
316 int suspended; 321 int suspended;
317 322