]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
scsi: cxlflash: Cancel scheduled workers before stopping AFU
authorUma Krishnan <ukrishn@linux.vnet.ibm.com>
Fri, 7 Jul 2017 16:05:18 +0000 (13:05 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 14 Jul 2017 14:32:52 +0000 (11:32 -0300)
commitd940f9ae3e5d65fe2f0ca1a0174cc9e35ee25acc
treee96f980c96a535f786de812d15015750f2034290
parent88d33628a77a9e08c83db7d31932caa7cf399dda
scsi: cxlflash: Cancel scheduled workers before stopping AFU

BugLink: http://bugs.launchpad.net/bugs/1702521
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.

[c000000f17e03b90d000000007cd5978 cxlflash_worker_thread+0x268/0x550
[c000000f17e03c40c00000000011883c process_one_work+0x1dc/0x680
[c000000f17e03ce0c000000000118e80 worker_thread+0x1a0/0x520
[c000000f17e03d80c000000000126174 kthread+0xf4/0x100
[c000000f17e03e30c00000000000a47c ret_from_kernel_thread+0x5c/0xe0

In an effort to avoid this, a mapcount was introduced in
commit b45cdbaf9f7f ("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: b45cdbaf9f7f ("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>
(cherry picked from commit 0df5bef739601f18bffc0d256ae451f239a826bd)
Signed-off-by: Victor Aoqui <victora@linux.vnet.ibm.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/scsi/cxlflash/common.h
drivers/scsi/cxlflash/main.c