Bug 164197 - dmsetup and lvm2 fail if the listing of dm devices exceeds 16k
dmsetup and lvm2 fail if the listing of dm devices exceeds 16k
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: device-mapper (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Alasdair Kergon
: FutureFeature
: 164198 166956 (view as bug list)
Depends On:
Blocks: 168429 MPIOU3Proposed
  Show dependency treegraph
Reported: 2005-07-25 17:15 EDT by AJ Lewis
Modified: 2010-01-11 21:15 EST (History)
11 users (show)

See Also:
Fixed In Version: RHBA-2006-0099
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-03-07 13:38:58 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description AJ Lewis 2005-07-25 17:15:34 EDT
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
# dmsetup ls
No devices found
# dmsetup table
No devices found

# 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 14:06:53 EDT
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 14:34:05 EDT
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 15:19:05 EDT
*** Bug 164198 has been marked as a duplicate of this bug. ***
Comment 5 Alasdair Kergon 2005-08-08 15:34:12 EDT
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 14:13:36 EDT
*** Bug 166956 has been marked as a duplicate of this bug. ***
Comment 7 Alasdair Kergon 2005-09-20 10:53:22 EDT
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 14:04:16 EDT
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 13:38:58 EST
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.

Comment 20 Issue Tracker 2007-06-19 10:07:42 EDT
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

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