Bug 164197

Summary: dmsetup and lvm2 fail if the listing of dm devices exceeds 16k
Product: Red Hat Enterprise Linux 4 Reporter: AJ Lewis <157070.alewis>
Component: device-mapperAssignee: Alasdair Kergon <agk>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: agk, christophe.varoqui, cmarthal, dmo, egoggin, jbrassow, jgaertne, lmb, nobody+wcheng, rkenna, tranlan
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2006-0099 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-07 18:38:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 168429, 171044    

Description AJ Lewis 2005-07-25 21:15:34 UTC
Description of problem:
dmsetup refuses to show information about *any* dm devices if there are more
than 599 dm devices.

Version-Release number of selected component (if applicable):
Current device-mapper cvs
# dmsetup version
Library version:   1.01.03-cvs (2005-06-13)
Driver version:    4.3.0

Also tried it with a build from May sometime.

How reproducible:
Every time

Steps to Reproduce:
1. I have 2 dm devices on my system to start:
# dmsetup table
VolGroup00-LogVol01: 0 2097152 linear 3:2 384
VolGroup00-LogVol00: 0 75825152 linear 3:2 2097536

so I ran:
# for v in `seq 0 598`; do echo $v; b=$(( $v - 1 )); echo 0 1 linear /dev/sda7
$b | dmsetup create dev-$v; done
2. 
# dmsetup ls
No devices found
# dmsetup table
No devices found

3. 
# dmsetup remove dev-598
# dmsetup table
dev-583: 0 1 linear 8:7 582
dev-448: 0 1 linear 8:7 447
dev-433: 0 1 linear 8:7 432
dev-279: 0 1 linear 8:7 278
dev-264: 0 1 linear 8:7 263
dev-129: 0 1 linear 8:7 128
.
.
.
dev-78: 0 1 linear 8:7 77
dev-63: 0 1 linear 8:7 62


  
Actual results:
Unable to query about dm devices after 600 or more are created

Expected results:
Info about the devices visible

Additional info:
I am able to remove devices and as soon as i get down below the 600th created, i
can see them again.  However, if I remove from the first dm devices i created,
it doesn't help.  Perhaps it's something with the major/minor number?

Comment 1 Alasdair Kergon 2005-08-08 18:06:53 UTC
Is it wanting to return more than 16k of information?
The buffer used for the request is also used to return the information.
Currently you only get a bigger return buffer if you needed a bigger query buffer.
(There's a FIXME in libdevmapper: if the buffer was too small, depending on the
cmd issued, it may need to increase the buffer size and do an additional ioctl.)

Comment 2 Alasdair Kergon 2005-08-08 18:34:05 UTC
Yes, that's the problem.

This works:
  for i in x{0..673}; do dmsetup create --notable $i; done; dmsetup ls
but with 674 it fails.

  Warning: libdevmapper buffer too small for data
  No devices found

That warning message only got added for ioctl v1 not v4.

Comment 4 Alasdair Kergon 2005-08-08 19:19:05 UTC
*** Bug 164198 has been marked as a duplicate of this bug. ***

Comment 5 Alasdair Kergon 2005-08-08 19:34:12 UTC
Two basic changes needed:

  (1) If the ioctl set DM_BUFFER_FULL_FLAG, then double the buffer size and
issue an appropriate query (ls/info/deps/status/table) according to what the
original command was (e.g. if set by a create, run an info);

  (2) Remember any increased buffer size, and use it as the new minimum for
future similar calls made by the library.


Comment 6 Alasdair Kergon 2005-08-30 18:13:36 UTC
*** Bug 166956 has been marked as a duplicate of this bug. ***

Comment 7 Alasdair Kergon 2005-09-20 14:53:22 UTC
Full analysis showed for (1) showed that only a few ioctls can set
DM_BUFFER_FULL_FLAG and it's always OK to repeat them with the same parameters.
 Fixed this upstream.


Comment 8 Alasdair Kergon 2005-09-20 18:04:16 UTC
And dealt with (2), but globally for now: uses larger buffer for all subsequent
ioctls, not just similar ones.

Comment 18 Red Hat Bugzilla 2006-03-07 18:38:58 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2006-0099.html


Comment 20 Issue Tracker 2007-06-19 14:07:42 UTC
Closing it.

Internal Status set to 'Resolved'
Status set to: Closed by Tech
Resolution set to: 'RHEL 4.5'

This event sent from IssueTracker by racedo 
 issue 82083