1243 bzero(&t_addr, sizeof (struct sockaddr_in6));
1244 t_addrlen = sizeof (struct sockaddr_in6);
1245 mutex_enter(&svc->is_mutex);
1246
1247 so_svc = svc->is_so_svc;
1248 so_svc->is_thread_running = B_TRUE;
1249 so_svc->is_thread_did = so_svc->is_thread->t_did;
1250
1251 cv_signal(&svc->is_cv);
1252
1253 IDM_SVC_LOG(CE_NOTE, "iSCSI service (%p/%d) online", (void *)svc,
1254 svc->is_svc_req.sr_port);
1255
1256 while (so_svc->is_thread_running) {
1257 mutex_exit(&svc->is_mutex);
1258
1259 if ((rc = ksocket_accept(so_svc->is_so,
1260 (struct sockaddr *)&t_addr, &t_addrlen,
1261 &new_so, CRED())) != 0) {
1262 mutex_enter(&svc->is_mutex);
1263 if (rc == ECONNABORTED)
1264 continue;
1265 /* Connection problem */
1266 break;
1267 }
1268 /*
1269 * Turn off SO_MAC_EXEMPT so future sobinds succeed
1270 */
1271 (void) ksocket_setsockopt(new_so, SOL_SOCKET, SO_MAC_EXEMPT,
1272 (char *)&off, sizeof (off), CRED());
1273
1274 idmrc = idm_svc_conn_create(svc, IDM_TRANSPORT_TYPE_SOCKETS,
1275 &ic);
1276 if (idmrc != IDM_STATUS_SUCCESS) {
1277 /* Drop connection */
1278 idm_soshutdown(new_so);
1279 idm_sodestroy(new_so);
1280 mutex_enter(&svc->is_mutex);
1281 continue;
1282 }
1283
1284 idmrc = idm_so_tgt_conn_create(ic, new_so);
1285 if (idmrc != IDM_STATUS_SUCCESS) {
1286 idm_svc_conn_destroy(ic);
|
1243 bzero(&t_addr, sizeof (struct sockaddr_in6));
1244 t_addrlen = sizeof (struct sockaddr_in6);
1245 mutex_enter(&svc->is_mutex);
1246
1247 so_svc = svc->is_so_svc;
1248 so_svc->is_thread_running = B_TRUE;
1249 so_svc->is_thread_did = so_svc->is_thread->t_did;
1250
1251 cv_signal(&svc->is_cv);
1252
1253 IDM_SVC_LOG(CE_NOTE, "iSCSI service (%p/%d) online", (void *)svc,
1254 svc->is_svc_req.sr_port);
1255
1256 while (so_svc->is_thread_running) {
1257 mutex_exit(&svc->is_mutex);
1258
1259 if ((rc = ksocket_accept(so_svc->is_so,
1260 (struct sockaddr *)&t_addr, &t_addrlen,
1261 &new_so, CRED())) != 0) {
1262 mutex_enter(&svc->is_mutex);
1263 if (rc != ECONNABORTED && rc != EINTR) {
1264 IDM_SVC_LOG(CE_NOTE, "idm_so_svc_port_watcher:"
1265 " ksocket_accept failed %d", rc);
1266 }
1267 /*
1268 * Unclean shutdown of this thread is not handled
1269 * wait for !is_thread_running.
1270 */
1271 continue;
1272 }
1273 /*
1274 * Turn off SO_MAC_EXEMPT so future sobinds succeed
1275 */
1276 (void) ksocket_setsockopt(new_so, SOL_SOCKET, SO_MAC_EXEMPT,
1277 (char *)&off, sizeof (off), CRED());
1278
1279 idmrc = idm_svc_conn_create(svc, IDM_TRANSPORT_TYPE_SOCKETS,
1280 &ic);
1281 if (idmrc != IDM_STATUS_SUCCESS) {
1282 /* Drop connection */
1283 idm_soshutdown(new_so);
1284 idm_sodestroy(new_so);
1285 mutex_enter(&svc->is_mutex);
1286 continue;
1287 }
1288
1289 idmrc = idm_so_tgt_conn_create(ic, new_so);
1290 if (idmrc != IDM_STATUS_SUCCESS) {
1291 idm_svc_conn_destroy(ic);
|