]> www.infradead.org Git - users/jedix/linux-maple.git/commit
libfc: Update rport reference counting
authorHannes Reinecke <hare@suse.de>
Tue, 24 May 2016 06:11:58 +0000 (08:11 +0200)
committerBrian Maly <brian.maly@oracle.com>
Mon, 21 May 2018 21:57:14 +0000 (17:57 -0400)
commitedbb04f1a2d9dedd490870d9ad2f95fd92caea31
treebac0213b3de9b5187b8f87733ae93459e739c8e7
parentc38335ba6e967c984b79dbacee995fa89d3e8fe9
libfc: Update rport reference counting

Originally libfc would just be initializing the refcount to '1', and
using the disc_mutex to synchronize if and when the final put should be
happening.  This has a race condition as the mutex might be delayed,
causing other threads to access an invalid structure.  This patch
updates the rport reference counting to increase the reference every
time 'rport_lookup' is called, and decreases the reference
correspondingly.  This removes the need to hold 'disc_mutex' when
removing the structure, and avoids the above race condition.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Vasu Dev <vasu.dev@intel.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
OraBug: 27363267
(cherry picked from commit baa6719f902af9c03e528b08dfb847de295b5137)
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Fred Herard <fred.herard@oracle.com>
Signed-off-by: Rajan Shanmugavelu <rajan.shanmugavelu@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/scsi/fcoe/fcoe_ctlr.c
drivers/scsi/libfc/fc_lport.c
drivers/scsi/libfc/fc_rport.c