RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1263189 - blktrace gets stuck after a trace-file is replaced by a directory of the same name
Summary: blktrace gets stuck after a trace-file is replaced by a directory of the same...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: blktrace
Version: 7.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Eric Sandeen
QA Contact: Karel Srot
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-09-15 09:44 UTC by Milos Malik
Modified: 2016-11-04 07:41 UTC (History)
1 user (show)

Fixed In Version: blktrace-1.0.5-8.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-04 07:41:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2499 0 normal SHIPPED_LIVE blktrace bug fix update 2016-11-03 14:12:08 UTC

Description Milos Malik 2015-09-15 09:44:37 UTC
Description of problem:

Version-Release number of selected component (if applicable):
blktrace-1.0.5-6.el7
kernel-3.10.0-315.el7

How reproducible:
always

Steps to Reproduce:
# cat /proc/partitions 
major minor  #blocks  name

   8        0  117220824 sda
   8        1     204800 sda1
   8        2     512000 sda2
   8        3  116502528 sda3
 253        0   52428800 dm-0
 253        1   11722752 dm-1
 253        2   52285440 dm-2
# blktrace -d /dev/sda -w 5
=== sda ===
  CPU  0:                    0 events,        0 KiB data
  CPU  1:                    0 events,        0 KiB data
  CPU  2:                    0 events,        0 KiB data
  CPU  3:                    0 events,        0 KiB data
  CPU  4:                    0 events,        0 KiB data
  CPU  5:                    1 events,        1 KiB data
  CPU  6:                    0 events,        0 KiB data
  CPU  7:                    0 events,        0 KiB data
  Total:                     1 events (dropped 0),        1 KiB data
# ls -l *.blktrace.*
-rw-r--r--. 1 root root  0 Sep 15 05:31 sda.blktrace.0
-rw-r--r--. 1 root root  0 Sep 15 05:31 sda.blktrace.1
-rw-r--r--. 1 root root  0 Sep 15 05:31 sda.blktrace.2
-rw-r--r--. 1 root root  0 Sep 15 05:31 sda.blktrace.3
-rw-r--r--. 1 root root  0 Sep 15 05:31 sda.blktrace.4
-rw-r--r--. 1 root root 56 Sep 15 05:31 sda.blktrace.5
-rw-r--r--. 1 root root  0 Sep 15 05:31 sda.blktrace.6
-rw-r--r--. 1 root root  0 Sep 15 05:31 sda.blktrace.7
# rm -f *.blktrace.1
# mkdir sda.blktrace.1
# blktrace -d /dev/sda -w 5
Open output file ./sda.blktrace.1 failed: 21/Is a directory
FAILED to start thread on CPU 1: 1/Operation not permitted

Actual results:
x86_64, s390x - the blktrace process terminates almost immediately
ppc64, ppc64le, aarch64 - the blktrace process gets stuck forever (CTRL+C does not interrupt it)

Expected results:
 * the blktrace process terminates almost immediately on all architectures

Comment 2 Eric Sandeen 2016-05-19 16:39:22 UTC
Fixed up by upstream commit

commit 838361c6cfb1319eadd59daaf9074dcdb92746e6
Author: Robert Schiele <rschiele>
Date:   Mon Sep 8 09:38:52 2014 +0200

    signal condition variable at end of stop_tracers
    
    stop_tracers modifies tp->is_done and thus must signal the condition
    variable tracer_wait_unblock is waiting on to monitor tp->is_done.
    Not doing so might cause the tool to deadlock if stop_tracers is
    called while a tracer thread is in tracer_wait_unblock.
    
    Signed-off-by: Robert Schiele <rschiele>
    Signed-off-by: Jens Axboe <axboe>

It's a one-liner :)

Comment 4 Karel Srot 2016-06-29 07:25:01 UTC
Hi Eric,
I have encountered following behaviour during the testing on non-intel architectures:

1. have the bogus blktrace version installed
2. run the reproducer for this bug (the blktrace would stuck and would have to be killed as reported in #c0)
3. run blktrace command again and it will fail with:

BLKTRACESETUP(2) /dev/vda2 failed: 2/No such file or directory
Thread 0 failed open /sys/kernel/debug/block/(null)/trace0: 2/No such file or directory
Thread 1 failed open /sys/kernel/debug/block/(null)/trace1: 2/No such file or directory
FAILED to start thread on CPU 0: 1/Operation not permitted
FAILED to start thread on CPU 1: 1/Operation not permitted

4. another blktrace command would succeed.

It seems that after killing blktrace there were some remaining "locks" in place that prevented next blktrace to run properly but the same unsuccessful execution had removed these "locks".

I am just curious whether this is something expected.

Comment 5 Eric Sandeen 2016-06-29 14:27:17 UTC
Karel, that's only with the old version, right?

Yes, I think that when it fails, it leaves the kernel in an inconsistent state; then the next run fails due to the inconsistency but cleans up correctly, which makes it all consistent again.

I think I have seen this as well; I would need to dig into it a bit more to get the exact sequence of what happens.

Comment 6 Karel Srot 2016-06-29 14:47:51 UTC
(In reply to Eric Sandeen from comment #5)
> Karel, that's only with the old version, right?

Well, yes and no. As the new version has fixed the bug and doesn't stuck I don't need to kill it. 
OTOH, I could reproduce it artificially even with the new version using

# blktrace -d /dev/vda2 -w 30 &
[1] 1280
# kill -9 1280
# 
[1]+  Killed                  blktrace -d /dev/vda2 -w 30
# 
# blktrace -d /dev/vda2 -w 5 
BLKTRACESETUP(2) /dev/vda2 failed: 2/No such file or directory
Thread 0 failed open /sys/kernel/debug/block/(null)/trace0: 2/No such file or directory
FAILED to start thread on CPU 0: 1/Operation not permitted
# 
# blktrace -d /dev/vda2 -w 5 
=== vda2 ===
  CPU  0:                   32 events,        2 KiB data
  Total:                    32 events (dropped 0),        2 KiB data

Just to clarify, I consider the bug to be successfully fixed. I was just curious what is going on here. Maybe blktrace could be updated to do the "cleanup" on start - that would be clearly a new bug/rfe report and maybe not trivial to implement.

Comment 10 errata-xmlrpc 2016-11-04 07:41:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2499.html


Note You need to log in before you can comment on or make changes to this bug.