From 99c74373eee952f26c7d256f12c024fe29397ae6 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 6 Oct 2020 10:41:54 +0200 Subject: [PATCH] dracut-050-167.git20201006 --- 0156.patch | 1 + 0157.patch | 31 +++++++ 0158.patch | 241 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 0159.patch | 153 +++++++++++++++++++++++++++++++++ 0160.patch | 39 +++++++++ 0161.patch | 51 +++++++++++ 0162.patch | 51 +++++++++++ 0163.patch | 87 +++++++++++++++++++ 0164.patch | 25 ++++++ 0165.patch | 24 ++++++ 0166.patch | 75 ++++++++++++++++ dracut.spec | 15 +++- 12 files changed, 792 insertions(+), 1 deletion(-) create mode 100644 0157.patch create mode 100644 0158.patch create mode 100644 0159.patch create mode 100644 0160.patch create mode 100644 0161.patch create mode 100644 0162.patch create mode 100644 0163.patch create mode 100644 0164.patch create mode 100644 0165.patch create mode 100644 0166.patch diff --git a/0156.patch b/0156.patch index dcf909a..e2e203d 100644 --- a/0156.patch +++ b/0156.patch @@ -26,3 +26,4 @@ index fded5f17..e20aaa67 100644 libdir=%{_prefix}/lib echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh + diff --git a/0157.patch b/0157.patch new file mode 100644 index 0000000..bcd46b4 --- /dev/null +++ b/0157.patch @@ -0,0 +1,31 @@ +From 4916dfc2b94dca0e84eb7dc58a9266d02c416b4a Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Thu, 1 Oct 2020 14:08:38 +0200 +Subject: [PATCH] dracut-install: ignore bogus preload libs + +If there are any nonexistent libraries listed in /etc/ld.so.preload, ldd +prints error messages like: + +ERROR: ld.so: object '/usr/lib64/libfoo.so.1' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored. + +This causes resolve_deps() to return error, which leads to symlinks +(like usr/bin/awk) not being copied into the initrd. +--- + install/dracut-install.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/install/dracut-install.c b/install/dracut-install.c +index 9fbd72cd..ea0668b8 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -569,6 +569,9 @@ static int resolve_deps(const char *src) + if (strstr(buf, "cannot read header")) + break; + ++ if (strstr(buf, "cannot be preloaded")) ++ break; ++ + if (strstr(buf, destrootdir)) + break; + + diff --git a/0158.patch b/0158.patch new file mode 100644 index 0000000..b4ca90b --- /dev/null +++ b/0158.patch @@ -0,0 +1,241 @@ +From ee9b9b1241a427732781173caf9db611757c5152 Mon Sep 17 00:00:00 2001 +From: Daniel Molkentin +Date: Thu, 1 Oct 2020 17:12:26 +0200 +Subject: [PATCH] dracut-install: fix edge-case regression with weak modules + +This was introduced with 6dafdda4a6bdb8721133e4267553c5d86564f9e8, but +is actually caused by the fact that modules that have already been +installed cause dracut_install() to return without adding the module +to the hashmap. This can happen if an earlier-run dracut module chose +to install the same module. Now modprobe statements like: + +softdep usb_storage post: uas +softdep uas pre: usb_storage + +(which look weird, but are perfectly valid), cause +dracut_install() to enter an infinite recursion if and only if +at least one of the files has previously been installed by another +module. + +Fix this by also adding already installed modules to the hashmap. +--- + install/dracut-install.c | 176 +++++++++++++++++++++++------------------------ + 1 file changed, 88 insertions(+), 88 deletions(-) + +diff --git a/install/dracut-install.c b/install/dracut-install.c +index ea0668b8..97c75dbd 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -810,123 +810,123 @@ static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir + log_debug("'%s' already exists", fulldstpath); + + /* dst does already exist */ +- return ret; +- } ++ } else { + +- /* check destination directory */ +- fulldstdir = strdup(fulldstpath); +- if (!fulldstdir) { +- log_error("Out of memory!"); +- return 1; +- } +- fulldstdir[dir_len(fulldstdir)] = '\0'; ++ /* check destination directory */ ++ fulldstdir = strdup(fulldstpath); ++ if (!fulldstdir) { ++ log_error("Out of memory!"); ++ return 1; ++ } ++ fulldstdir[dir_len(fulldstdir)] = '\0'; + +- ret = stat(fulldstdir, &db); ++ ret = stat(fulldstdir, &db); + +- if (ret < 0) { +- _cleanup_free_ char *dname = NULL; ++ if (ret < 0) { ++ _cleanup_free_ char *dname = NULL; + +- if (errno != ENOENT) { +- log_error("ERROR: stat '%s': %m", fulldstdir); +- return 1; +- } +- /* create destination directory */ +- log_debug("dest dir '%s' does not exist", fulldstdir); +- dname = strdup(dst); +- if (!dname) +- return 1; ++ if (errno != ENOENT) { ++ log_error("ERROR: stat '%s': %m", fulldstdir); ++ return 1; ++ } ++ /* create destination directory */ ++ log_debug("dest dir '%s' does not exist", fulldstdir); ++ dname = strdup(dst); ++ if (!dname) ++ return 1; + +- dname[dir_len(dname)] = '\0'; +- ret = dracut_install(dname, dname, true, false, true); ++ dname[dir_len(dname)] = '\0'; ++ ret = dracut_install(dname, dname, true, false, true); + +- if (ret != 0) { +- log_error("ERROR: failed to create directory '%s'", fulldstdir); +- return 1; ++ if (ret != 0) { ++ log_error("ERROR: failed to create directory '%s'", fulldstdir); ++ return 1; ++ } + } +- } + +- if (src_isdir) { +- if (dst_exists) { +- if (S_ISDIR(sb.st_mode)) { +- log_debug("dest dir '%s' already exists", fulldstpath); +- return 0; ++ if (src_isdir) { ++ if (dst_exists) { ++ if (S_ISDIR(sb.st_mode)) { ++ log_debug("dest dir '%s' already exists", fulldstpath); ++ return 0; ++ } ++ log_error("dest dir '%s' already exists but is not a directory", fulldstpath); ++ return 1; + } +- log_error("dest dir '%s' already exists but is not a directory", fulldstpath); +- return 1; +- } + +- log_info("mkdir '%s'", fulldstpath); +- ret = dracut_mkdir(fulldstpath); +- if (ret == 0) { +- i = strdup(dst); +- if (!i) +- return -ENOMEM; ++ log_info("mkdir '%s'", fulldstpath); ++ ret = dracut_mkdir(fulldstpath); ++ if (ret == 0) { ++ i = strdup(dst); ++ if (!i) ++ return -ENOMEM; + +- hashmap_put(items, i, i); ++ hashmap_put(items, i, i); ++ } ++ return ret; + } +- return ret; +- } + +- /* ready to install src */ ++ /* ready to install src */ + +- if (src_islink) { +- _cleanup_free_ char *abspath = NULL; ++ if (src_islink) { ++ _cleanup_free_ char *abspath = NULL; + +- abspath = get_real_file(src, false); ++ abspath = get_real_file(src, false); + +- if (abspath == NULL) +- return 1; ++ if (abspath == NULL) ++ return 1; + +- if (dracut_install(abspath, abspath, false, resolvedeps, hashdst)) { +- log_debug("'%s' install error", abspath); +- return 1; +- } ++ if (dracut_install(abspath, abspath, false, resolvedeps, hashdst)) { ++ log_debug("'%s' install error", abspath); ++ return 1; ++ } + +- if (lstat(abspath, &sb) != 0) { +- log_debug("lstat '%s': %m", abspath); +- return 1; +- } ++ if (lstat(abspath, &sb) != 0) { ++ log_debug("lstat '%s': %m", abspath); ++ return 1; ++ } + +- if (lstat(fulldstpath, &sb) != 0) { +- _cleanup_free_ char *absdestpath = NULL; ++ if (lstat(fulldstpath, &sb) != 0) { ++ _cleanup_free_ char *absdestpath = NULL; + +- ret = asprintf(&absdestpath, "%s/%s", destrootdir, (abspath[0]=='/' ? (abspath+1) : abspath) + sysrootdirlen); +- if (ret < 0) { +- log_error("Out of memory!"); +- exit(EXIT_FAILURE); ++ ret = asprintf(&absdestpath, "%s/%s", destrootdir, (abspath[0]=='/' ? (abspath+1) : abspath) + sysrootdirlen); ++ if (ret < 0) { ++ log_error("Out of memory!"); ++ exit(EXIT_FAILURE); ++ } ++ ++ ln_r(absdestpath, fulldstpath); + } + +- ln_r(absdestpath, fulldstpath); +- } ++ if (arg_hmac) { ++ /* copy .hmac files also */ ++ hmac_install(src, dst, NULL); ++ } + +- if (arg_hmac) { +- /* copy .hmac files also */ +- hmac_install(src, dst, NULL); ++ return 0; + } + +- return 0; +- } +- +- if (src_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { +- if (resolvedeps) +- ret += resolve_deps(fullsrcpath + sysrootdirlen); +- if (arg_hmac) { +- /* copy .hmac files also */ +- hmac_install(src, dst, NULL); ++ if (src_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { ++ if (resolvedeps) ++ ret += resolve_deps(fullsrcpath + sysrootdirlen); ++ if (arg_hmac) { ++ /* copy .hmac files also */ ++ hmac_install(src, dst, NULL); ++ } + } +- } + +- log_debug("dracut_install ret = %d", ret); ++ log_debug("dracut_install ret = %d", ret); + +- if (arg_hostonly && !arg_module) +- mark_hostonly(dst); ++ if (arg_hostonly && !arg_module) ++ mark_hostonly(dst); + +- if (isdir) { +- log_info("mkdir '%s'", fulldstpath); +- ret += dracut_mkdir(fulldstpath); +- } else { +- log_info("cp '%s' '%s'", fullsrcpath, fulldstpath); +- ret += cp(fullsrcpath, fulldstpath); ++ if (isdir) { ++ log_info("mkdir '%s'", fulldstpath); ++ ret += dracut_mkdir(fulldstpath); ++ } else { ++ log_info("cp '%s' '%s'", fullsrcpath, fulldstpath); ++ ret += cp(fullsrcpath, fulldstpath); ++ } + } + + if (ret == 0) { + diff --git a/0159.patch b/0159.patch new file mode 100644 index 0000000..727b282 --- /dev/null +++ b/0159.patch @@ -0,0 +1,153 @@ +From 4087fd4d1a618ece6b2f8bbb1761aeccd59fcc92 Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Mon, 28 Sep 2020 11:25:53 +0200 +Subject: [PATCH] 95nvmf: rework parameter handling + +Always add the nvmf.discover parameters to /etc/nvme/discovery +when parsing the dracut commandline, and rely on NVMe autodiscovery +when no parameters are given. +And modify the syntax to use a comma ',' as a separator for nvmf.discover +as the semicolon ':' is already used for the FC-NVMe transport address format. + +Signed-off-by: Hannes Reinecke +--- + modules.d/95nvmf/module-setup.sh | 32 +++++++++++++++++++- + modules.d/95nvmf/parse-nvmf-boot-connections.sh | 39 ++++++++++++------------- + 2 files changed, 50 insertions(+), 21 deletions(-) + +diff --git a/modules.d/95nvmf/module-setup.sh b/modules.d/95nvmf/module-setup.sh +index 418b5e0c..92400c21 100755 +--- a/modules.d/95nvmf/module-setup.sh ++++ b/modules.d/95nvmf/module-setup.sh +@@ -57,6 +57,31 @@ installkernel() { + cmdline() { + local _hostnqn + local _hostid ++ ++ gen_nvmf_cmdline() { ++ local _dev=$1 ++ local trtype ++ ++ [[ -L "/sys/dev/block/$_dev" ]] || return 0 ++ cd -P "/sys/dev/block/$_dev" || return 0 ++ if [ -f partition ] ; then ++ cd .. ++ fi ++ for d in device/nvme* ; do ++ [ -L "$d" ] || continue ++ if readlink "$d" | grep -q nvme-fabrics ; then ++ trtype=$(cat "$d"/transport) ++ break ++ fi ++ done ++ ++ [ -z "$trtype" ] && return 0 ++ nvme list-subsys ${PWD##*/} | while read x dev trtype traddr host_traddr state ana; do ++ [ "$trtype" != "${trtype#NQN}" ] && continue ++ echo -n " nvmf.discover=$trtype,${traddr#traddr=},${host_traddr#host_traddr=}" ++ done ++ } ++ + if [ -f /etc/nvme/hostnqn ] ; then + _hostnqn=$(cat /etc/nvme/hostnqn) + echo -n " nvmf.hostnqn=${_hostnqn}" +@@ -65,7 +90,12 @@ cmdline() { + _hostid=$(cat /etc/nvme/hostid) + echo -n " nvmf.hostid=${_hostid}" + fi +- echo "" ++ ++ [[ $hostonly ]] || [[ $mount_needs ]] && { ++ pushd . >/dev/null ++ for_each_host_dev_and_slaves gen_nvmf_cmdline ++ popd >/dev/null ++ } + } + + # called by dracut +diff --git a/modules.d/95nvmf/parse-nvmf-boot-connections.sh b/modules.d/95nvmf/parse-nvmf-boot-connections.sh +index 0ed53a81..3ff731f1 100755 +--- a/modules.d/95nvmf/parse-nvmf-boot-connections.sh ++++ b/modules.d/95nvmf/parse-nvmf-boot-connections.sh +@@ -3,14 +3,14 @@ + # Supported formats: + # nvmf.hostnqn= + # nvmf.hostid= +-# nvmf.discover=::: ++# nvmf.discover=,,, + # + # Examples: + # nvmf.hostnqn=nqn.2014-08.org.nvmexpress:uuid:37303738-3034-584d-5137-333230423843 +-# nvmf.discover=rdma:192.168.1.3::4420 +-# nvmf.discover=tcp:192.168.1.3::4420 +-# nvmf.discover=tcp:192.168.1.3 +-# nvmf.discover=fc:auto ++# nvmf.discover=rdma,192.168.1.3,,4420 ++# nvmf.discover=tcp,192.168.1.3,,4420 ++# nvmf.discover=tcp,192.168.1.3 ++# nvmf.discover=fc,nn-0x200400a098d85236:pn-0x201400a098d85236,nn-0x200000109b7db455:pn-0x100000109b7db455 + # + # Note: FC does autodiscovery, so typically there is no need to + # specify any discover parameters for FC. +@@ -25,11 +25,6 @@ fi + + initqueue --onetime modprobe --all -b -q nvme nvme_tcp nvme_core nvme_fabrics + +-traddr="none" +-trtype="none" +-hosttraddr="none" +-trsvcid=4420 +- + validate_ip_conn() { + if ! getargbool 0 rd.neednet ; then + warn "$trtype transport requires rd.neednet=1" +@@ -59,8 +54,12 @@ validate_ip_conn() { + } + + parse_nvmf_discover() { ++ traddr="none" ++ trtype="none" ++ hosttraddr="none" ++ trsvcid=4420 + OLDIFS="$IFS" +- IFS=: ++ IFS=, + set $1 + IFS="$OLDIFS" + +@@ -101,7 +100,11 @@ parse_nvmf_discover() { + if [ "$trtype" = "tcp" ]; then + validate_ip_conn + fi +- echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr --trsvcid=$trsvcid" >> /etc/nvme/discovery.conf ++ if [ "$trtype" = "fc" ] ; then ++ echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr" >> /etc/nvme/discovery.conf ++ else ++ echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr --trsvcid=$trsvcid" >> /etc/nvme/discovery.conf ++ fi + } + + nvmf_hostnqn=$(getarg nvmf.hostnqn=) +@@ -122,17 +125,13 @@ done + [ -f "/etc/nvme/hostid" ] || exit 0 + + if [ -f "/etc/nvme/discovery.conf" ] ; then ++ /sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all + if [ "$trtype" = "tcp" ] ; then +- /sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all + > /tmp/net.$ifname.did-setup +- else +- /sbin/initqueue --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all + fi + else +- if [ "$trtype" = "tcp" ] ; then +- /sbin/initqueue --settled --onetime --unique /usr/sbin/nvme connect-all -t tcp -a $traddr -s $trsvcid +- > /tmp/net.$ifname.did-setup +- else +- /sbin/initqueue --finished --unique --name nvme-fc-autoconnect echo 1 > /sys/class/fc/fc_udev_device/nvme_discovery ++ # No nvme command line arguments present, try autodiscovery ++ if [ "$trtype" = "fc" ] ; then ++ /sbin/initqueue --finished --onetime --unique --name nvme-fc-autoconnect echo 1 > /sys/class/fc/fc_udev_device/nvme_discovery + fi + fi + diff --git a/0160.patch b/0160.patch new file mode 100644 index 0000000..1dbe0ad --- /dev/null +++ b/0160.patch @@ -0,0 +1,39 @@ +From e9a614b50c825adba9fde093c09d02a14d7aba05 Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Mon, 28 Sep 2020 11:38:40 +0200 +Subject: [PATCH] 95nvmf: add documentation + +Add documentation for 95nvmf module to dracut.cmdline + +Signed-off-by: Hannes Reinecke +--- + dracut.cmdline.7.asc | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index dbbbfed0..f7f34d05 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -861,6 +861,21 @@ FCoE + + + NOTE: letters in the MAC-address must be lowercase! + ++NVMf ++~~~~ ++**rd.nvmf.hostnqn=**____:: ++ NVMe host NQN to use ++ ++**rd.nvmf.hostid=**____:: ++ NVMe host id to use ++ ++**rd.nvmf.discover=**__{rdma|fc|tcp}__,____,[____],[____]:: ++ Discover and connect to a NVMe-over-Fabric controller specified by ++ __ and the optionally __ or __. ++ The first argument specifies the transport to use; currently only ++ 'rdma', 'fc', or 'tcp' are supported. ++ This parameter can be specified multiple times. ++ + NBD + ~~~ + **root=**??? **netroot=**nbd:____:____[:____[:____[:____]]]:: + diff --git a/0161.patch b/0161.patch new file mode 100644 index 0000000..ee0acc4 --- /dev/null +++ b/0161.patch @@ -0,0 +1,51 @@ +From f0ac6cb462930010e4756df4ce1ce0f8aa60b08f Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Mon, 28 Sep 2020 13:39:07 +0200 +Subject: [PATCH] 95nvmf: Fixup FC connections + +D-Bus doesn't run in the initrd, so our usual trick of activating +custom systemd services from udev doesn't work. +So add a rule to create initqueue entries for each possible +connection. + +Signed-off-by: Hannes Reinecke +--- + modules.d/95nvmf/95-nvmf-initqueue.rules | 10 ++++++++++ + modules.d/95nvmf/module-setup.sh | 5 +---- + 2 files changed, 11 insertions(+), 4 deletions(-) + +diff --git a/modules.d/95nvmf/95-nvmf-initqueue.rules b/modules.d/95nvmf/95-nvmf-initqueue.rules +new file mode 100644 +index 00000000..d26d7b09 +--- /dev/null ++++ b/modules.d/95nvmf/95-nvmf-initqueue.rules +@@ -0,0 +1,10 @@ ++# ++# nvmf-initqueue.rules ++# ++# D-Bus doesn't run in the initrd, which means that we cannot use our ++# usual trick of starting custom systemd services. ++# So use a rule to create initqueue entries instead. ++ ++ACTION=="change", SUBSYSTEM=="fc", ENV{FC_EVENT}=="nvmediscovery", \ ++ ENV{NVMEFC_HOST_TRADDR}=="*", ENV{NVMEFC_TRADDR}=="*", \ ++ RUN+="/sbin/initqueue --onetime --unique --name nvmf-connect-$env{NVMEFC_TRADDR}-$env{NVMEFC_HOST_TRADDR} /usr/sbin/nvme connect-all --transport=fc --traddr=$env{NVMEFC_TRADDR} --host-traddr=$env{NVMEFC_HOST_TRADDR}" +diff --git a/modules.d/95nvmf/module-setup.sh b/modules.d/95nvmf/module-setup.sh +index 92400c21..501ba8dd 100755 +--- a/modules.d/95nvmf/module-setup.sh ++++ b/modules.d/95nvmf/module-setup.sh +@@ -110,12 +110,9 @@ install() { + inst_multiple ip sed + + inst_multiple nvme +- inst_multiple -o \ +- "$systemdsystemunitdir/nvm*-connect@.service" \ +- "$systemdsystemunitdir/nvm*-connect.target" + inst_hook cmdline 99 "$moddir/parse-nvmf-boot-connections.sh" + inst_simple "/etc/nvme/discovery.conf" +- inst_rules /usr/lib/udev/rules.d/70-nvm*-autoconnect.rules + inst_rules /usr/lib/udev/rules.d/71-nvmf-iopolicy-netapp.rules ++ inst_rules "$moddir/95-nvmf-initqueue.rules" + dracut_need_initqueue + } + diff --git a/0162.patch b/0162.patch new file mode 100644 index 0000000..813a490 --- /dev/null +++ b/0162.patch @@ -0,0 +1,51 @@ +From 0e2ef80993858992f6219b5162289568937a1fac Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Mon, 28 Sep 2020 13:39:07 +0200 +Subject: [PATCH] 95nvmf: add nvmf-autoconnect script + +Add a script to run FC autoconnect. + +Signed-off-by: Hannes Reinecke +--- + modules.d/95nvmf/module-setup.sh | 2 ++ + modules.d/95nvmf/nvmf-autoconnect.sh | 5 +++++ + modules.d/95nvmf/parse-nvmf-boot-connections.sh | 2 +- + 3 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/modules.d/95nvmf/module-setup.sh b/modules.d/95nvmf/module-setup.sh +index 501ba8dd..268f1a2c 100755 +--- a/modules.d/95nvmf/module-setup.sh ++++ b/modules.d/95nvmf/module-setup.sh +@@ -109,6 +109,8 @@ install() { + + inst_multiple ip sed + ++ inst_script "${moddir}/nvmf-autoconnect.sh" /sbin/nvmf-autoconnect.sh ++ + inst_multiple nvme + inst_hook cmdline 99 "$moddir/parse-nvmf-boot-connections.sh" + inst_simple "/etc/nvme/discovery.conf" +diff --git a/modules.d/95nvmf/nvmf-autoconnect.sh b/modules.d/95nvmf/nvmf-autoconnect.sh +new file mode 100644 +index 00000000..c8f676a7 +--- /dev/null ++++ b/modules.d/95nvmf/nvmf-autoconnect.sh +@@ -0,0 +1,5 @@ ++#!/bin/bash ++ ++[ -f /sys/class/fc/fc_udev_device/nvme_discovery ] || exit 1 ++echo add > /sys/class/fc/fc_udev_device/nvme_discovery ++exit 0 +diff --git a/modules.d/95nvmf/parse-nvmf-boot-connections.sh b/modules.d/95nvmf/parse-nvmf-boot-connections.sh +index 3ff731f1..5a19c84e 100755 +--- a/modules.d/95nvmf/parse-nvmf-boot-connections.sh ++++ b/modules.d/95nvmf/parse-nvmf-boot-connections.sh +@@ -132,6 +132,6 @@ if [ -f "/etc/nvme/discovery.conf" ] ; then + else + # No nvme command line arguments present, try autodiscovery + if [ "$trtype" = "fc" ] ; then +- /sbin/initqueue --finished --onetime --unique --name nvme-fc-autoconnect echo 1 > /sys/class/fc/fc_udev_device/nvme_discovery ++ /sbin/initqueue --finished --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh + fi + fi + diff --git a/0163.patch b/0163.patch new file mode 100644 index 0000000..f83c337 --- /dev/null +++ b/0163.patch @@ -0,0 +1,87 @@ +From 251b424727492955041178766ce7e17ae4fc91ff Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Mon, 28 Sep 2020 14:02:28 +0200 +Subject: [PATCH] 95nvmf: Implement 'fc,auto' commandline syntax + +Add a 'fc,auto' commandline syntax for nvmf.discover to force +nvmf autodiscovery on FC-NVMe. + +Signed-off-by: Hannes Reinecke +--- + dracut.cmdline.7.asc | 2 ++ + modules.d/95nvmf/parse-nvmf-boot-connections.sh | 16 +++++++++++----- + 2 files changed, 13 insertions(+), 5 deletions(-) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index f7f34d05..7ce7df2c 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -874,6 +874,8 @@ NVMf + __ and the optionally __ or __. + The first argument specifies the transport to use; currently only + 'rdma', 'fc', or 'tcp' are supported. ++ The __ parameter can be set to 'auto' to select ++ autodiscovery; in that case all other parameters are ignored. + This parameter can be specified multiple times. + + NBD +diff --git a/modules.d/95nvmf/parse-nvmf-boot-connections.sh b/modules.d/95nvmf/parse-nvmf-boot-connections.sh +index 5a19c84e..eb10dc97 100755 +--- a/modules.d/95nvmf/parse-nvmf-boot-connections.sh ++++ b/modules.d/95nvmf/parse-nvmf-boot-connections.sh +@@ -11,6 +11,7 @@ + # nvmf.discover=tcp,192.168.1.3,,4420 + # nvmf.discover=tcp,192.168.1.3 + # nvmf.discover=fc,nn-0x200400a098d85236:pn-0x201400a098d85236,nn-0x200000109b7db455:pn-0x100000109b7db455 ++# nvmf.discover=fc,auto + # + # Note: FC does autodiscovery, so typically there is no need to + # specify any discover parameters for FC. +@@ -81,21 +82,25 @@ parse_nvmf_discover() { + ;; + *) + warn "Invalid arguments for nvmf.discover=$1" +- return 1 ++ return 0 + ;; + esac + if [ "$traddr" = "none" ] ; then + warn "traddr is mandatory for $trtype" +- return 1; ++ return 0; + fi + if [ "$trtype" = "fc" ] ; then ++ if [ "$traddr" = "auto" ] ; then ++ rm /etc/nvme/discovery.conf ++ return 1 ++ fi + if [ "$hosttraddr" = "none" ] ; then + warn "host traddr is mandatory for fc" +- return 1 ++ return 0 + fi + elif [ "$trtype" != "rdma" ] && [ "$trtype" != "tcp" ] ; then + warn "unsupported transport $trtype" +- return 1 ++ return 0 + fi + if [ "$trtype" = "tcp" ]; then + validate_ip_conn +@@ -105,6 +110,7 @@ parse_nvmf_discover() { + else + echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr --trsvcid=$trsvcid" >> /etc/nvme/discovery.conf + fi ++ return 0 + } + + nvmf_hostnqn=$(getarg nvmf.hostnqn=) +@@ -117,7 +123,7 @@ if [ -n "$nvmf_hostid" ] ; then + fi + + for d in $(getargs nvmf.discover=); do +- parse_nvmf_discover "$d" ++ parse_nvmf_discover "$d" || break + done + + # Host NQN and host id are mandatory for NVMe-oF + diff --git a/0164.patch b/0164.patch new file mode 100644 index 0000000..a453269 --- /dev/null +++ b/0164.patch @@ -0,0 +1,25 @@ +From 7c923f1de89f80b511338f9b434acfdf2547dbac Mon Sep 17 00:00:00 2001 +From: Jonathan Lebon +Date: Wed, 23 Sep 2020 16:18:18 -0400 +Subject: [PATCH] 00systemd: add missing cryptsetup-related targets + +We want these in the initramfs. Things related to clevis and systemd's +`cryptsetup-generator` reference these targets. +--- + modules.d/00systemd/module-setup.sh | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh +index 17be74fd..bbce31a2 100755 +--- a/modules.d/00systemd/module-setup.sh ++++ b/modules.d/00systemd/module-setup.sh +@@ -65,6 +65,8 @@ install() { + $systemdutildir/system-generators/systemd-gpt-auto-generator \ + \ + $systemdsystemunitdir/cryptsetup.target \ ++ $systemdsystemunitdir/cryptsetup-pre.target \ ++ $systemdsystemunitdir/remote-cryptsetup.target \ + $systemdsystemunitdir/emergency.target \ + $systemdsystemunitdir/sysinit.target \ + $systemdsystemunitdir/basic.target \ + diff --git a/0165.patch b/0165.patch new file mode 100644 index 0000000..383fa7d --- /dev/null +++ b/0165.patch @@ -0,0 +1,24 @@ +From 7ea391b527eb19c572a750fe00f95d02a50beabf Mon Sep 17 00:00:00 2001 +From: Jonathan Lebon +Date: Wed, 23 Sep 2020 21:15:52 -0400 +Subject: [PATCH] 90crypt: pull in remote-cryptsetup.target enablement + +This is enabled upstream in +https://github.com/systemd/systemd/pull/17149. +--- + modules.d/90crypt/module-setup.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh +index e3d6338f..f43b2e5d 100755 +--- a/modules.d/90crypt/module-setup.sh ++++ b/modules.d/90crypt/module-setup.sh +@@ -151,6 +151,7 @@ install() { + $systemdsystemunitdir/systemd-ask-password-console.service \ + $systemdsystemunitdir/cryptsetup.target \ + $systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \ ++ $systemdsystemunitdir/initrd-root-fs.target.wants/remote-cryptsetup.target \ + systemd-ask-password systemd-tty-ask-password-agent + fi + + diff --git a/0166.patch b/0166.patch new file mode 100644 index 0000000..a4630fb --- /dev/null +++ b/0166.patch @@ -0,0 +1,75 @@ +From 811c814677b83874fb631f6c07576765303b615a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= + +Date: Sat, 3 Oct 2020 14:23:26 +0700 +Subject: [PATCH] rootfs-block: only write root argument for block device +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some filesystem (e.g. ZFS, and btrfs subvolumes) don't use block +devices. Should they be mounted as `/`, `find_root_block_device` +yields nothing, hence dracut will append this problematic argument +to kernel cmdline: + + root=/dev/block + +On a machine that employ root ZFS on LUKS, which was setup with +an OpenPGP-encrypted key file, this argument renders that machine +unbootable. Remove that `root=/dev/block` manually could boot the +machine. + +Let check if that device is a block device before write down `root` +argument. This is consistent with the check for block device in +`find_block_device`. + +Signed-off-by: Đoàn Trần Công Danh +--- + modules.d/95rootfs-block/module-setup.sh | 25 +++++++++++++++---------- + 1 file changed, 15 insertions(+), 10 deletions(-) + +diff --git a/modules.d/95rootfs-block/module-setup.sh b/modules.d/95rootfs-block/module-setup.sh +index 987373b4..c3982207 100755 +--- a/modules.d/95rootfs-block/module-setup.sh ++++ b/modules.d/95rootfs-block/module-setup.sh +@@ -30,7 +30,8 @@ cmdline_journal() { + } + + cmdline_rootfs() { +- local _dev=/dev/block/$(find_root_block_device) ++ local _block=$(find_root_block_device) ++ local _dev=/dev/block/$_block + local _fstype _flags _subvol + + # "--no-hostonly-default-device" can result in empty root_devs +@@ -38,17 +39,21 @@ cmdline_rootfs() { + return + fi + +- if [ -e $_dev ]; then ++ if [ -n "$_block" -a -b $_dev ]; then + printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$_dev")")" +- _fstype="$(find_mp_fstype /)" +- _flags="$(find_mp_fsopts /)" ++ fi ++ _fstype="$(find_mp_fstype /)" ++ _flags="$(find_mp_fsopts /)" ++ if [ -n "$_fstype" ]; then + printf " rootfstype=%s" "$_fstype" +- if [[ $use_fstab != yes ]] && [[ $_fstype = btrfs ]]; then +- _subvol=$(findmnt -e -v -n -o FSROOT --target /) \ +- && _subvol=${_subvol#/} +- _flags="$_flags,${_subvol:+subvol=$_subvol}" +- fi +- printf " rootflags=%s" "${_flags#,}" ++ fi ++ if [[ $use_fstab != yes ]] && [[ $_fstype = btrfs ]]; then ++ _subvol=$(findmnt -e -v -n -o FSROOT --target /) \ ++ && _subvol=${_subvol#/} ++ _flags="$_flags${_subvol:+,subvol=$_subvol}" ++ fi ++ if [ -n "$_flags" ]; then ++ printf " rootflags=%s" "$_flags" + fi + } + diff --git a/dracut.spec b/dracut.spec index e28fc27..94c7bb0 100644 --- a/dracut.spec +++ b/dracut.spec @@ -5,7 +5,7 @@ # strip the automatically generated dep here and instead co-own the # directory. %global __requires_exclude pkg-config -%define dist_free_release 157.git20201002 +%define dist_free_release 167.git20201006 Name: dracut Version: 050 @@ -184,6 +184,16 @@ Patch153: 0153.patch Patch154: 0154.patch Patch155: 0155.patch Patch156: 0156.patch +Patch157: 0157.patch +Patch158: 0158.patch +Patch159: 0159.patch +Patch160: 0160.patch +Patch161: 0161.patch +Patch162: 0162.patch +Patch163: 0163.patch +Patch164: 0164.patch +Patch165: 0165.patch +Patch166: 0166.patch Source1: https://www.gnu.org/licenses/lgpl-2.1.txt @@ -639,6 +649,9 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne %endif %changelog +* Tue Oct 06 2020 Harald Hoyer - 050-167.git20201006 +- git snapshot + * Fri Oct 02 2020 Harald Hoyer - 050-157.git20201002 - git snapshot