tun: fix blocking read
Subsystems (3)
PATCH 1/1 tun: fix blocking read
This patch moves setting of the current state into the loop. Otherwise the task may end up in a busy wait loop if none of the break conditions are met.
--- drivers/net/tun.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/tun.c +2 -2
@@ -2167,9 +2167,9 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err) }add_wait_queue (&tfile->wq.wait, &wait); - current->state =TASK_INTERRUPTIBLE ;while (1 ) { +set_current_state (TASK_INTERRUPTIBLE ); ptr =ptr_ring_consume (&tfile->tx_ring);if (ptr)break ;
@@ -2185,7 +2185,7 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err)schedule (); } - current->state =TASK_RUNNING ; +set_current_state (TASK_RUNNING );remove_wait_queue (&tfile->wq.wait, &wait); out:
Signature · 1 line
2.20.1
David Miller
maintainerFrom: Timur Celik <[email protected]>
Date: Sat, 23 Feb 2019 12:53:13 +0100
Quoted 5 lines
This patch moves setting of the current state into the loop. Otherwise the task may end up in a busy wait loop if none of the break conditions are met.
Signed-off-by Timur Celik <[email protected]>
Applied and queued up for -stable, thanks.
Quoted 11 lines · David Miller
From: Timur Celik <[email protected]>
Date: Sat, 23 Feb 2019 12:53:13 +0100Quoted 5 lines
This patch moves setting of the current state into the loop. Otherwise the task may end up in a busy wait loop if none of the break conditions are met.
Signed-off-by Timur Celik <[email protected]>Applied and queued up for -stable, thanks.
First part of the patch was matching the changelog, however the second change was not really needed, or should have used
__set_current_state(TASK_RUNNING);
David Miller
maintainerFrom: Eric Dumazet <[email protected]>
Date: Mon, 25 Feb 2019 07:53:08 -0800
Quoted 12 lines · David Miller
Quoted 9 lines
From: Timur Celik <[email protected]>
Date: Sat, 23 Feb 2019 12:53:13 +0100Quoted 5 lines
This patch moves setting of the current state into the loop. Otherwise the task may end up in a busy wait loop if none of the break conditions are met.
Signed-off-by Timur Celik <[email protected]>
Quoted 7 lines
Quoted 2 lines
Applied and queued up for -stable, thanks.
First part of the patch was matching the changelog, however the second change was not really needed, or should have used
__set_current_state(TASK_RUNNING);
Timur, please followup.
Quoted 18 lines · David Miller
From: Eric Dumazet <[email protected]>
Date: Mon, 25 Feb 2019 07:53:08 -0800Quoted 15 lines · David Miller
Quoted 11 lines
From: Timur Celik <[email protected]>
Date: Sat, 23 Feb 2019 12:53:13 +0100Quoted 5 lines
This patch moves setting of the current state into the loop. Otherwise the task may end up in a busy wait loop if none of the break conditions are met.
Signed-off-by Timur Celik <[email protected]>Applied and queued up for -stable, thanks.
Quoted 6 lines
Quoted 4 lines
First part of the patch was matching the changelog, however the second change was not really needed, or should have used
__set_current_state(TASK_RUNNING);Timur, please followup.
Thanks for taking a look at this. Eric is right of course.
PATCH 1/1 tun: remove unnecessary memory barrier
In reply to David MillerReplace set_current_state with __set_current_state since no memory barrier is needed at this point.
--- drivers/net/tun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/tun.c +1 -1
@@ -2185,7 +2185,7 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err)schedule (); } -set_current_state (TASK_RUNNING ); +__set_current_state (TASK_RUNNING );remove_wait_queue (&tfile->wq.wait, &wait); out:
Signature · 1 line
2.20.1
Re: [PATCH] tun: remove unnecessary memory barrier
Quoted 7 lines · Timur Celik
Replace
set_current_statewith__set_current_statesince no memory barrier is needed at this point.Signed-off-by Timur Celik <[email protected]>--- drivers/net/tun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
SGTM, thanks.
Re: [PATCH] tun: remove unnecessary memory barrier
In reply to Timur CelikFrom: Timur Celik <[email protected]>
Date: Mon, 25 Feb 2019 21:13:13 +0100
Quoted 4 lines
Replace
set_current_statewith__set_current_statesince no memory barrier is needed at this point.Signed-off-by Timur Celik <[email protected]>
Applied, thanks.