lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <466E9433.7090506@redhat.com>
Date:	Tue, 12 Jun 2007 13:40:19 +0100
From:	"Richard W.M. Jones" <rjones@...hat.com>
To:	linux-kernel@...r.kernel.org
Subject: [PATCH] blkdev_wait_scan module to help initrd scripts

Why this is needed
------------------

During initrd scripts we load block device modules which asynchronously 
perform partition scans.  These partition checks must have been 
completed before later parts of the scripts run (in particular, vgscan).

Under load, especially for virtual machines, the partition scans aren't 
completed in time and consequently vgscan doesn't find the volume group 
containing root, and the virtual machine fails to boot.

More detail:
   http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=241793#c15

scsi_wait_scan
--------------

SCSI devices have a similar problem.  This is solved by scsi_wait_scan, 
a sort of virtual module which is loaded into the kernel and 
synchronously waits for all SCSI buses to be scanned (it is then 
unloaded right afterwards).  This has been in the kernel since late last 
year.

How it works
------------

I've added a list of block devices which are being scanned for 
partitions (rescan_bdevs).  Function rescan_partitions is modified so 
that during the scan it puts the block device on this list, and takes it 
off after the scan is completed.

I added a function rescan_partitions_wait which checks this list, and 
while it is non-empty, waits for the scan on the first block device on 
the list to complete (and repeats, if necessary, until the list is empty).

The module (blkdev_scan_wait.ko) just calls rescan_partitions_wait 
during its init function.

How to test
-----------

Copy the built module into /lib of an initrd image.  Modify /init so 
that it does:

   echo Wait for partition scans to complete
   insmod /lib/blkdev_wait_scan.ko
   rmmod blkdev_wait_scan
   mkblkdevs

after block devs are loaded but before vgscan is run.

Boot it under load (eg. as a Xen guest with lots of guests starting at 
once or something else stressing the disk).  Logs will look something 
like this (my annotations added):

Registering block device major 202
xvda:Loading dm-mod.ko module        <-- partition scan starts
<6>device-mapper: ioctl: 4.11.0-ioctl (2006-10-12) initialised: 
dm-devel@...hat.com
Loading dm-mirror.ko module
Loading dm-zero.ko module
Loading dm-snapshot.ko module
Making device-mapper control node
Wait for partition scans to complete
  xvda1 xvda2           <---- partition scan completes
Scanning logical volumes   <---- vgscan starts
   Reading all physical volumes.  This may take a while...
   Found volume group "VolGroup00" using metadata type lvm2

-----

Signed-off-by: Richard Jones <rjones@...hat.com>

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903

View attachment "0001-Added-blkdev_wait_scan-version-2.patch" of type "text/x-patch" (7033 bytes)

Download attachment "smime.p7s" of type "application/x-pkcs7-signature" (3237 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ