Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 354021 - sys-fs/lvm2: lvm-start does unnecessary steps.
Summary: sys-fs/lvm2: lvm-start does unnecessary steps.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 409921
  Show dependency tree
 
Reported: 2011-02-07 21:05 UTC by Xake
Modified: 2012-04-04 17:06 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xake 2011-02-07 21:05:02 UTC
I asked around about the usage and requirement of the *scan-commandos. According to the ones on the lvm-mailinglist pvscan and vgscan only has meaning if /etc/lvm/cache needs to be updated, however if /etc is mounted readonly said update cannot occur, and thus at least the pvscan in /lib/rcscripts/lvm-start is unecessary. The only need for vgscan as such seems to be needed if the interaction between your initramfs/initrd and system is broken in such ways that the dev-nodes are not moved from the initramfs/initrd to the real root (genkernel are being worked on to handle this, but is currently broken). In those cases --mknodes are needed to recreate those nodes.

Also, the execution of the lvm commands is much faster if we launch them as a lvm-script, since lvm2 in those cases caches steps between commands, and thus does not redo things from the vgscan-step in the vgchange-step.

As such I suggest the following:
1. Drop pvscan from /lib/rcscripts/addons/lvm-start
2. Make that script run the lvm commands as a lvm-command, i.e.:

lvm_commands="#! /bin/lvm"
lvm_commands="${lvm_commands}\nvgscan --mknodes"
lvm_commands="${lvm_commands}\nvgchange -ay --sysinit"
printf "%b\n" "${lvm_commands}" | /bin/lvm /proc/self/fd/0

In the previous command, the /proc* thing is needed because if lvm is compiled without readline it does not read from a pipe, only from a file, and stdin seems to work fine.

Even if we run all three steps (i.e. pvscan, vgscan and vgchange) it is still more then twice as fast running the commands in lvm instead of each step alone, so that change I think should be made even if there is a reason to hold pvscan.
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2012-03-27 03:21:14 UTC
InCVS.

I've kept the pvscan, because I've seen cases in the past where the vgscan after it didn't pick up devices.