* [PATCH] tracing/blktrace: Fix to allow setting same value
@ 2018-08-16 20:08 Steven Rostedt
2018-08-16 20:14 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2018-08-16 20:08 UTC (permalink / raw)
To: LKML; +Cc: Jens Axboe, linux-block, Masami Hiramatsu
[
Jens, you want to take this one, or do you want me to?
]
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Masami Hiramatsu reported:
Current trace-enable attribute in sysfs returns an error
if user writes the same setting value as current one,
e.g.
# cat /sys/block/sda/trace/enable
0
# echo 0 > /sys/block/sda/trace/enable
bash: echo: write error: Invalid argument
# echo 1 > /sys/block/sda/trace/enable
# echo 1 > /sys/block/sda/trace/enable
bash: echo: write error: Device or resource busy
But this is not a preferred behavior, it should ignore
if new setting is same as current one. This fixes the
problem as below.
# cat /sys/block/sda/trace/enable
0
# echo 0 > /sys/block/sda/trace/enable
# echo 1 > /sys/block/sda/trace/enable
# echo 1 > /sys/block/sda/trace/enable
Link: http://lkml.kernel.org/r/20180816103802.08678002@gandalf.local.home
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Cc: stable@vger.kernel.org
Fixes: cd649b8bb830d ("blktrace: remove sysfs_blk_trace_enable_show/store()")
Reported-by: Masami Hiramatsu <mhiramat@kernel.org>
Tested-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
kernel/trace/blktrace.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index b82e546083e1..614b5f0decd6 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1829,6 +1829,10 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev,
mutex_lock(&q->blk_trace_mutex);
if (attr == &dev_attr_enable) {
+ if (!!value == !!q->blk_trace) {
+ ret = 0;
+ goto out_unlock_bdev;
+ }
if (value)
ret = blk_trace_setup_queue(q, bdev);
else
--
2.13.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tracing/blktrace: Fix to allow setting same value
2018-08-16 20:08 [PATCH] tracing/blktrace: Fix to allow setting same value Steven Rostedt
@ 2018-08-16 20:14 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2018-08-16 20:14 UTC (permalink / raw)
To: Steven Rostedt, LKML; +Cc: linux-block, Masami Hiramatsu
On 8/16/18 2:08 PM, Steven Rostedt wrote:
> [
> Jens, you want to take this one, or do you want me to?
> ]
I can queue it up - done. Thanks!
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-16 20:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-16 20:08 [PATCH] tracing/blktrace: Fix to allow setting same value Steven Rostedt
2018-08-16 20:14 ` Jens Axboe
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).