Commit 9e67600
scsi: iscsi: Fix race condition between login and sync thread
A kernel panic was observed due to a timing issue between the sync thread
and the initiator processing a login response from the target. The session
reopen can be invoked both from the session sync thread when iscsid
restarts and from iscsid through the error handler. Before the initiator
receives the response to a login, another reopen request can be sent from
the error handler/sync session. When the initial login response is
subsequently processed, the connection has been closed and the socket has
been released.
To fix this a new connection state, ISCSI_CONN_BOUND, is added:
- Set the connection state value to ISCSI_CONN_DOWN upon
iscsi_if_ep_disconnect() and iscsi_if_stop_conn()
- Set the connection state to the newly created value ISCSI_CONN_BOUND
after bind connection (transport->bind_conn())
- In iscsi_set_param(), return -ENOTCONN if the connection state is not
either ISCSI_CONN_BOUND or ISCSI_CONN_UP
Link: https://lore.kernel.org/r/20210325093248.284678-1-gulam.mohamed@oracle.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Gulam Mohamed <gulam.mohamed@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
index 91074fd..f4bf62b 1006441 parent 36fa766 commit 9e67600
2 files changed
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2471 | 2471 | | |
2472 | 2472 | | |
2473 | 2473 | | |
| 2474 | + | |
2474 | 2475 | | |
2475 | 2476 | | |
2476 | 2477 | | |
| |||
2894 | 2895 | | |
2895 | 2896 | | |
2896 | 2897 | | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
2897 | 2905 | | |
2898 | 2906 | | |
2899 | 2907 | | |
| |||
2953 | 2961 | | |
2954 | 2962 | | |
2955 | 2963 | | |
| 2964 | + | |
2956 | 2965 | | |
2957 | 2966 | | |
2958 | 2967 | | |
| |||
3713 | 3722 | | |
3714 | 3723 | | |
3715 | 3724 | | |
| 3725 | + | |
| 3726 | + | |
3716 | 3727 | | |
3717 | 3728 | | |
3718 | 3729 | | |
| |||
3944 | 3955 | | |
3945 | 3956 | | |
3946 | 3957 | | |
3947 | | - | |
| 3958 | + | |
| 3959 | + | |
3948 | 3960 | | |
3949 | 3961 | | |
3950 | 3962 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
| |||
0 commit comments