Repository navigation
Commit 67b3c8d
committed
RDMA/cm: Make sure the cm_id is in the IB_CM_IDLE state in destroy
The first switch statement in cm_destroy_id() tries to move the ID to
either IB_CM_IDLE or IB_CM_TIMEWAIT. Both states will block concurrent
MAD handlers from progressing.
Previous patches removed the unreliably lock/unlock sequences in this
flow, this patch removes the extra locking steps and adds the missing
parts to guarantee that destroy reaches IB_CM_IDLE. There is no point in
leaving the ID in the IB_CM_TIMEWAIT state the memory about to be kfreed.
Rework things to hold the lock across all the state transitions and
directly assert when done that it ended up in IB_CM_IDLE as expected.
This was accompanied by a careful audit of all the state transitions here,
which generally did end up in IDLE on their success and non-racy paths.
Link: https://lore.kernel.org/r/20200310092545.251365-16-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>1 parent 6a8824a commit 67b3c8d
1 file changed
Lines changed: 21 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1026 | 1026 | | |
1027 | 1027 | | |
1028 | 1028 | | |
1029 | | - | |
1030 | 1029 | | |
| 1030 | + | |
1031 | 1031 | | |
1032 | 1032 | | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
| 1033 | + | |
1036 | 1034 | | |
1037 | 1035 | | |
1038 | 1036 | | |
| 1037 | + | |
| 1038 | + | |
1039 | 1039 | | |
1040 | | - | |
1041 | 1040 | | |
1042 | 1041 | | |
| 1042 | + | |
1043 | 1043 | | |
1044 | 1044 | | |
1045 | | - | |
| 1045 | + | |
1046 | 1046 | | |
1047 | 1047 | | |
1048 | 1048 | | |
1049 | 1049 | | |
1050 | | - | |
1051 | 1050 | | |
1052 | 1051 | | |
1053 | 1052 | | |
1054 | 1053 | | |
1055 | 1054 | | |
1056 | | - | |
| 1055 | + | |
| 1056 | + | |
1057 | 1057 | | |
1058 | 1058 | | |
1059 | 1059 | | |
| |||
1062 | 1062 | | |
1063 | 1063 | | |
1064 | 1064 | | |
1065 | | - | |
1066 | 1065 | | |
1067 | 1066 | | |
1068 | 1067 | | |
1069 | 1068 | | |
1070 | 1069 | | |
1071 | | - | |
1072 | 1070 | | |
1073 | 1071 | | |
1074 | 1072 | | |
1075 | 1073 | | |
1076 | | - | |
1077 | 1074 | | |
1078 | 1075 | | |
1079 | 1076 | | |
| |||
1085 | 1082 | | |
1086 | 1083 | | |
1087 | 1084 | | |
1088 | | - | |
1089 | 1085 | | |
1090 | 1086 | | |
1091 | 1087 | | |
1092 | | - | |
| 1088 | + | |
1093 | 1089 | | |
1094 | 1090 | | |
1095 | 1091 | | |
1096 | | - | |
1097 | 1092 | | |
1098 | 1093 | | |
1099 | 1094 | | |
1100 | 1095 | | |
1101 | | - | |
1102 | | - | |
| 1096 | + | |
1103 | 1097 | | |
1104 | 1098 | | |
1105 | | - | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
1106 | 1108 | | |
1107 | | - | |
1108 | | - | |
| 1109 | + | |
1109 | 1110 | | |
1110 | 1111 | | |
| 1112 | + | |
1111 | 1113 | | |
1112 | | - | |
1113 | 1114 | | |
1114 | 1115 | | |
1115 | 1116 | | |
| |||
0 commit comments