Bug 485895

Summary: PATCH: fix various issues with rc.sysinit dmraid handling
Product: [Fedora] Fedora Reporter: Hans de Goede <hdegoede>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: notting, rvokal
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-03-04 22:53: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:
Attachments:
Description Flags
PATCH: fix various issues with rc.sysinit dmraid handling none

Description Hans de Goede 2009-02-17 10:09:48 UTC
Created attachment 332206 [details]
PATCH: fix various issues with rc.sysinit dmraid handling

Hi,

I've been doing a lot of work on mkinitrd's dmraid support lately some of the lessons learned there also apply to the activation of (not used for /) dmraid arrays in rc.sysinit, this will esp. help the livecd proerly activating and using dmraid sets.

The patch fixes the following issues:

1) rc.sysinit (and mkinitrd used to) calls dm_resolve_name() on the output of
dmraid, this is not necessary as dm_resolve_name is only needed when the name
is /dev/dm-#, it is actually harmful as dm_resolve_name sometimes fails when
used like this, causing us to fail to activate dmraid sets

2) rc.sysinit does not remove the partitions from the raw disks used in a
raidset the initrd used to use special nash functionality to tell the kernels
to forget about the partitions of the raw disks it had scanned at boot. The 
issue here is, say we have a mirror of sda and sdb, and that mirror has 2 
partitions. Then the kernel when scanning the raw disks will find 
sda1,sda2,sdb1,sdb2. But we do not want anything using those, they should use
the devicemapper versions as those are mirrored! I've even seen mounting by 
LABEL / UUID do the wrong thing by using the raw partitions instead of the 
raidset partitions.

I've recently done a patch to dmraid adding a --rm_partitions cmdline option
which makes dmraid do the ioctl which makes the kernel forget about the partitions of the rawdisk (which in turn makes udev remove the device nodes).
This way we no longer need the nash magic.

Part of my rc.sysinit patch is adding --rm_partitions to the dmraid invocation

3) rc.sysinit uses dmraid -p, which tells dmraid to not setup device maps for the partitions of the raidset and then kalls kpartx to setup the device maps for the partitions. This can be simplified by removing the -p argument to dmraid

4) with all these changes in place there is no longer a reason to loop, a single dmraid invocation is enough.


p.s.

AFAIK with this patch the last user of dm_resolve_name is gone, so that function can be removed. Better check twice though.

Comment 1 Bill Nottingham 2009-02-17 16:40:31 UTC
The change for #3 will change the device name, won't it? (By calling kpartx explicitly, we always use 'p' as the delimiter; if it's implicit, that doesn't happen.)

Comment 2 Hans de Goede 2009-02-18 21:11:44 UTC
(In reply to comment #1)
> The change for #3 will change the device name, won't it? (By calling kpartx
> explicitly, we always use 'p' as the delimiter; if it's implicit, that doesn't
> happen.)

p is the default delimiter, so there will be no device name change.

Also I just learned of another bug this patch fixes when you have dmraid1+0, kpartx now also will get run on the 2 striped sets which are (hidden) parts of the mirror, so now we have each partition 3 times all of a sudden, causing lvm to complain about duplicate PV's

Comment 3 Bill Nottingham 2009-02-18 21:13:19 UTC
So, that confuses me, as I've recieved bugs that claim that our passing of '-p p' to kpartx changes the device name from (very) old releases.

Comment 4 Hans de Goede 2009-02-18 21:22:13 UTC
(In reply to comment #3)
> So, that confuses me, as I've recieved bugs that claim that our passing of '-p
> p' to kpartx changes the device name from (very) old releases.

To be clear using 'p' as the delimiter is the default when letting dmraid create the partitions itself. I don't know what kpartx default behaviour is.

Comment 5 Hans de Goede 2009-02-24 21:41:51 UTC
Bill, can we get this applied please? This is causing real issues with nested dmraid sets (mirror on striping also know as raid 10), as it causes us to activate the partitions on the 2 stripesets which make up the mirror to, causing us to end with each partition 3 times confusing the hell out of lvm and mount by UUID.

Comment 6 Bill Nottingham 2009-03-04 22:53:34 UTC
http://git.fedorahosted.org/git/?p=initscripts.git;a=commitdiff;h=bcb7572fe42c8efb712e5124f25935568c951103

Perhaps I should have trimmed the changelog.