* [patch 4/5] blktrace: disable kill option
@ 2009-12-15 17:48 Edward Shishkin
2010-04-20 7:50 ` Jens Axboe
2010-04-20 13:27 ` Edward Shishkin
0 siblings, 2 replies; 3+ messages in thread
From: Edward Shishkin @ 2009-12-15 17:48 UTC (permalink / raw)
To: linux-btrace
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: blktrace-fix-513950.patch --]
[-- Type: text/plain, Size: 3716 bytes --]
Fixup for 513950.
Problem:
'blktrace -d <device> -k' does not kill a running
backgound trace. Executing 'blktrace -d <device> -k'
for the second time results in "BLKTRACETEARDOWN:
Invalid argument" message and then each run of
blktrace on that machine prints the following output:
BLKTRACESETUP: No such file or directory.
The bug:
The option -k results in clobbering information
about running trace by kernel (blk_trace_remove),
while resources (files open in debugfs by the running
background blktrace) are not released.
Solution:
. Disable non-working "kill" option;
. Update documentation, advise to send SIGINT signal
via kill(1) to the running background blktrace for
its correct termination.
Signed-off-by: Edward Shishkin <edward@redhat.com>
---
blktrace.c | 14 +++++++++++++-
doc/blktrace.8 | 24 ++++--------------------
2 files changed, 17 insertions(+), 21 deletions(-)
--- blktrace.orig/blktrace.c
+++ blktrace/blktrace.c
@@ -64,6 +64,7 @@
#define DEBUGFS_TYPE (0x64626720)
#define TRACE_NET_PORT (8462)
+#define KILL_OPT_ENABLED (0)
enum {
Net_none = 0,
@@ -326,7 +327,12 @@ static int *cl_fds;
static int (*handle_pfds)(struct tracer *, int, int);
static int (*handle_list)(struct tracer_devpath_head *, struct list_head *);
+#if KILL_OPT_ENABLED
#define S_OPTS "d:a:A:r:o:kw:vVb:n:D:lh:p:sI:"
+#else
+#define S_OPTS "d:a:A:r:o:w:vVb:n:D:lh:p:sI:"
+#endif /* KILL_OPT_ENABLED */
+
static struct option l_opts[] = {
{
.name = "dev",
@@ -364,12 +370,14 @@ static struct option l_opts[] = {
.flag = NULL,
.val = 'o'
},
+#if KILL_OPT_ENABLED
{
.name = "kill",
.has_arg = no_argument,
.flag = NULL,
.val = 'k'
},
+#endif /* KILL_OPT_ENABLED */
{
.name = "stopwatch",
.has_arg = required_argument,
@@ -442,7 +450,9 @@ static char usage_str[] = \
"\t-r Path to mounted debugfs, defaults to /sys/kernel/debug\n" \
"\t-o File(s) to send output to\n" \
"\t-D Directory to prepend to output file names\n" \
- "\t-k Kill a running trace\n" \
+#if KILL_OPT_ENABLED
+ "\t-k Kill a running trace\n" \
+#endif /* KILL_OPT_ENABLED */
"\t-w Stop after defined time, in seconds\n" \
"\t-a Only trace specified actions. See documentation\n" \
"\t-A Give trace mask as a single value. See documentation\n" \
@@ -2065,9 +2075,11 @@ static int handle_args(int argc, char *a
case 'o':
output_name = optarg;
break;
+#if KILL_OPT_ENABLED
case 'k':
kill_running_trace = 1;
break;
+#endif /* KILL_OPT_ENABLED */
case 'w':
stop_watch = atoi(optarg);
if (stop_watch <= 0) {
--- blktrace.orig/doc/blktrace.8
+++ blktrace/doc/blktrace.8
@@ -66,19 +66,10 @@ blktrace may also be run concurrently wi
.TP 2
\-
The default behaviour for blktrace is to run forever until explicitly
-killed by the user (via a control-C, or kill utility invocation).
-There are two ways to modify this:
-
-.TP 5
- 1.
-You may utilise the blktrace utility itself to kill
-a running trace -- via the \fB\-k\fR option.
-
-.TP 5
- 2.
-You can specify a run-time duration for blktrace via the
-\fB\-w\fR option -- then blktrace will run for the specified number
-of seconds, and then halt.
+killed by the user (via a control-C, or sending SIGINT signal to the
+process via invocation the kill (1) utility). Also you can specify a
+run-time duration for blktrace via the \fB\-w\fR option -- then
+blktrace will run for the specified number of seconds, and then halt.
.SH OPTIONS
@@ -119,13 +110,6 @@ Adds \fIdev\fR as a device to trace
Adds the devices found in \fIfile\fR as devices to trace
.RE
-\-k
-.br
-\-\-kill
-.RS
-Kill on-going trace
-.RE
-
\-n \fInum\-sub\fR
.br
\-\-num\-sub=\fInum-sub\fR
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 4/5] blktrace: disable kill option
2009-12-15 17:48 [patch 4/5] blktrace: disable kill option Edward Shishkin
@ 2010-04-20 7:50 ` Jens Axboe
2010-04-20 13:27 ` Edward Shishkin
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2010-04-20 7:50 UTC (permalink / raw)
To: linux-btrace
On Tue, Dec 15 2009, Edward Shishkin wrote:
>
> Fixup for 513950.
>
> Problem:
> 'blktrace -d <device> -k' does not kill a running
> backgound trace. Executing 'blktrace -d <device> -k'
> for the second time results in "BLKTRACETEARDOWN:
> Invalid argument" message and then each run of
> blktrace on that machine prints the following output:
> BLKTRACESETUP: No such file or directory.
>
> The bug:
> The option -k results in clobbering information
> about running trace by kernel (blk_trace_remove),
> while resources (files open in debugfs by the running
> background blktrace) are not released.
>
> Solution:
> . Disable non-working "kill" option;
> . Update documentation, advise to send SIGINT signal
> via kill(1) to the running background blktrace for
> its correct termination.
Patch does not compile:
gcc -o blktrace.o -c -Wall -O2 -g -W -D_GNU_SOURCE -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITSd blktrace.c
blktrace.c:446: error: stray ?#? in program
blktrace.c:453: error: expected ?,? or ?;? before ?if?
blktrace.c:454: error: stray ?#? in program
make: *** [blktrace.o] Error 1
"\t-D Directory to prepend to output file names\n" \
#if KILL_OPT_ENABLED
"\t-k Kill a running trace\n" \
#endif /* KILL_OPT_ENABLED */
"\t-w Stop after defined time, in seconds\n" \
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 4/5] blktrace: disable kill option
2009-12-15 17:48 [patch 4/5] blktrace: disable kill option Edward Shishkin
2010-04-20 7:50 ` Jens Axboe
@ 2010-04-20 13:27 ` Edward Shishkin
1 sibling, 0 replies; 3+ messages in thread
From: Edward Shishkin @ 2010-04-20 13:27 UTC (permalink / raw)
To: linux-btrace
Jens Axboe wrote:
> On Tue, Dec 15 2009, Edward Shishkin wrote:
>
>
>
>> Fixup for 513950.
>>
>> Problem:
>> 'blktrace -d <device> -k' does not kill a running
>> backgound trace. Executing 'blktrace -d <device> -k'
>> for the second time results in "BLKTRACETEARDOWN:
>> Invalid argument" message and then each run of
>> blktrace on that machine prints the following output:
>> BLKTRACESETUP: No such file or directory.
>>
>> The bug:
>> The option -k results in clobbering information
>> about running trace by kernel (blk_trace_remove),
>> while resources (files open in debugfs by the running
>> background blktrace) are not released.
>>
>> Solution:
>> . Disable non-working "kill" option;
>> . Update documentation, advise to send SIGINT signal
>> via kill(1) to the running background blktrace for
>> its correct termination.
>>
>
> Patch does not compile:
>
> gcc -o blktrace.o -c -Wall -O2 -g -W -D_GNU_SOURCE -D_LARGEFILE_SOURCE
> -D_FILE_OFFSET_BITSd blktrace.c
> blktrace.c:446: error: stray ?#? in program
> blktrace.c:453: error: expected ?,? or ?;? before ?if?
> blktrace.c:454: error: stray ?#? in program
> make: *** [blktrace.o] Error 1
>
>
> "\t-D Directory to prepend to output file names\n" \
> #if KILL_OPT_ENABLED
> "\t-k Kill a running trace\n" \
> #endif /* KILL_OPT_ENABLED */
> "\t-w Stop after defined time, in seconds\n" \
>
oops, sorry: wrong stuff.
I'll resend the correct one.
Edward.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-20 13:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-15 17:48 [patch 4/5] blktrace: disable kill option Edward Shishkin
2010-04-20 7:50 ` Jens Axboe
2010-04-20 13:27 ` Edward Shishkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).