]> 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)
commitab98a57903f0c85a20270962612323cb79822e69
tree82bde2112932a5ebe73cf0498e3c4a4083e5a397
parenta7cf2b2ad1b111c267fd25be9d9f7aca7b6fffd2
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