Bug 214905 - [RHEL5 Beta2] device-mapper: /sys/block/dm-* remain after successful 'dmsetup remove_all'.
Summary: [RHEL5 Beta2] device-mapper: /sys/block/dm-* remain after successful 'dmsetup...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel
Version: 5.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Milan Broz
QA Contact: Corey Marthaler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-11-09 22:11 UTC by Kiyoshi Ueda
Modified: 2013-03-01 04:04 UTC (History)
16 users (show)

Fixed In Version: beta2
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-12-23 02:25:48 UTC
Target Upstream Version:
Embargoed:


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

Description Kiyoshi Ueda 2006-11-09 22:11:58 UTC
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:
device-mapper-1.02.12-2.el5
kernel-2.6.18-1.2745.el5


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: Start TRIAL 0
INFO: Creating linear maps. nr_map=100
INFO: Removing all maps.
INFO: Start TRIAL 1
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
/sys/block/dm-21/holders:

/sys/block/dm-60/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 22:11:58 UTC
Created attachment 140846 [details]
Test script

Comment 2 RHEL Program Management 2006-11-10 20:40:30 UTC
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
inclusion.

Comment 3 Bryn M. Reeves 2006-11-10 20:43:21 UTC
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>
Cc: dm-devel

Comment 7 Don Zickus 2006-11-29 21:49:23 UTC
in 2.6.18-1.2767.el5

Comment 8 RHEL Program Management 2006-12-23 02:25:48 UTC
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.