|
@@ -1293,7 +1293,8 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile,
|
|
|
if (unlikely(!noblock))
|
|
|
add_wait_queue(&tfile->wq.wait, &wait);
|
|
|
while (len) {
|
|
|
- current->state = TASK_INTERRUPTIBLE;
|
|
|
+ if (unlikely(!noblock))
|
|
|
+ current->state = TASK_INTERRUPTIBLE;
|
|
|
|
|
|
/* Read frames from the queue */
|
|
|
if (!(skb = skb_dequeue(&tfile->socket.sk->sk_receive_queue))) {
|
|
@@ -1320,9 +1321,10 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile,
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- current->state = TASK_RUNNING;
|
|
|
- if (unlikely(!noblock))
|
|
|
+ if (unlikely(!noblock)) {
|
|
|
+ current->state = TASK_RUNNING;
|
|
|
remove_wait_queue(&tfile->wq.wait, &wait);
|
|
|
+ }
|
|
|
|
|
|
return ret;
|
|
|
}
|