<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/trace/blktrace.c, branch v2.6.30</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v2.6.30</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.30'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2009-04-09T03:52:40Z</updated>
<entry>
<title>blktrace: pass the right pointer to kfree()</title>
<updated>2009-04-09T03:52:40Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2009-04-09T03:19:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9eb85125ce218a8b8d9a7c982510388e227adbec'/>
<id>urn:sha1:9eb85125ce218a8b8d9a7c982510388e227adbec</id>
<content type='text'>
Impact: fix kfree crash with non-standard act_mask string

If passing a string with leading white spaces to strstrip(),
the returned ptr != the original ptr.

This bug was introduced by me.

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Cc: Jens Axboe &lt;jens.axboe@oracle.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
LKML-Reference: &lt;49DD694C.8020902@cn.fujitsu.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>blktrace: fix pdu_len when tracing packet command requests</title>
<updated>2009-04-03T13:29:26Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2009-04-02T05:43:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e2494e1b42ebac402324105d57646489d19e2b01'/>
<id>urn:sha1:e2494e1b42ebac402324105d57646489d19e2b01</id>
<content type='text'>
Impact: output all of packet commands - not just the first 4 / 8 bytes

Since commit d7e3c3249ef23b4617393c69fe464765b4ff1645 ("block: add
large command support"), struct request-&gt;cmd has been changed from
unsinged char cmd[BLK_MAX_CDB] to unsigned char *cmd.

v1 -&gt; v2: by: FUJITA Tomonori &lt;fujita.tomonori@lab.ntt.co.jp&gt;

- make sure rq-&gt;cmd_len is always intialized, and then we can use
  rq-&gt;cmd_len instead of BLK_MAX_CDB.

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Acked-by: FUJITA Tomonori &lt;fujita.tomonori@lab.ntt.co.jp&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Jens Axboe &lt;jens.axboe@oracle.com&gt;
LKML-Reference: &lt;49D4507E.2060602@cn.fujitsu.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>blktrace: small cleanup in blk_msg_write()</title>
<updated>2009-04-03T12:48:11Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2009-04-03T07:31:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7635b03adf3d7b84da7649b81efa91e6ebf11b85'/>
<id>urn:sha1:7635b03adf3d7b84da7649b81efa91e6ebf11b85</id>
<content type='text'>
Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: "Alan D. Brunelle" &lt;alan.brunelle@hp.com&gt;
Cc: Jens Axboe &lt;jens.axboe@oracle.com&gt;
LKML-Reference: &lt;49D5BB56.7000807@cn.fujitsu.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>blktrace: NUL-terminate user space messages</title>
<updated>2009-04-03T12:46:22Z</updated>
<author>
<name>Carl Henrik Lunde</name>
<email>chlunde@ping.uio.no</email>
</author>
<published>2009-04-03T12:27:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a4b3ada83d06554d307dd54abdc62b2e5648264a'/>
<id>urn:sha1:a4b3ada83d06554d307dd54abdc62b2e5648264a</id>
<content type='text'>
Impact: fix corrupted blkparse output

Make sure messages from user space are NUL-terminated strings,
otherwise we could dump random memory to the block trace file.

Additionally, I've limited the message to BLK_TN_MAX_MSG-1
characters, because the last character would be stripped by
vscnprintf anyway.

Signed-off-by: Carl Henrik Lunde &lt;chlunde@ping.uio.no&gt;
Cc: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: "Alan D. Brunelle" &lt;alan.brunelle@hp.com&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
LKML-Reference: &lt;20090403122714.GT5178@kernel.dk&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>blktrace: print out BLK_TN_MESSAGE properly</title>
<updated>2009-03-31T15:29:11Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2009-03-27T02:21:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=18cea4591a98817697017bcb056a848bae1205df'/>
<id>urn:sha1:18cea4591a98817697017bcb056a848bae1205df</id>
<content type='text'>
Impact: improve ftrace plugin output

Before this patch:

 # cat trace
         make-5383  [001]   741.240059:   8,7    P   N [make]
 __trace_note_message: cfq1074

 # echo 1 &gt; options/blk_classic
 # cat trace
   8,7    1     0.692221252     0  C   W 130411392 + 1024 [0]
 Bad pc action 6361
 Bad pc action 283d

 # echo 0 &gt; options/blk_classic
 # echo bin &gt; trace_options
 # cat trace_pipe | blkparse -i -
 (can't parse messages generated by blk_add_trace_msg())

After this patch:
 # cat trace
      &lt;idle&gt;-0     [001]   187.600933:   8,7    C   W 145220224 + 8 [0]
      &lt;idle&gt;-0     [001]   187.600946:   8,7    m   N cfq1076 complete

 # echo 1 &gt; options/blk_classic
 # cat trace
   8,7    1     0.256378996   238  I   W 113190728 + 8 [pdflush]
   8,7    1     0.256378998   238  m   N cfq1076 insert_request

 # echo 0 &gt; options/blk_classic
 # echo bin &gt; trace_options
 # cat trace_pipe | blkparse -i -
  8,7    1        0    22.973250293     0  C   W 102770576 + 8 [0]
  8,7    1        0    22.973259213     0  m   N cfq1076 complete

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Acked-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>blktrace: extract duplidate code</title>
<updated>2009-03-31T15:28:59Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2009-03-27T02:21:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b6a4b0c3ad4c09c1d37b1040ac8e3ebd1016e10b'/>
<id>urn:sha1:b6a4b0c3ad4c09c1d37b1040ac8e3ebd1016e10b</id>
<content type='text'>
Impact: cleanup

blk_trace_event_print() and blk_tracer_print_line() share most of the code.

   text    data     bss     dec     hex filename
   8605     393      12    9010    2332 kernel/trace/blktrace.o.orig
   text    data     bss     dec     hex filename
   8555     393      12    8960    2300 kernel/trace/blktrace.o

This patch also prepares for the next patch, that prints out BLK_TN_MESSAGE.

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Acked-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>blktrace: fix memory leak when freeing struct blk_io_trace</title>
<updated>2009-03-31T15:27:58Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2009-03-27T02:20:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ad5dd5493a55e462796e42e50a49e76df76fdb05'/>
<id>urn:sha1:ad5dd5493a55e462796e42e50a49e76df76fdb05</id>
<content type='text'>
Impact: fix mixed ioctl and ftrace-plugin blktrace use memory leak

When mixing the use of ioctl-based blktrace and ftrace-based blktrace,
we can leak memory in this way:

  # btrace /dev/sda &gt; /dev/null &amp;
  # echo 0 &gt; /sys/block/sda/sda1/trace/enable

now we leak bt-&gt;dropped_file, bt-&gt;msg_file, bt-&gt;rchan...

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Acked-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>blktrace: fix blk_probes_ref chaos</title>
<updated>2009-03-31T15:27:45Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2009-03-27T02:20:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=17ba97e347bec9bbc47a0877c7a098708982129d'/>
<id>urn:sha1:17ba97e347bec9bbc47a0877c7a098708982129d</id>
<content type='text'>
Impact: fix mixed ioctl and ftrace-plugin blktrace use refcount bugs

ioctl-based blktrace allocates bt and registers tracepoints when
ioctl(BLKTRACESETUP), and do all cleanups when ioctl(BLKTRACETEARDOWN).

while ftrace-based blktrace allocates/frees bt when:
  # echo 1/0 &gt; /sys/block/sda/sda1/trace/enable

and registers/unregisters tracepoints when:
  # echo blk/nop &gt; /debugfs/tracing/current_tracer
or
  # echo 1/0 &gt; /debugfs/tracing/tracing_enable

The separatation of allocation and registeration causes 2 problems:

  1. current user-space blktrace still calls ioctl(TEARDOWN) when
     ioctl(SETUP) failed:
       # echo 1 &gt; /sys/block/sda/sda1/trace/enable
       # blktrace /dev/sda
         BLKTRACESETUP: Device or resource busy
         ^C
     and now blk_probes_ref == -1

  2. Another way to make blk_probes_ref == -1:
     # plugin sdb &amp;&amp; mount sdb1
     # echo 1 &gt; /sys/block/sdb/sdb1/trace/enable
     # remove sdb

This patch does the allocation and registeration when writing
sdaX/trace/enable.

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Acked-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>blktrace: make classic output more classic</title>
<updated>2009-03-31T15:27:36Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2009-03-27T02:19:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=35ac51bfe4c293b67ce9f85082ba0b9bc6123c40'/>
<id>urn:sha1:35ac51bfe4c293b67ce9f85082ba0b9bc6123c40</id>
<content type='text'>
Impact: fix ftrace plugin timestamp output

In the classic user-space blktrace, the output timestamp is sec.nsec
not sec.usec.

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Acked-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>blktrace: fix off-by-one bug</title>
<updated>2009-03-31T15:27:18Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2009-03-24T08:05:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=eb08f8eb0673d9c1e62b69ad1b41593e73c40467'/>
<id>urn:sha1:eb08f8eb0673d9c1e62b69ad1b41593e73c40467</id>
<content type='text'>
'what' is used as the index of array what2act, so it can't &gt;= the array size.

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Acked-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
Acked-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Acked-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
</feed>
