diff options
author | George Amanakis <gamanakis@gmail.com> | 2019-01-29 22:50:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-01-31 00:40:25 -0500 |
commit | 3a03cb8456cc1d61c467a5375e0a10e5207b948c (patch) | |
tree | 6bb5e3d2847b954be1f1d4102bc568c5ec8c937b /drivers/net/tun.c | |
parent | ef489749aae508e6f17886775c075f12ff919fb1 (diff) |
tun: move the call to tun_set_real_num_queues
Call tun_set_real_num_queues() after the increment of tun->numqueues
since the former depends on it. Otherwise, the number of queues is not
correctly accounted for, which results to warnings similar to:
"vnet0 selects TX queue 11, but real number of TX queues is 11".
Fixes: 0b7959b62573 ("tun: publish tfile after it's fully initialized")
Reported-and-tested-by: George Amanakis <gamanakis@gmail.com>
Signed-off-by: George Amanakis <gamanakis@gmail.com>
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r-- | drivers/net/tun.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 18656c4094b3..fed298c0cb39 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -866,8 +866,6 @@ static int tun_attach(struct tun_struct *tun, struct file *file, | |||
866 | if (rtnl_dereference(tun->xdp_prog)) | 866 | if (rtnl_dereference(tun->xdp_prog)) |
867 | sock_set_flag(&tfile->sk, SOCK_XDP); | 867 | sock_set_flag(&tfile->sk, SOCK_XDP); |
868 | 868 | ||
869 | tun_set_real_num_queues(tun); | ||
870 | |||
871 | /* device is allowed to go away first, so no need to hold extra | 869 | /* device is allowed to go away first, so no need to hold extra |
872 | * refcnt. | 870 | * refcnt. |
873 | */ | 871 | */ |
@@ -879,6 +877,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file, | |||
879 | rcu_assign_pointer(tfile->tun, tun); | 877 | rcu_assign_pointer(tfile->tun, tun); |
880 | rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); | 878 | rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); |
881 | tun->numqueues++; | 879 | tun->numqueues++; |
880 | tun_set_real_num_queues(tun); | ||
882 | out: | 881 | out: |
883 | return err; | 882 | return err; |
884 | } | 883 | } |