Hi, svn rev. 264243 introduced a regression in rc.d/mdconfig and mdconfig2 scripts. The following configuration (within /etc/rc.conf) : # Ramdisk mdconfig_md0="-t swap -s 4096m" mdconfig_md0_owner="root:wheel" mdconfig_md0_perms="1777" mdconfig_md0_cmd="mkdir /tmp/wrkdirs" now leads to errors because of wrong list_vars arguments within the scripts. With current arguments, the scripts catch too many md devices and now try to create md0, but also md0_owner, md0_perms and md0_cmd. Fix: Patch attached with submission follows: How-To-Repeat: Try the configuration above and do : # /etc/rc.d/mdconfig start # /etc/rc.d/mdconfig2 start (or reboot)
# grep mdconf /etc/rc.conf mdconfig_md0="-t malloc -s 128m -o reserve" mdconfig_md0_owner="1001" mdconfig_md0_perms="0700" # mdconfig restart Umounting /dev/md0. Destroying md0. Device /dev/md0_owner isn't mounted. Device /dev/md0_perms isn't mounted. Creating md0 device (malloc). Mounting /dev/md0. Creating md0_owner device (1001). usage: mdconfig -a -t type [-n] [-o [no]option] ... [-f file] [-s size] [-S sectorsize] [-u unit] [-x sectors/track] [-y heads/cylinder] mdconfig -d -u unit [-o [no]force] mdconfig -l [-v] [-n] [-f file] [-u unit] mdconfig file type = {malloc, vnode, swap} option = {cluster, compress, reserve} size = %d (512 byte blocks), %db (B), %dk (kB), %dm (MB), %dg (GB) or %dt (TB) Creating md0_owner device failed, moving on. Creating md0_perms device (0700). usage: mdconfig -a -t type [-n] [-o [no]option] ... [-f file] [-s size] [-S sectorsize] [-u unit] [-x sectors/track] [-y heads/cylinder] mdconfig -d -u unit [-o [no]force] mdconfig -l [-v] [-n] [-f file] [-u unit] mdconfig file type = {malloc, vnode, swap} option = {cluster, compress, reserve} size = %d (512 byte blocks), %db (B), %dk (kB), %dm (MB), %dg (GB) or %dt (TB) Creating md0_perms device failed, moving on.
Created attachment 162576 [details] mdconfig startup patch
Hello, The patch is not enough to build the exact list of mds without args. Shell regex is POSIX compliant. You have to restrict the config list with some egrep and takes care of mdconfig devices above 9. The "mdconfig_md[0-9]\*" regex that will me matching var in "list_vars" matches all and other additionnal parameter for the same mdX. Perhaps it might be preferable to get rid of this like it is done for multiple network interfaces from same brand in future or inspire from "ppp_profile" list. By now the patch attached solved the problem for md0 to md99 and get rids of type mismatch like "mdconfig_mdr10". Denis
A commit references this bug: Author: dteske Date: Thu Oct 29 21:12:58 UTC 2015 New revision: 290163 URL: https://svnweb.freebsd.org/changeset/base/290163 Log: Ignore per-mdN settings in mdconfig[2] startup PR: base/189696 Submitted by: ganael.laplanche@martymac.org MFC after: 3 days X-MFC-to: stable/10 stable/9 Changes: head/etc/rc.d/mdconfig head/etc/rc.d/mdconfig2
Fixed in HEAD. See SVN r290163. Will merge to stable/10 and stable/9 after 3-day minimum MFC requirement. Note to Denis... You can't use grep (nor egrep) in these boot scripts. Reason being two-fold: 1. grep/egrep is in /usr/bin 2. The mdconfig boot script runs before filesystems are mounted (see below) $ rcorder /etc/rc.d/* 2> /dev/null | grep -n '\(FILE\|mount\|mdc\)' 14:/etc/rc.d/mdconfig 16:/etc/rc.d/mountcritlocal 20:/etc/rc.d/FILESYSTEMS 60:/etc/rc.d/mountcritremote 63:/etc/rc.d/mdconfig2 103:/etc/rc.d/mountd 120:/etc/rc.d/mountlate NOTE: mountcritlocal is the script that mounts /usr/bin on systems that have legacy partitioning (e.g., UFS with separate /, /usr, /var, and /tmp bsdlabels). NOTE: In the situation where /usr/bin is part of /, you won't see the problem with using grep/egrep in the mdconfig boot script. Note to OP... Original patch could be fooled into thinking mdconfig_md0_setting8 was a unit to allocate (wherein mdconfig would attempt to allocate md0_setting8; the patch in committed SVN rev is not fooled by this and would skip md0_setting8 but catch the mdconfig_md0 setting to cause allocation of md0).
MFC pending. Closing ahead of MFC.
A commit references this bug: Author: dteske Date: Mon Nov 2 21:26:10 UTC 2015 New revision: 290277 URL: https://svnweb.freebsd.org/changeset/base/290277 Log: MFC r290163: Ignore per-mdN settings in mdconfig[2] startup PR: base/189696 Submitted by: ganael.laplanche@martymac.org Changes: _U stable/10/ stable/10/etc/rc.d/mdconfig stable/10/etc/rc.d/mdconfig2
A commit references this bug: Author: dteske Date: Mon Nov 2 21:30:53 UTC 2015 New revision: 290278 URL: https://svnweb.freebsd.org/changeset/base/290278 Log: MFC r290163: Ignore per-mdN settings in mdconfig[2] startup PR: base/189696 Submitted by: ganael.laplanche@martymac.org Changes: _U stable/9/ _U stable/9/etc/ _U stable/9/etc/rc.d/ stable/9/etc/rc.d/mdconfig stable/9/etc/rc.d/mdconfig2