diff options
author | Matthew R. Ochs <mrochs@linux.vnet.ibm.com> | 2016-08-09 23:39:42 (GMT) |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-08-19 02:41:36 (GMT) |
commit | 888baf069f49529f33c0b1dfb0fc4811dc0ca1d2 (patch) | |
tree | 6adddf35f84cb2a08756eeef7a0b8d6fb0ab56ed /drivers/scsi/cxlflash/superpipe.h | |
parent | 44ef38f9a2af8644c24ace6cbe1132dc70174c39 (diff) | |
download | linux-888baf069f49529f33c0b1dfb0fc4811dc0ca1d2.tar.xz |
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.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/scsi/cxlflash/superpipe.h b/drivers/scsi/cxlflash/superpipe.h index 61404f2..5bda8b5 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 */ |