Comment 12 for bug 1429327

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote : Re: ISST-LTE: system drops to initramfs after install on multipath disk

Constraints:
1) Can't count on udev rules to run 'multipath' (see bug 1431650)

Ideas:
0) sleep when there's no scsi_wait_scan module. (below)
1) make sure related SCSI modules are loaded before scsi_complete_async_scans() (drivers/scsi/scsi_scan.c) is called.
2) loop waiting for the number of SCSI disks to settle (maybe check /sys, /dev/, udev info, or something).

Ugly hack for now.. certainly something more elaborate is possible.

multipath-tools:/debian/initramfs/local-top:

  # Sync waiting for storage.
  verbose && log_begin_msg "Waiting for scsi storage"
 -{ rmmod scsi_wait_scan ; modprobe scsi_wait_scan ; rmmod scsi_wait_scan ; } >/dev/null 2>&1
 +# Ugly hack: sleep when scsi_wait_scan is not available (e.g., newer kernels).
 +{ rmmod scsi_wait_scan ; modprobe scsi_wait_scan || sleep 20; rmmod scsi_wait_scan ; } >/dev/null 2>&1
  verbose && log_end_msg

Testing on initramfs (break=top):

 (initramfs) modprobe scsi_wait_scan
 (initramfs) echo $?
 1
 (initramfs) sed 's:modprobe scsi_wait_scan:& || sleep 30:' -i /scripts/local-top/multipath

 (initramfs) exit

 works fine (i.e., as intended :P).