summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/cxlflash/superpipe.h
diff options
context:
space:
mode:
authorMatthew R. Ochs <mrochs@linux.vnet.ibm.com>2016-08-09 18:39:42 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2016-08-18 22:41:36 -0400
commit888baf069f49529f33c0b1dfb0fc4811dc0ca1d2 (patch)
tree6adddf35f84cb2a08756eeef7a0b8d6fb0ab56ed /drivers/scsi/cxlflash/superpipe.h
parent44ef38f9a2af8644c24ace6cbe1132dc70174c39 (diff)
downloadlinux-888baf069f49529f33c0b1dfb0fc4811dc0ca1d2.tar.bz2
scsi: cxlflash: Add kref to context
Currently, context user references are tracked via the list of LUNs that have attached to the context. While convenient, this is not intuitive without a deep study of the code and is inconsistent with the existing reference tracking patterns within the kernel. This design choice can lead to future bug injection. To improve code comprehension and better protect against future bugs, add explicit reference counting to contexts and migrate the context removal code to the kref release handler. 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>
Diffstat (limited to 'drivers/scsi/cxlflash/superpipe.h')
-rw-r--r--drivers/scsi/cxlflash/superpipe.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/scsi/cxlflash/superpipe.h b/drivers/scsi/cxlflash/superpipe.h
index 61404f201deb..5bda8b5758d5 100644
--- a/drivers/scsi/cxlflash/superpipe.h
+++ b/drivers/scsi/cxlflash/superpipe.h
@@ -106,6 +106,7 @@ struct ctx_info {
bool unavail;
bool err_recovery_active;
struct mutex mutex; /* Context protection */
+ struct kref kref;
struct cxl_context *ctx;
struct cxlflash_cfg *cfg;
struct list_head luns; /* LUNs attached to this context */