]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
mpt3sas: Refcount sas_device objects and fix unsafe list usage
authorNicholas Bellinger <nab@linux-iscsi.org>
Tue, 25 Aug 2015 23:10:42 +0000 (16:10 -0700)
committerNicholas Bellinger <nab@linux-iscsi.org>
Sun, 30 Aug 2015 07:22:40 +0000 (00:22 -0700)
commit9dab68af61d6582624add70011d6049b9f4f8599
treead001c94f6f33805e16a5f88dbb675a302d57004
parent26a1d1ceda0a93b38051f10c8e15138b3cbcc54b
mpt3sas: 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.

This patch is a port of Calvin's PATCH-v4 for mpt2sas code, atop
mpt3sas changes in scsi.git/for-next.

Cc: Calvin Owens <calvinowens@fb.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Sreekanth Reddy <sreekanth.reddy@avagotech.com>
Cc: MPT-FusionLinux.pdl <MPT-FusionLinux.pdl@avagotech.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/scsi/mpt3sas/mpt3sas_base.h
drivers/scsi/mpt3sas/mpt3sas_scsih.c
drivers/scsi/mpt3sas/mpt3sas_transport.c