alistair23-linux/drivers/scsi/cxlflash
Uma Krishnan 0df5bef739 scsi: cxlflash: Cancel scheduled workers before stopping AFU
When processing an AFU asynchronous interrupt, if the action results in an
operation that requires off level processing (a link reset for example),
the worker thread is scheduled. In the meantime a reset event (i.e.: EEH)
could unmap the AFU to recover. This results in an Oops when the worker
thread tries to access the AFU mapping.

[c000000f17e03b90] d000000007cd5978 cxlflash_worker_thread+0x268/0x550
[c000000f17e03c40] c00000000011883c process_one_work+0x1dc/0x680
[c000000f17e03ce0] c000000000118e80 worker_thread+0x1a0/0x520
[c000000f17e03d80] c000000000126174 kthread+0xf4/0x100
[c000000f17e03e30] c00000000000a47c ret_from_kernel_thread+0x5c/0xe0

In an effort to avoid this, a mapcount was introduced in
commit b45cdbaf9f ("cxlflash: Resolve oops in wait_port_offline")
but due to the race condition described above, this solution is incomplete.

In order to fully resolve this problem and to simplify things, this commit
removes the mapcount solution. Instead, the scheduled worker thread is
cancelled after interrupts have been disabled and prior to the mapping
being freed.

Fixes: b45cdbaf9f ("cxlflash: Resolve oops in wait_port_offline")
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-11 22:38:15 -05:00
..
common.h scsi: cxlflash: Cancel scheduled workers before stopping AFU 2017-01-11 22:38:15 -05:00
Kconfig cxlflash: Base error recovery support 2015-08-26 18:03:47 -07:00
lunmgt.c scsi: cxlflash: Cleanup prints 2017-01-11 22:38:15 -05:00
main.c scsi: cxlflash: Cancel scheduled workers before stopping AFU 2017-01-11 22:38:15 -05:00
main.h powerpc updates for 4.8 # 1 2016-07-30 21:01:36 -07:00
Makefile cxlflash: Virtual LUN support 2015-08-26 18:05:39 -07:00
sislite.h scsi: cxlflash: Support SQ Command Mode 2017-01-11 22:38:15 -05:00
superpipe.c scsi: cxlflash: Cleanup prints 2017-01-11 22:38:15 -05:00
superpipe.h scsi: cxlflash: Remove adapter file descriptor cache 2016-08-23 22:23:52 -04:00
vlun.c scsi: cxlflash: Cleanup prints 2017-01-11 22:38:15 -05:00
vlun.h cxlflash: Virtual LUN support 2015-08-26 18:05:39 -07:00