|
@@ -817,7 +817,8 @@ static ssize_t tun_do_read(struct tun_struct *tun,
|
|
|
|
|
|
tun_debug(KERN_INFO, tun, "tun_chr_read\n");
|
|
|
|
|
|
- add_wait_queue(&tun->wq.wait, &wait);
|
|
|
+ if (unlikely(!noblock))
|
|
|
+ add_wait_queue(&tun->wq.wait, &wait);
|
|
|
while (len) {
|
|
|
current->state = TASK_INTERRUPTIBLE;
|
|
|
|
|
@@ -848,7 +849,8 @@ static ssize_t tun_do_read(struct tun_struct *tun,
|
|
|
}
|
|
|
|
|
|
current->state = TASK_RUNNING;
|
|
|
- remove_wait_queue(&tun->wq.wait, &wait);
|
|
|
+ if (unlikely(!noblock))
|
|
|
+ remove_wait_queue(&tun->wq.wait, &wait);
|
|
|
|
|
|
return ret;
|
|
|
}
|