]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mpt2sas: Refcount sas_device objects and fix unsafe list usage
authorCalvin Owens <calvinowens@fb.com>
Fri, 14 Aug 2015 01:48:09 +0000 (18:48 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 20 Oct 2015 19:23:41 +0000 (15:23 -0400)
commitfa87fd4acead56a5ced176ee4ca04fb094643851
treeb0ba7039e1aee33a26dd9d7c4741e2bf9b5d7b7c
parentf75aac28e6c44f6a443b58f855bb577d0418de11
mpt2sas: Refcount sas_device objects and fix unsafe list usage

These objects can be referenced concurrently throughout the driver, we
need a way to make sure threads can't delete them out from under each
other. This patch adds the refcount, and refactors the code to use it.

Additionally, we cannot iterate over the sas_device_list without
holding the lock, or we risk corrupting random memory if items are
added or deleted as we iterate. This patch refactors _scsih_probe_sas()
to use the sas_device_list in a safe way.

Signed-off-by: Calvin Owens <calvinowens@fb.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Nicholas Bellinger <nab@linux-iscsi.org>
Tested-by: Chaitra Basappa <chaitra.basappa@avagotech.com>
Acked-by: Sreekanth Reddy <sreekanth.reddy@avagotech.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit d224fe0d609734888af63656ddaf3a8352f0a7b5)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt2sas/mpt2sas_base.h
drivers/scsi/mpt2sas/mpt2sas_scsih.c
drivers/scsi/mpt2sas/mpt2sas_transport.c