On Wed, 3 Aug 2016, 1:13pm -0000, Hannes Reinecke wrote: > The kref handling in fc_rport is a mess. This patch updates > the kref handling according to the following rules: > > - Take a reference whenever scheduling a workqueue > - Take a reference whenever an ELS command is send > - Drop the reference at the end of the workqueue function > - Drop the reference at the end of handling ELS replies > - Take a reference when allocating an rport > - Drop the reference when removing an rport > > Signed-off-by: Hannes Reinecke <hare@xxxxxxxx> > --- > drivers/scsi/libfc/fc_rport.c | 134 ++++++++++++++++++++++++++++++++---------- > 1 file changed, 103 insertions(+), 31 deletions(-) > > diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c > index 93f5961..6a98bb8 100644 > --- a/drivers/scsi/libfc/fc_rport.c > +++ b/drivers/scsi/libfc/fc_rport.c > @@ -44,6 +44,17 @@ > * path this potential over-use of the mutex is acceptable. > */ > <-- snip --> Yes, this took quite a few iterations to get right but your rules make sense. I've tested with this patch and it successfully passed. Tested-by: Chad Dupuis <chad.dupuis@xxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html