Fix vpid/vppid/vtid contexts handling of sched_switch vs exit NULL nsproxy
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 21 Jul 2011 16:18:35 +0000 (12:18 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 21 Jul 2011 16:18:35 +0000 (12:18 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-context-vpid.c
lttng-context-vppid.c
lttng-context-vtid.c

index f12eb97efebe25bbae9355320a3d9e5a16da0577..3f16e03a6d996992107cbfe6eac19bb2e52dbf76 100644 (file)
@@ -32,7 +32,13 @@ void vpid_record(struct lttng_ctx_field *field,
 {
        pid_t vpid;
 
-       vpid = task_tgid_vnr(current);
+       /*
+        * nsproxy can be NULL when scheduled out of exit.
+        */
+       if (!current->nsproxy)
+               vpid = 0;
+       else
+               vpid = task_tgid_vnr(current);
        lib_ring_buffer_align_ctx(ctx, ltt_alignof(vpid));
        chan->ops->event_write(ctx, &vpid, sizeof(vpid));
 }
index 4abf784613afebf844f9be3ed92946519dbff31f..f01b02068d67fa8ef1bdfc8e1a278f93b27cf618 100644 (file)
@@ -31,10 +31,18 @@ void vppid_record(struct lttng_ctx_field *field,
                  struct lib_ring_buffer_ctx *ctx,
                  struct ltt_channel *chan)
 {
+       struct task_struct *parent;
        pid_t vppid;
 
+       /*
+        * nsproxy can be NULL when scheduled out of exit.
+        */
        rcu_read_lock();
-       vppid = task_tgid_vnr(current->real_parent);
+       parent = rcu_dereference(current->real_parent);
+       if (!parent->nsproxy)
+               vppid = 0;
+       else
+               vppid = task_tgid_vnr(parent);
        rcu_read_unlock();
        lib_ring_buffer_align_ctx(ctx, ltt_alignof(vppid));
        chan->ops->event_write(ctx, &vppid, sizeof(vppid));
index c428911ef98aff76bdb822dc72e494febcf41b64..264bbb3011da08760bbb85697de1bf64f1f6f048 100644 (file)
@@ -32,7 +32,13 @@ void vtid_record(struct lttng_ctx_field *field,
 {
        pid_t vtid;
 
-       vtid = task_pid_vnr(current);
+       /*
+        * nsproxy can be NULL when scheduled out of exit.
+        */
+       if (!current->nsproxy)
+               vtid = 0;
+       else
+               vtid = task_pid_vnr(current);
        lib_ring_buffer_align_ctx(ctx, ltt_alignof(vtid));
        chan->ops->event_write(ctx, &vtid, sizeof(vtid));
 }
This page took 0.026499 seconds and 4 git commands to generate.