Bug 214905 - [RHEL5 Beta2] device-mapper: /sys/block/dm-* remain after successful 'dmsetup remove_all'.
[RHEL5 Beta2] device-mapper: /sys/block/dm-* remain after successful 'dmsetup...
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Milan Broz
Corey Marthaler
Depends On:
  Show dependency treegraph
Reported: 2006-11-09 17:11 EST by Kiyoshi Ueda
Modified: 2013-02-28 23:04 EST (History)
16 users (show)

See Also:
Fixed In Version: beta2
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-12-22 21:25:48 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Test script (1.42 KB, text/plain)
2006-11-09 17:11 EST, Kiyoshi Ueda
no flags Details
FIx find_device race (465 bytes, patch)
2006-11-10 15:43 EST, Bryn M. Reeves
no flags Details | Diff

  None (edit)
Description Kiyoshi Ueda 2006-11-09 17:11:58 EST
Description of problem:
When 'dmsetup remove_all' is executed in an environment that
many maps exist, some /sys/block/dm-* remain even though
those devices aren't used and all maps are removed.

Version-Release number of selected component:

How reproducible:
Almost always in many maps environment on a specific system.
But very rare on other systems.

Steps to Reproduce:
 1. Run attached script.
      # ./dmsetup-remove-all-fail.sh

 The attached script do the following:
    o Create a file and setup a loop-back device by using the file
    o Run 100 linear maps creation with using the loop-back device,
      'sleep 3' and 'dmsetup remove_all' repeatedly.
    o The test stops when the problem occurs or after 1000 trials.

Actual results:
The script stops with 'Exit test.' message below.
At the time, /sys/block/dm-* remain.
[root@nec-em4 ~]# ./dmsetup-remove-all-fail.sh
INFO: Creating a file for loop setup. file=tmpfile
100+0 records in
100+0 records out
51200 bytes (51 kB) copied, 0.000862744 seconds, 59.3 MB/s
INFO: Setting up loop device. dev=/dev/loop0 file=tmpfile
INFO: Start map create/remove testing.
INFO: Test stops when a problem occurs or after 1000 trials.
INFO: Creating linear maps. nr_map=100
INFO: Removing all maps.
INFO: Creating linear maps. nr_map=100
INFO: Removing all maps.
ERROR: The problem occurs. Exit test.
INFO: Manual clean-up is needed.
[root@nec-em4 ~]# dmsetup ls
No devices found
[root@nec-em4 ~]# ls /sys/block/
dm-21  hda    loop2  loop5  md0   ram10  ram13  ram2  ram5  ram8  sdb
dm-60  loop0  loop3  loop6  ram0  ram11  ram14  ram3  ram6  ram9  sdc
fd0    loop1  loop4  loop7  ram1  ram12  ram15  ram4  ram7  sda   sdd
[root@nec-em4 ~]# ls /sys/block/dm-*/holders

[root@nec-em4 ~]#

Expected results:
The script finishes with 'INFO: Test finished with no problem.' message.

Additional info:
This problem doesn't occur in RHEL4 U4.
This problem seems to be prone not to occur in a few maps environment.
This problem often occurs on the NEC Express5800 110Ej in Westford,
but very rare on other systems.
Comment 1 Kiyoshi Ueda 2006-11-09 17:11:58 EST
Created attachment 140846 [details]
Test script
Comment 2 RHEL Product and Program Management 2006-11-10 15:40:30 EST
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
Comment 3 Bryn M. Reeves 2006-11-10 15:43:21 EST
Created attachment 140935 [details]
FIx find_device race

Original header:

There is a race between dev_create() and find_device().

If the mdptr has not yet been stored against a device,
find_device() needs to behave as though no device was
found.	It already returns NULL, but there is a dm_put()
missing: it must drop the reference dm_get_md() took.

The bug was introduced by dm-fix-mapped-device-ref-counting.patch.

It manifests itself if another dm ioctl attempts to reference a
newly-created device while the device creation ioctl is still running.
The consequence is that the device cannot be removed until the machine
is rebooted.  Certain udev configurations can lead to this happening.

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Cc: dm-devel@redhat.com
Comment 7 Don Zickus 2006-11-29 16:49:23 EST
in 2.6.18-1.2767.el5
Comment 8 RHEL Product and Program Management 2006-12-22 21:25:48 EST
A package has been built which should help the problem described in 
this bug report. This report is therefore being closed with a resolution 
of CURRENTRELEASE. You may reopen this bug report if the solution does 
not work for you.

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