Bug 1389554

Summary: dracut fails to insert mlx4_en module in initramfs for kernel-rt
Product: Red Hat Enterprise Linux 6 Reporter: João Avelino Bellomo Filho <jbellomo>
Component: rdmaAssignee: Jarod Wilson <jarod>
Status: CLOSED ERRATA QA Contact: Mike Stowell <mstowell>
Severity: low Docs Contact:
Priority: high    
Version: 6.8CC: bhu, daolivei, ddutile, dledford, dracut-maint-list, jarod, jshortt, lgoncalv, lnykryn, mstowell, salmy, williams
Target Milestone: betaKeywords: Regression, ZStream
Target Release: 6.9   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rdma-6.9_4.1-3.el6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1401858 (view as bug list) Environment:
Last Closed: 2017-03-21 10:44:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1346447, 1401858    

Description João Avelino Bellomo Filho 2016-10-27 21:07:33 UTC
Description of problem:

The dracut scripts fail to insert the mlx4_en module in iniramfs file when the kernel is a 3.10 kernel-rt.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Install a normal RHEL 6.8 system and register it:

subscription-manager register --auto-attach

2. Install a 3.10 kernel-rt support, for example:

yum -y --enablerepo rhel-6-server-realtime-rpms groupinstall "MRG Realtime"

3. Check if the 'mlx4_en.ko' file is on initramfs file:

# lsinitrd /boot/initramfs-3.10.*.img | grep mlx4_en

Actual results:

An empty line.

Expected results:

-rwxr--r--. 1 root root 164080 Oct 21 01:47 /lib/modules/3.10.0-327.rt56.198.el6rt.x86_64/kernel/drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko

Additional info:

The 'mlx4_en.ko' file is on initramfs file of the 2.6 kernel:

# lsinitrd /boot/initramfs-2.6.*.img | grep mlx4_en
-rwxr--r--   1 root     root       165048 May 12 17:51 lib/modules/2.6.32-642.el6.x86_64/kernel/drivers/net/mlx4/mlx4_en.ko

The dracut command was executed with verbose and debug enabled:

dracut -v --debug /boot/initramfs-3.10.0-327.rt56.190.el6rt.x86_64.new.img 3.10.0-327.rt56.190.el6rt.x86_64 &> dracut.3.output

The 'dracut.3.output' shows the call to the function 'instmods' with the correct arguments, where one of them is the 'mlx4' driver:

---- 'dracut.3.output' ----
...
  4033 //usr/share/dracut/modules.d/10rdma/installkernel@2(): instmods =drivers/infiniband =drivers/net/mlx4 =drivers/net/mlx5 cxgb3 cxgb4
...

The function instmods executes the 'find' command to search for the driver on a directory:

--- '/usr/share/dracut/dracut-functions' ---
...
606 # install kernel modules along with all their dependencies.
607 instmods() {
608     [[ $no_kernel = yes ]] && return
609     local mod mpargs modpath modname cmd
610     local ret=0
611     while (($# > 0)); do
612         mod=${1%.ko*}
613         case $mod in
614             =*) # This introduces 2 incompatible meanings for =* arguments
615                 # to instmods.  We need to decide which one to keep.
616                 if [[ $mod = =ata && -f $srcmods/modules.block ]] ; then
617                     instmods $mpargs $(egrep 'ata|ahci' "${srcmods}/modules.    block")
618                 elif [ -f $srcmods/modules.${mod#=} ]; then
619                     instmods $mpargs $(cat ${srcmods}/modules.${mod#=} )
620                 else
621                     instmods $mpargs $(find "$srcmods" -path "*/${mod#=}/*")  <--------------------- HERE
622                 fi
623                 ;;
...

The 'find' command works for 2.6 kernel, but it fails for 3.10 kernel, there is no argument on line #7544:
...
  7543 ///usr/share/dracut/dracut-functions@621(instmods): find /lib/modules/3.10.0-327.rt56.190.el6rt.x       86_64/ -path '*/drivers/net/mlx4/*'
  7544 //usr/share/dracut/dracut-functions@621(instmods): instmods
  7545 //usr/share/dracut/dracut-functions@608(instmods): [[ '' = yes ]]
...

The cause of the problem is that the dracut script was created to deal with 2.6 kernel, where the mlx4 kernel driver is located on directory '/lib/modules/2.6.*/kernel/drivers/net/mlx4', but the 3.10 kernel stores the mlx4 kernel driver on a 'mellanox' directory: '/lib/modules/3.10.*/kernel/drivers/net/ethernet/mellanox/mlx4'.

Comment 10 Jarod Wilson 2016-11-22 17:17:17 UTC
Simple one-line fix here.

Comment 23 errata-xmlrpc 2017-03-21 10:44:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0688.html