> -----Original Message----- > From: Kashyap Desai [mailto:kashyap.desai@xxxxxxxxxxxx] > Sent: Monday, February 06, 2017 10:48 PM > To: 'Tomas Henzl'; Shivasharan Srikanteshwara; 'linux-scsi@xxxxxxxxxxxxxxx' > Cc: 'martin.petersen@xxxxxxxxxx'; 'jejb@xxxxxxxxxxxxxxxxxx'; Sumit Saxena; > 'hare@xxxxxxxx' > Subject: RE: [PATCH 33/39] megaraid_sas: call flush_scheduled_work during > controller shutdown/detach > > > -----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. Tomas - Here is one more update. I agree with your assessment. We don't need this patch. In our local repo code was like below and as part of sync up activity, I did not realize that upstream is using cancel_delayed_work_sync() which is internally doing the same as below. cancel_delayed_work(&ev->hotplug_work); flush_scheduled_work(); Just for info - Similar patch was posted for mpt2sas long time ago to replace above combination with cancel_delayed_work_sync() https://lkml.org/lkml/2010/12/21/127 We will accommodate removal of this patch in V2 submission. > > > > > tomash