]> git.baikalelectronics.ru Git - kernel.git/commit
nvme_fcloop: refactor host/target io job access
authorJames Smart <jsmart2021@gmail.com>
Thu, 30 Nov 2017 00:47:33 +0000 (16:47 -0800)
committerChristoph Hellwig <hch@lst.de>
Mon, 8 Jan 2018 10:01:55 +0000 (11:01 +0100)
commit864fec4d4189d2269495471d2c675a8da0685411
tree82bde2112932a5ebe73cf0498e3c4a4083e5a397
parent8320c8c58ba9630fb98bb1d4690d0a7a99e14f79
nvme_fcloop: refactor host/target io job access

The split between what the host accesses on its flows vs what the
target side accesses was flawed. Abort handling didn't properly
clear initiator vs target structure cross-reference and locks
weren't used for synchronization. Thus, there were issues of
freeing structures too soon and access after free.

A couple of these existed pre the IN_ISR mods, but when the
target upcalls were converted to work items, thus adding delays
between the 2 sides of accesses, the problems became pronounced.

Resolve by:
- tracking io state mainly in the tgt-side io structure.
- make the tgt-side io structure released by reference not by
  code flow.
- when changing initiator structures, use locks for
  synchronization
- aborts are clearly tracked for which side saw the abort, and
  after seeing the abort, cross-references are cleared under lock.

Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/fcloop.c