summaryrefslogtreecommitdiffstats
path: root/drivers/net/macvtap.c
diff options
context:
space:
mode:
authorHong zhi guo <honkiko@gmail.com>2012-06-06 22:36:27 +0000
committerDavid S. Miller <davem@davemloft.net>2012-06-07 13:18:54 -0700
commitccf7e72b54253f926a35fdfa0366e0cb9ba72ffd (patch)
tree18ae6d687384747f92a99a2ab283f819d46f25f2 /drivers/net/macvtap.c
parente9939c80e9cb51f0da7d6e70838fd6c90248439f (diff)
downloadtalos-op-linux-ccf7e72b54253f926a35fdfa0366e0cb9ba72ffd.tar.gz
talos-op-linux-ccf7e72b54253f926a35fdfa0366e0cb9ba72ffd.zip
macvtap: use prepare_to_wait/finish_wait to ensure mb
instead of raw assignment to current->state Signed-off-by: Hong Zhiguo <honkiko@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/macvtap.c')
-rw-r--r--drivers/net/macvtap.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 2ee56de7b0ca..0737bd4d1669 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -847,13 +847,12 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb,
const struct iovec *iv, unsigned long len,
int noblock)
{
- DECLARE_WAITQUEUE(wait, current);
+ DEFINE_WAIT(wait);
struct sk_buff *skb;
ssize_t ret = 0;
- add_wait_queue(sk_sleep(&q->sk), &wait);
while (len) {
- current->state = TASK_INTERRUPTIBLE;
+ prepare_to_wait(sk_sleep(&q->sk), &wait, TASK_INTERRUPTIBLE);
/* Read frames from the queue */
skb = skb_dequeue(&q->sk.sk_receive_queue);
@@ -875,8 +874,7 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb,
break;
}
- current->state = TASK_RUNNING;
- remove_wait_queue(sk_sleep(&q->sk), &wait);
+ finish_wait(sk_sleep(&q->sk), &wait);
return ret;
}
OpenPOWER on IntegriCloud