Re: [PATCH 1/2] Use /sbin/dasd_cio_free to free blacklisted DASDs (#558881)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 27 Mar 2010, Steffen Maier wrote:

On 03/27/2010 01:49 AM, David Cantrell wrote:
Use the dasd_cio_free command to free blacklisted DASDs and block until
they are available to set online and set other attributes.  We were just
writing "free $DEVICE" to /proc/cio_ignore, but we lacked the wait loop
to make sure the device showed up.  The /sbin/dasd_cio_free command does
that for us, so we can just call that.

NOTE:  dasd_cio_free as currently written only reads a device list from
/etc/dasd.conf.  It does not take command line options.  For beta 2,
there is slated an update to s390utils to allow the *_cio_free commands
to take in a command line argument specifying the device to tree.  Until
that happens, we have to pass that information to dasd_cio_free via the
/etc/dasd.conf file.

dasd_cio_free has two methods to wait for DASDs to be freed from the
device blacklist:
1) For dracut's new style rd_DASD, it uses /etc/dasd.conf
  with one device per line, the first column being the device bus ID.
2) For dracut's legacy rd_DASD_MOD, it uses whatever
  "modprobe --showconfig" returns for "options dasd_mod dasd=...".
  That's the syntax of the dasd_mod device driver modules option "dasd"
  which takes a list of device bus ID ranges including some options.
  A good place to put the dasd_mod device driver option is
  /etc/modprobe.d/dasd_mod.conf.

The syntax for linuxrc's DASD parm/conf file option is exactly
the syntax of the dasd_mod device driver module option "dasd".
Therefore, we should use method 2 for dasd_cio_free in linuxrc.

Additionally, with your solution, the user can run into multiple
timeouts of 60 seconds each. This happens if the user specified multiple
DASD ranges (often just one device bus ID per "range") in a list of
which some devices accidently do not exist. Calling dasd_cio_free
separately for each range in sequence does then run into the timeout for
for each range with non-existing devices. dasd_cio_free does have
support for reducing the timeout which can be simply exploited by also
using the rd_DASD_MOD style.

dasd_cio_free only needs to be called if there are any entries
in the blacklist. Otherwise there is nothing to wait for and we should
not even try.

User information that it'll try to free devices from the blacklist
which might take some time is also missing.

All this has already been stated in bug 558881 comment 19
including a pseudo patch for the suggested solution
(the difference being that the pseudo patch assumed
dasd_cio_free to take command line arguments, so it has to be
adapted to take the detour through /etc/modprobe.d/dasd_mod.conf).

Is there any particular reason to do it differently?

My understanding of what was being freed was incorrect here, so that's why I
changed around your proposed patch.  Here's the revised patch:


Use /sbin/dasd_cio_free to free blacklisted DASDs (#558881)

Use the dasd_cio_free command to free blacklisted DASDs and block until
they are available to set online and set other attributes.  We were just
writing "free $DEVICE" to /proc/cio_ignore, but we lacked the wait loop
to make sure the device showed up.  The /sbin/dasd_cio_free command does
that for us, so we can just call that.

NOTE:  The dasd_cio_free command reads the DASD list from the output of
the 'modprobe --showconfig' command, so the $DASD list is placed in the
/etc/modprobe.d/dasd_mod.conf in module option format so that modprobe
can return it correctly.
- ---
 loader/linuxrc.s390  |   23 ++++++++++++++---------
 scripts/upd-instroot |    1 +
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390
index e2ba469..1f16de8 100644
- --- a/loader/linuxrc.s390
+++ b/loader/linuxrc.s390
@@ -2397,14 +2397,27 @@ function parse_dasd() {
     [ "$1" = "-h" ] && handle=yes || unset handle
     local dasditem
     local allgood="yes"
+    local cio_wc=$(wc -c /proc/cio_ignore)
+    read cio_wc_bytes cio_wc_filename cio_wc_foo <<< "$cio_wc"
+    if [ "$handle" = "yes" -a "$cio_wc_bytes" != "0" ]; then
+        echo $"Trying to clear specified DASDs from device blacklist..."
+        mkdir -p /etc/modprobe.d
+        echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
+        if ! dasd_cio_free; then
+            echo $"Not all specified DASDs could be detected within timeout."
+            allgood="no"
+        fi
+    fi
     while read dasditem; do
         unset range features range lo hi rangegood \
             attrs devno lodevno hidevno devbusid sys
         case $dasditem in
             autodetect)
                 [ -z "$handle" ] && continue
- -                local cio_wc=$(wc -c /proc/cio_ignore)
+                cio_wc=$(wc -c /proc/cio_ignore)
                 read cio_wc_bytes cio_wc_filename cio_wc_foo <<< "$cio_wc"
+                # above we only freed the devices specified in $DASD,
+                # so there might still be other DASDs in the blacklist
                 if [ "$cio_wc_bytes" != "0" ]; then
                     echo $"Note: There is a device blacklist active! Only activating visible DASDs."
                 fi
@@ -2465,14 +2478,6 @@ function parse_dasd() {
                         *)  echo "l.$LINENO: unexpected return code of regex match operator =~, code needs to be fixed" 1>&2 ;;
                     esac
                 fi
- -                if [ "$rangegood" = "yes" -a "$handle" = "yes" ]; then
- -                    if ! sysecho /proc/cio_ignore "free $range"; then
- -                        echo $"Could not free DASD device $range from device blacklist"
- -                        allgood="no"
- -                    else
- -                        udevadm settle
- -                    fi
- -                fi
                 if [ "${features//*)/}" != "" ]; then
                     if [ -z "$handle" ]; then
                         echo $"Missing closing parenthesis at features of DASD range $range: ($features"
diff --git a/scripts/upd-instroot b/scripts/upd-instroot
index 8250ea1..ca0fcce 100755
- --- a/scripts/upd-instroot
+++ b/scripts/upd-instroot
@@ -709,6 +709,7 @@ bin/uname
 bin/vi
 lib/modules/ibm
 lib/security
+sbin/*_cio_free
 sbin/arp
 sbin/cmsfscat
 sbin/cmsfslst


- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkuxBogACgkQ5hsjjIy1Vkk7TwCggIn3eB6J/uW2tm3aH9useyk4
BzsAn1seCMiasam6JmZLDJ9ZqetjnkiW
=nZb8
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux