From 7f6ab5693f66e5a638925f28e17ea7576fc69f2f Mon Sep 17 00:00:00 2001 From: chenxiang Date: Wed, 6 Sep 2017 17:15:14 +0800 Subject: scsi: libsas: add event to defer list tail instead of head when draining Events will be added to defer_q list when setting ha->status to SAS_HA_DRAINING. Events will be called after drain workqueue. Those events are added to the head of list, but they are scanned one by one from the head to the tail, which will cause those events be called in the reverse order of being added. So change list_add to list_add_tail in function sas_queue_work. Signed-off-by: chenxiang Signed-off-by: Jason Yan CC: John Garry CC: Johannes Thumshirn CC: Ewan Milne CC: Christoph Hellwig CC: Tomas Henzl CC: Dan Williams Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen --- drivers/scsi/libsas/sas_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/scsi/libsas/sas_event.c') diff --git a/drivers/scsi/libsas/sas_event.c b/drivers/scsi/libsas/sas_event.c index 3e225ef9e0e5..0bb9eefc08c8 100644 --- a/drivers/scsi/libsas/sas_event.c +++ b/drivers/scsi/libsas/sas_event.c @@ -37,7 +37,7 @@ int sas_queue_work(struct sas_ha_struct *ha, struct sas_work *sw) if (test_bit(SAS_HA_DRAINING, &ha->state)) { /* add it to the defer list, if not already pending */ if (list_empty(&sw->drain_node)) - list_add(&sw->drain_node, &ha->defer_q); + list_add_tail(&sw->drain_node, &ha->defer_q); } else rc = scsi_queue_work(ha->core.shost, &sw->work); -- cgit