Skip to content

Commit

Permalink
RDS: Fix completion notifications on blocking sockets
Browse files Browse the repository at this point in the history
Completion or congestion notifications were not being checked
if the socket went to sleep. This patch fixes that.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Andy Grover authored and David S. Miller committed Jul 20, 2009
1 parent fdf6e6b commit edacaea
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions net/rds/recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,26 +409,28 @@ int rds_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
if (msg_flags & MSG_OOB)
goto out;

/* If there are pending notifications, do those - and nothing else */
if (!list_empty(&rs->rs_notify_queue)) {
ret = rds_notify_queue_get(rs, msg);
goto out;
}
while (1) {
/* If there are pending notifications, do those - and nothing else */
if (!list_empty(&rs->rs_notify_queue)) {
ret = rds_notify_queue_get(rs, msg);
break;
}

if (rs->rs_cong_notify) {
ret = rds_notify_cong(rs, msg);
goto out;
}
if (rs->rs_cong_notify) {
ret = rds_notify_cong(rs, msg);
break;
}

while (1) {
if (!rds_next_incoming(rs, &inc)) {
if (nonblock) {
ret = -EAGAIN;
break;
}

timeo = wait_event_interruptible_timeout(*sk->sk_sleep,
rds_next_incoming(rs, &inc),
(!list_empty(&rs->rs_notify_queue)
|| rs->rs_cong_notify
|| rds_next_incoming(rs, &inc)),
timeo);
rdsdebug("recvmsg woke inc %p timeo %ld\n", inc,
timeo);
Expand Down

0 comments on commit edacaea

Please sign in to comment.