if (err < 0)
goto out;
+ prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
+
while (total_written < len) {
ssize_t written;
goto out_wait;
release_sock(sk);
- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
timeout = schedule_timeout(timeout);
- finish_wait(sk_sleep(sk), &wait);
lock_sock(sk);
if (signal_pending(current)) {
err = sock_intr_errno(timeout);
goto out_wait;
}
+ prepare_to_wait(sk_sleep(sk), &wait,
+ TASK_INTERRUPTIBLE);
}
/* These checks occur both as part of and after the loop
out_wait:
if (total_written > 0)
err = total_written;
+ finish_wait(sk_sleep(sk), &wait);
out:
release_sock(sk);
return err;
if (err < 0)
goto out;
+ prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
while (1) {
s64 ready = vsock_stream_has_data(vsk);
*/
err = -ENOMEM;
- goto out;
+ goto out_wait;
} else if (ready > 0) {
ssize_t read;
vsk, target, read,
!(flags & MSG_PEEK), &recv_data);
if (err < 0)
- goto out;
+ goto out_wait;
if (read >= target || flags & MSG_PEEK)
break;
break;
release_sock(sk);
- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
timeout = schedule_timeout(timeout);
- finish_wait(sk_sleep(sk), &wait);
lock_sock(sk);
if (signal_pending(current)) {
err = -EAGAIN;
break;
}
+
+ prepare_to_wait(sk_sleep(sk), &wait,
+ TASK_INTERRUPTIBLE);
}
}
err = copied;
}
+out_wait:
+ finish_wait(sk_sleep(sk), &wait);
out:
release_sock(sk);
return err;