mpt3sas: Refcount fw_events and fix unsafe list usage
mpt3sas: Refcount fw_events and fix unsafe list usage

The fw_event_work struct is concurrently referenced at shutdown. Add a
refcount to protect it and refactor the code to use it.

Additionally, refactor _scsih_fw_event_cleanup_queue() such that it no
longer iterates over the list without holding the lock since
_firmware_event_work() concurrently deletes items from the list.

This patch is ported from commit 008549f6e8a1 ("mpt2sas: Refcount
fw_events and fix unsafe list usage"). These changes are also required
for mpt3sas.

Signed-off-by: Sreekanth Reddy <f8c6577e65f24cd0f070fd4ab3f4eacf376d5922@avagotech.com>
Acked-by: Christoph Hellwig <923f7720577207a44b32e59bbfbea59d27f1ae8e@lst.de>
Reviewed-by: Hannes Reinecke <b0d1e9e4a4e27620745ff49be9000da3174a4cc6@suse.de>
Signed-off-by: Martin K. Petersen <0384aaef27f06874adbdb09a807bb339f4aff9fd@oracle.com>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs