Bug 204992

Summary: snapshot attempt will fail if requested minor is already in use
Product: Red Hat Enterprise Linux 4 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: Milan Broz <mbroz>
Status: CLOSED ERRATA QA Contact: Corey Marthaler <cmarthal>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4CC: agk, dwysocha, mbroz, pvrabec
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-18 20:10:34 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:

Description Corey Marthaler 2006-09-01 21:28:19 UTC
Description of problem:
[root@taft-04 ~]# lvcreate -n snap10 -My --major 200 --minor 75 -L 50M -s
/dev/snapper/origin
  Rounding up size to full physical extent 52.00 MB
  Logical volume "snap10" created

[root@taft-04 ~]# dmsetup info -c
Name             Maj Min Stat Open Targ Event  UUID
snapper-snap10   253   4 L--w    0    1      0
LVM-Spo3CrJmpzevPFq2L7Pp3ns8R00FemmBFfzUpyTp1rA5Ibi7PSrzod0XiLecxvR5
snapper-origin-real 253   2 L--w    2    1      0
LVM-Spo3CrJmpzevPFq2L7Pp3ns8R00FemmBHouLln48K5ddi5v9fOialBRMD1Lkb4VG-real
VolGroup00-LogVol01 253   1 L--w    1    1      0
LVM-zUByyTfjW0kZbVav84sw7MJSW2JYnqw5UsN964on4p3rGGX2nMO3T4sYHE3TnkhP
VolGroup00-LogVol00 253   0 L--w    1    1      0
LVM-zUByyTfjW0kZbVav84sw7MJSW2JYnqw5ic586KqB9N623SZmXmWa54kFJ3nZM693
snapper-origin   253   3 L--w    0    1      0
LVM-Spo3CrJmpzevPFq2L7Pp3ns8R00FemmBHouLln48K5ddi5v9fOialBRMD1Lkb4VG
snapper-snap10-cow 253  75 L--w    1    1      0
LVM-Spo3CrJmpzevPFq2L7Pp3ns8R00FemmBFfzUpyTp1rA5Ibi7PSrzod0XiLecxvR5-cow

[root@taft-04 ~]# lvcreate -n snap11 -My --major 200 --minor 75 -L 50M -s
/dev/snapper/origin
  Rounding up size to full physical extent 52.00 MB
  device-mapper: create ioctl failed: No such device or address
  device-mapper: reload ioctl failed: No such device or address
  Failed to suspend origin origin

# Seems to work just fine if you're creating a linear
[root@taft-04 ~]# lvcreate -n linear -My --major 200 --minor 75 -L 50M snapper
  Rounding up size to full physical extent 52.00 MB
  Logical volume "linear" created

[root@taft-04 ~]# dmsetup info -c
Name             Maj Min Stat Open Targ Event  UUID
snapper-snap11   253   5 ---w    0    0      0
LVM-Spo3CrJmpzevPFq2L7Pp3ns8R00FemmBgCBEnxZsGm5t9PFXW7lAQJfRdRWsZqtP
snapper-snap10   253   4 L--w    0    1      0
LVM-Spo3CrJmpzevPFq2L7Pp3ns8R00FemmBFfzUpyTp1rA5Ibi7PSrzod0XiLecxvR5
snapper-linear   253   6 L--w    0    1      0
LVM-Spo3CrJmpzevPFq2L7Pp3ns8R00FemmBtd8i3ZAtjSVtHcSVYD89itti61ChA6vK
snapper-origin-real 253   2 L--w    2    1      0
LVM-Spo3CrJmpzevPFq2L7Pp3ns8R00FemmBHouLln48K5ddi5v9fOialBRMD1Lkb4VG-real
VolGroup00-LogVol01 253   1 L--w    1    1      0
LVM-zUByyTfjW0kZbVav84sw7MJSW2JYnqw5UsN964on4p3rGGX2nMO3T4sYHE3TnkhP
VolGroup00-LogVol00 253   0 L--w    1    1      0
LVM-zUByyTfjW0kZbVav84sw7MJSW2JYnqw5ic586KqB9N623SZmXmWa54kFJ3nZM693
snapper-origin   253   3 L--w    0    1      0
LVM-Spo3CrJmpzevPFq2L7Pp3ns8R00FemmBHouLln48K5ddi5v9fOialBRMD1Lkb4VG
snapper-snap10-cow 253  75 L--w    1    1      0
LVM-Spo3CrJmpzevPFq2L7Pp3ns8R00FemmBFfzUpyTp1rA5Ibi7PSrzod0XiLecxvR5-cow


# Try again with an strace 
[root@taft-04 ~]# strace -e trace=mknod lvcreate -n snap12 -My --major 200
--minor 75 -L 50M -s /dev/snapper/origin

  Rounding up size to full physical extent 52.00 MB
mknod("/dev/mapper/snapper-snap12", S_IFBLK|0660, makedev(253, 7)) = 0
  device-mapper: create ioctl failed: No such device or address
  device-mapper: reload ioctl failed: No such device or address
  Failed to suspend origin origin
mknod("/dev/mapper/snapper-snap12", S_IFBLK|0660, makedev(253, 7)) = 0
Process 4895 detached


# mknod doesn't seem to care if they're already in use
[root@taft-03 lvm]# mknod /tmp/FOO b 255 100
[root@taft-03 lvm]# ls -lrt /tmp
total 0
brw-r--r--  1 root root 255, 100 Sep  1 10:15 FOO
[root@taft-03 lvm]# mknod /tmp/GLARCH b 255 100
[root@taft-03 lvm]# ls -lrt /tmp
total 0
brw-r--r--  1 root root 255, 100 Sep  1 10:15 FOO
brw-r--r--  1 root root 255, 100 Sep  1 10:15 GLARCH



Version-Release number of selected component (if applicable):
[root@taft-04 ~]# uname -ar
Linux taft-04 2.6.9-42.0.1.ELlargesmp #1 SMP Fri Aug 4 13:04:33 EDT 2006 x86_64
x86_64 x86_64 GNU/Linux
[root@taft-04 ~]# rpm -q lvm2
lvm2-2.02.06-6.0.RHEL4
[root@taft-04 ~]# rpm -q device-mapper
device-mapper-1.02.07-4.0.RHEL4






How reproducible:
everytime

Comment 3 RHEL Program Management 2007-05-09 09:44:24 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 4 Suzanne Logcher 2007-09-17 20:04:59 UTC
This request was previously evaluated by Red Hat Product Management
for inclusion in the current Red Hat Enterprise Linux release, but
Red Hat was unable to resolve it in time.  This request will be
reviewed for a future Red Hat Enterprise Linux release.

Comment 6 RHEL Program Management 2008-09-05 17:19:15 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 7 Alasdair Kergon 2008-09-23 19:43:17 UTC
Only just noticed this one - fascinating.  This problem might date back to the rewrite of the activation code! Should be straightforward to fix.

Comment 8 Alasdair Kergon 2008-09-23 19:52:06 UTC
Note that the problem is *not* just what it says - the first command in the example is going wrong, assigning the minor number to the cow instead of the final top-level device - because of the way we store the metadata the activation code has to move the device number across internally.

This one:
  snapper-snap10   253   4 L--w    0    1      0
should be 253:75.

For the second command, the code should probably check for conflicts when the device node is added to the tree.

Comment 9 Milan Broz 2008-12-19 15:39:20 UTC
Fixed upstream in lvm2 2.02.44.

Comment 11 Milan Broz 2009-01-15 18:37:24 UTC
In lvm2-2.02.42-2.el4.

Comment 15 Milan Broz 2009-02-20 14:13:04 UTC
And fix (together with fix for bug 480838) in lvm2-2.02.42-3.el4.

Comment 17 Corey Marthaler 2009-04-20 20:00:18 UTC
Fix verified in lvm2-2.02.42-5.el4:

[root@hayes-01 ~]# lvcreate -n snap11 -My --major 200 --minor 75 -L 50M -s /dev/grant/origin 
  Rounding up size to full physical extent 52.00 MB
  The requested major:minor pair (200:75) is already used
  Aborting. Failed to activate snapshot exception store.

Comment 19 errata-xmlrpc 2009-05-18 20:10:34 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 therefore 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-2009-0967.html