]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: cxlflash: Avoid mutex when destroying context
authorMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Tue, 9 Aug 2016 23:39:18 +0000 (18:39 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 19 Aug 2016 02:39:45 +0000 (22:39 -0400)
commit2957649948283ac94eb20c07bd21a79e3c08621c
tree2c2c77449ebcf8210b656c6da613db39c594e401
parente7a0de6248869dfd8036bd5b9aa781d5d944db85
scsi: cxlflash: Avoid mutex when destroying context

Context information structures are protected by a mutex that is held
when accessing/manipulating the context. When the code that manages
these structures was authored, a decision was made to include taking the
mutex as part of the allocation/initialization sequence and also handle
the scenario where the mutex was already held when freeing the context.

While not a problem outright, this design decision has been deemed as
too flexible and the code should be made more rigid to avoid future
bugs.  In addition, further review of the code yields that the existing
mutex manipulations in both of these context management paths are
superfluous.

This commit removes the obtaining of the context mutex in the context
initialization routine and assumes the mutex is not held in the context
free path.

Inspired-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Acked-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/cxlflash/superpipe.c