]> git.baikalelectronics.ru Git - kernel.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)
committerJames Bottomley <JBottomley@Odin.com>
Sun, 6 Sep 2015 17:55:18 +0000 (10:55 -0700)
commit84eb86277326624c2ec0f9213db68f8eb5bda951
tree87f0a4e6a88624e464d70def6f7475be9b441691
parent8a9cbfb99cc02f2eeb933c6d13eb7216ec63b3e9
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>
drivers/scsi/mpt2sas/mpt2sas_base.h
drivers/scsi/mpt2sas/mpt2sas_scsih.c
drivers/scsi/mpt2sas/mpt2sas_transport.c