Skip to content

Commit ccf7e72

Browse files
honkikodavem330
authored andcommitted
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>
1 parent e9939c8 commit ccf7e72

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎drivers/net/macvtap.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -847,13 +847,12 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb,
847847
const struct iovec *iv, unsigned long len,
848848
int noblock)
849849
{
850-
DECLARE_WAITQUEUE(wait, current);
850+
DEFINE_WAIT(wait);
851851
struct sk_buff *skb;
852852
ssize_t ret = 0;
853853

854-
add_wait_queue(sk_sleep(&q->sk), &wait);
855854
while (len) {
856-
current->state = TASK_INTERRUPTIBLE;
855+
prepare_to_wait(sk_sleep(&q->sk), &wait, TASK_INTERRUPTIBLE);
857856

858857
/* Read frames from the queue */
859858
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,
875874
break;
876875
}
877876

878-
current->state = TASK_RUNNING;
879-
remove_wait_queue(sk_sleep(&q->sk), &wait);
877+
finish_wait(sk_sleep(&q->sk), &wait);
880878
return ret;
881879
}
882880

0 commit comments

Comments
 (0)