cgroup: net_cls: Pass in task to sock_update_classid()
sock_update_classid() assumes that the update operation always are applied on the current task. sock_update_classid() needs to know on which tasks to work on in order to be able to migrate task between cgroups using the struct cgroup_subsys attach() callback. Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de> Cc: "David S. Miller" <davem@davemloft.net> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Eric Dumazet <edumazet@google.com> Cc: Glauber Costa <glommer@parallels.com> Cc: Joe Perches <joe@perches.com> Cc: Neil Horman <nhorman@tuxdriver.com> Cc: Stanislav Kinsbursky <skinsbursky@parallels.com> Cc: Tejun Heo <tj@kernel.org> Cc: <netdev@vger.kernel.org> Cc: <cgroups@vger.kernel.org> Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
3ace03cc2a
commit
fd9a08a7b8
@@ -1217,11 +1217,11 @@ static void sk_prot_free(struct proto *prot, struct sock *sk)
|
||||
|
||||
#ifdef CONFIG_CGROUPS
|
||||
#if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
|
||||
void sock_update_classid(struct sock *sk)
|
||||
void sock_update_classid(struct sock *sk, struct task_struct *task)
|
||||
{
|
||||
u32 classid;
|
||||
|
||||
classid = task_cls_classid(current);
|
||||
classid = task_cls_classid(task);
|
||||
if (classid != sk->sk_classid)
|
||||
sk->sk_classid = classid;
|
||||
}
|
||||
@@ -1264,7 +1264,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
|
||||
sock_net_set(sk, get_net(net));
|
||||
atomic_set(&sk->sk_wmem_alloc, 1);
|
||||
|
||||
sock_update_classid(sk);
|
||||
sock_update_classid(sk, current);
|
||||
sock_update_netprioidx(sk, current);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user