Tyrel Datwyler 665e0224a3 scsi: ibmvscsi: Fix potential race after loss of transport
After a loss of transport due to an adapter migration or crash/disconnect
from the host partner there is a tiny window where we can race adjusting
the request_limit of the adapter. The request limit is atomically
increased/decreased to track the number of inflight requests against the
allowed limit of our VIOS partner.

After a transport loss we set the request_limit to zero to reflect this
state.  However, there is a window where the adapter may attempt to queue a
command because the transport loss event hasn't been fully processed yet
and request_limit is still greater than zero.  The hypercall to send the
event will fail and the error path will increment the request_limit as a
result.  If the adapter processes the transport event prior to this
increment the request_limit becomes out of sync with the adapter state and
can result in SCSI commands being submitted on the now reset connection
prior to an SRP Login resulting in a protocol violation.

Fix this race by protecting request_limit with the host lock when changing
the value via atomic_set() to indicate no transport.

Link: https://lore.kernel.org/r/20201025001355.4527-1-tyreld@linux.ibm.com
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-10-26 17:14:40 -04:00
..
2020-10-14 15:15:35 -07:00
2020-10-14 15:15:35 -07:00
2020-10-14 15:15:35 -07:00
2020-10-23 16:19:02 -07:00
2020-10-14 15:15:35 -07:00
2020-10-14 15:15:35 -07:00
2020-10-23 16:19:02 -07:00
2020-10-14 15:15:35 -07:00
2020-10-14 15:15:35 -07:00
2020-10-14 15:15:35 -07:00
2020-10-16 12:21:15 -07:00
2020-03-11 23:07:59 -04:00
2020-10-14 15:15:35 -07:00
2020-10-23 16:19:02 -07:00
2020-10-14 15:15:35 -07:00
2020-10-23 16:19:02 -07:00
2020-10-14 15:15:35 -07:00
2020-10-14 15:15:35 -07:00
2020-10-14 15:15:35 -07:00
2020-10-14 15:15:35 -07:00
2020-10-14 15:15:35 -07:00
2020-10-23 16:19:02 -07:00
2020-10-14 15:15:35 -07:00
2020-10-23 16:19:02 -07:00
2020-10-14 15:15:35 -07:00
2019-03-02 11:39:54 -08:00
2020-10-23 16:19:02 -07:00
2019-11-12 22:21:35 -05:00
2020-02-24 14:54:25 -05:00
2020-03-11 23:07:59 -04:00
2020-10-07 21:48:28 -04:00
2019-01-08 21:58:35 -05:00
2020-09-02 22:49:06 -04:00
2020-10-14 15:15:35 -07:00
2020-09-02 22:49:06 -04:00
2020-08-23 17:36:59 -05:00
2020-08-06 16:50:07 -07:00
2018-11-06 21:31:28 -05:00
2020-10-13 12:12:44 -07:00
2020-07-24 22:09:55 -04:00
2020-10-14 15:15:35 -07:00
2020-10-23 16:19:02 -07:00
2020-09-15 21:31:27 -04:00
2020-09-15 17:34:18 -04:00
2020-08-23 17:36:59 -05:00
2020-10-14 15:15:35 -07:00
2020-10-14 15:15:35 -07:00
2020-10-14 15:15:35 -07:00
2020-10-24 12:46:42 -07:00
2020-08-06 16:50:07 -07:00
2020-06-19 23:06:43 -04:00
2020-10-23 16:19:02 -07:00
2020-10-14 15:15:35 -07:00
2019-07-11 15:14:01 -07:00
2020-10-23 16:19:02 -07:00
2020-02-24 15:01:57 -05:00
2020-08-23 17:36:59 -05:00
2020-10-14 15:15:35 -07:00
2019-07-11 15:14:01 -07:00