268
269 rw_enter(&sp->session_lock, RW_WRITER);
270
271 /*
272 * If the session was in ERROR, then either a failover thread
273 * or event_failure thread would be processing this session.
274 * This thread should wait for event_failure thread to
275 * complete. This need not wait for failover thread.
276 */
277 if ((save_state != RDS_SESSION_STATE_CONNECTED) &&
278 (save_type == RDS_SESSION_PASSIVE)) {
279 /*
280 * The other thread is event_failure thread,
281 * wait until it finishes.
282 */
283 while (!((sp->session_state ==
284 RDS_SESSION_STATE_FAILED) ||
285 (sp->session_state ==
286 RDS_SESSION_STATE_FINI))) {
287 rw_exit(&sp->session_lock);
288 delay(drv_usectohz(1000000));
289 rw_enter(&sp->session_lock, RW_WRITER);
290 }
291 }
292
293 /* move the session to init state */
294 if ((sp->session_state == RDS_SESSION_STATE_ERROR) ||
295 (sp->session_state == RDS_SESSION_STATE_PASSIVE_CLOSING)) {
296 ret = rds_session_reinit(sp, lgid);
297 sp->session_myip = ipcm_info.DSTIP;
298 sp->session_lgid = lgid;
299 sp->session_rgid = rgid;
300 if (ret != 0) {
301 rds_session_fini(sp);
302 sp->session_state = RDS_SESSION_STATE_FAILED;
303 RDS_DPRINTF3("rds_handle_cm_req",
304 "SP(%p) State RDS_SESSION_STATE_FAILED",
305 sp);
306 rw_exit(&sp->session_lock);
307 return (IBT_CM_REJECT);
308 } else {
|
268
269 rw_enter(&sp->session_lock, RW_WRITER);
270
271 /*
272 * If the session was in ERROR, then either a failover thread
273 * or event_failure thread would be processing this session.
274 * This thread should wait for event_failure thread to
275 * complete. This need not wait for failover thread.
276 */
277 if ((save_state != RDS_SESSION_STATE_CONNECTED) &&
278 (save_type == RDS_SESSION_PASSIVE)) {
279 /*
280 * The other thread is event_failure thread,
281 * wait until it finishes.
282 */
283 while (!((sp->session_state ==
284 RDS_SESSION_STATE_FAILED) ||
285 (sp->session_state ==
286 RDS_SESSION_STATE_FINI))) {
287 rw_exit(&sp->session_lock);
288 delay(drv_sectohz(1));
289 rw_enter(&sp->session_lock, RW_WRITER);
290 }
291 }
292
293 /* move the session to init state */
294 if ((sp->session_state == RDS_SESSION_STATE_ERROR) ||
295 (sp->session_state == RDS_SESSION_STATE_PASSIVE_CLOSING)) {
296 ret = rds_session_reinit(sp, lgid);
297 sp->session_myip = ipcm_info.DSTIP;
298 sp->session_lgid = lgid;
299 sp->session_rgid = rgid;
300 if (ret != 0) {
301 rds_session_fini(sp);
302 sp->session_state = RDS_SESSION_STATE_FAILED;
303 RDS_DPRINTF3("rds_handle_cm_req",
304 "SP(%p) State RDS_SESSION_STATE_FAILED",
305 sp);
306 rw_exit(&sp->session_lock);
307 return (IBT_CM_REJECT);
308 } else {
|