提交 dace5274 编写于 作者: G George Amanakis 提交者: Greg Kroah-Hartman

tun: move the call to tun_set_real_num_queues

[ Upstream commit 3a03cb8456cc1d61c467a5375e0a10e5207b948c ]

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: NGeorge Amanakis <gamanakis@gmail.com>
Signed-off-by: NGeorge Amanakis <gamanakis@gmail.com>
Signed-off-by: NStanislav Fomichev <sdf@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 e569927a
...@@ -866,8 +866,6 @@ static int tun_attach(struct tun_struct *tun, struct file *file, ...@@ -866,8 +866,6 @@ static int tun_attach(struct tun_struct *tun, struct file *file,
tun_napi_init(tun, tfile, napi, napi_frags); tun_napi_init(tun, tfile, napi, napi_frags);
} }
tun_set_real_num_queues(tun);
/* device is allowed to go away first, so no need to hold extra /* device is allowed to go away first, so no need to hold extra
* refcnt. * refcnt.
*/ */
...@@ -879,6 +877,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file, ...@@ -879,6 +877,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file,
rcu_assign_pointer(tfile->tun, tun); rcu_assign_pointer(tfile->tun, tun);
rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile);
tun->numqueues++; tun->numqueues++;
tun_set_real_num_queues(tun);
out: out:
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册