Blktrace failed to lock reader threads on the cpu used by the corresponding
authorTom Zanussi <tzanussi@gmail.com>
Mon, 23 Mar 2009 18:41:00 +0000 (19:41 +0100)
committerJens Axboe <axboe@carl.(none)>
Mon, 23 Mar 2009 18:41:00 +0000 (19:41 +0100)
writer. This resulted in stale data being consumed when blktrace accidently
read at a position that was being written to at the same time. This issue
surfaced as "bad trace magic" warnings emitted by blktrace tools.

The problem occured on an SMP System z machine. The patch fixes the issue.

Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <axboe@carl.(none)>
blktrace.c

index 26b3afdd671c5ca02697a36a36ae3bf167e675b7..656ab7a811ad8575f357c69d8d200cb7e982bd34 100644 (file)
@@ -610,7 +610,7 @@ static int lock_on_cpu(int cpu)
 
        CPU_ZERO(&cpu_mask);
        CPU_SET(cpu, &cpu_mask);
-       if (sched_setaffinity(getpid(), sizeof(cpu_mask), &cpu_mask) < 0)
+       if (sched_setaffinity(0, sizeof(cpu_mask), &cpu_mask) < 0)
                return errno;
 
        return 0;