From 888baf069f49529f33c0b1dfb0fc4811dc0ca1d2 Mon Sep 17 00:00:00 2001 From: "Matthew R. Ochs" Date: Tue, 9 Aug 2016 18:39:42 -0500 Subject: 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 Signed-off-by: Matthew R. Ochs Acked-by: Manoj N. Kumar Signed-off-by: Martin K. Petersen --- drivers/scsi/cxlflash/superpipe.h | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/scsi/cxlflash/superpipe.h') 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 */ -- cgit v1.2.3