103 * Note - rdsv3_clear_recv_queue grabs rs_recv_lock, so
104 * that ensures the recv path has completed messing
105 * with the socket.
106 *
107 * Note2 - rdsv3_clear_recv_queue(rs) should be called first
108 * to prevent some race conditions, which is different from
109 * the Linux code.
110 */
111 rdsv3_clear_recv_queue(rs);
112 rdsv3_send_drop_to(rs, NULL);
113 rdsv3_rdma_drop_keys(rs);
114 (void) rdsv3_notify_queue_get(rs, NULL);
115
116 mutex_enter(&rdsv3_sock_lock);
117 list_remove_node(&rs->rs_item);
118 rdsv3_sock_count--;
119 mutex_exit(&rdsv3_sock_lock);
120
121 while (sk->sk_refcount > 1) {
122 /* wait for 1 sec and try again */
123 delay(drv_usectohz(1000000));
124 }
125
126 /* this will free the rs and sk */
127 rdsv3_sk_sock_put(sk);
128
129 RDSV3_DPRINTF4("rdsv3_release", "Return (rds: %p)", rs);
130 out:
131 return (0);
132 }
133
134 void
135 __rdsv3_wake_sk_sleep(struct rsock *sk)
136 {
137 /* wakup anyone waiting in recvmsg */
138 if (!rdsv3_sk_sock_flag(sk, SOCK_DEAD) && sk->sk_sleep)
139 rdsv3_wake_up(sk->sk_sleep);
140 }
141
142 /*
143 * Careful not to race with rdsv3_release -> sock_orphan which clears sk_sleep.
|
103 * Note - rdsv3_clear_recv_queue grabs rs_recv_lock, so
104 * that ensures the recv path has completed messing
105 * with the socket.
106 *
107 * Note2 - rdsv3_clear_recv_queue(rs) should be called first
108 * to prevent some race conditions, which is different from
109 * the Linux code.
110 */
111 rdsv3_clear_recv_queue(rs);
112 rdsv3_send_drop_to(rs, NULL);
113 rdsv3_rdma_drop_keys(rs);
114 (void) rdsv3_notify_queue_get(rs, NULL);
115
116 mutex_enter(&rdsv3_sock_lock);
117 list_remove_node(&rs->rs_item);
118 rdsv3_sock_count--;
119 mutex_exit(&rdsv3_sock_lock);
120
121 while (sk->sk_refcount > 1) {
122 /* wait for 1 sec and try again */
123 delay(drv_sectohz(1));
124 }
125
126 /* this will free the rs and sk */
127 rdsv3_sk_sock_put(sk);
128
129 RDSV3_DPRINTF4("rdsv3_release", "Return (rds: %p)", rs);
130 out:
131 return (0);
132 }
133
134 void
135 __rdsv3_wake_sk_sleep(struct rsock *sk)
136 {
137 /* wakup anyone waiting in recvmsg */
138 if (!rdsv3_sk_sock_flag(sk, SOCK_DEAD) && sk->sk_sleep)
139 rdsv3_wake_up(sk->sk_sleep);
140 }
141
142 /*
143 * Careful not to race with rdsv3_release -> sock_orphan which clears sk_sleep.
|