On Wed, 2018-01-31 at 17:48 -0200, Mauricio Faria de Oliveira wrote: > On 01/31/2018 05:06 PM, Bart Van Assche wrote: > > Sorry but I think this patch introduces new race conditions. Have you > > Can you detail the race conditions? As far as I can see, the only race > condition would be when an error handler is invoked very close in time > to the shutdown/unload handler, and as such miss the 'ioc->remove_host' > assignment (thus it continues running anyway, and hit the oops). That's indeed the race I was referring to. BTW, are you aware that your patch does not seem to apply on Martin's tree (the fixes branch of git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git): $ patch -p1 < ~/\[PATCH\]_scsi\:_mpt3sas\:_fix_oops_in_error_handlers_after_shutdown_unload.mbox patching file drivers/scsi/mpt3sas/mpt3sas_scsih.c Hunk #1 FAILED at 3007. Hunk #2 succeeded at 2970 (offset -99 lines). Hunk #3 succeeded at 2977 (offset -161 lines). Hunk #4 succeeded at 3033 (offset -160 lines). 1 out of 4 hunks FAILED -- saving rejects to file drivers/scsi/mpt3sas/mpt3sas_scsih.c.rej Can you rebase this patch on top of Martin's tree? Thanks, Bart.