> -----Original Message----- > From: Tomas Henzl [mailto:thenzl@xxxxxxxxxx] > Sent: Monday, February 06, 2017 9:35 PM > To: Shivasharan S; linux-scsi@xxxxxxxxxxxxxxx > Cc: martin.petersen@xxxxxxxxxx; jejb@xxxxxxxxxxxxxxxxxx; > kashyap.desai@xxxxxxxxxxxx; sumit.saxena@xxxxxxxxxxxx; > hare@xxxxxxxx > Subject: Re: [PATCH 33/39] megaraid_sas: call flush_scheduled_work during > controller shutdown/detach > > On 6.2.2017 11:00, Shivasharan S wrote: > > Signed-off-by: Kashyap Desai <kashyap.desai@xxxxxxxxxxxx> > > Signed-off-by: Shivasharan S > <shivasharan.srikanteshwara@xxxxxxxxxxxx> > > --- > > drivers/scsi/megaraid/megaraid_sas_base.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c > b/drivers/scsi/megaraid/megaraid_sas_base.c > > index 04ef0a0..b29cfd3 100644 > > --- a/drivers/scsi/megaraid/megaraid_sas_base.c > > +++ b/drivers/scsi/megaraid/megaraid_sas_base.c > > @@ -6393,6 +6393,7 @@ megasas_suspend(struct pci_dev *pdev, > pm_message_t state) > > if (instance->ev != NULL) { > > struct megasas_aen_event *ev = instance->ev; > > cancel_delayed_work_sync(&ev->hotplug_work); > > + flush_scheduled_work(); > > instance->ev = NULL; > > } > > > > @@ -6619,6 +6620,7 @@ static void megasas_detach_one(struct pci_dev > *pdev) > > if (instance->ev != NULL) { > > struct megasas_aen_event *ev = instance->ev; > > cancel_delayed_work_sync(&ev->hotplug_work); > > + flush_scheduled_work(); > > instance->ev = NULL; > > } > > > > Why is cancel_delayed_work_sync not good enough? Megaraid_sas driver use certain work on global work queue. Below are the listed one - if (instance->ctrl_context) { INIT_WORK(&instance->work_init, megasas_fusion_ocr_wq); INIT_WORK(&instance->crash_init, megasas_fusion_crash_dump_wq); } else INIT_WORK(&instance->work_init, process_fw_state_change_wq) Cancel_delayed_work_sync() was mainly targeted for only hotplug AEN work. Calling flush_scheduled_work() we want above listed work to be completed as well. > > tomash