Date: Fri, 11 May 2007 13:41:56 -0500 From: "Scot Hetzel" <swhetzel@gmail.com> To: freebsd-current@freebsd.org Subject: mdconfig not returning error when listing a non-existing device. Message-ID: <790a9fff0705111141n3731f75at23aae6f0482bd638@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
------=_Part_155205_17368898.1178908916030 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I created a vnode filesystem to use with mdconfig and added it to the /etc/rc.conf file: mdconfig2_enable="YES" mdconfig2_list="md99" #ncvs filesystem to be mounted by zfs mdconfig_md99="-t vnode -f /usr/home/ncvs.dsk" The problem is that when the mdconfig2 rc script is executed, it fails to create the md device. hp010# ls /dev/md* /dev/mdctl hp010# /etc/rc.d/mdconfig2 start md99 /etc/rc.d/mdconfig2: DEBUG: run_rc_command: start_precmd: [ -n "${_mdconfig2_list}" ] /etc/rc.d/mdconfig2: DEBUG: load_kld: geom_md kernel module already loaded. /etc/rc.d/mdconfig2: DEBUG: run_rc_command: doit: mdconfig2_start /etc/rc.d/mdconfig2: DEBUG: md99 config: -t vnode -f /usr/home/ncvs.dsk /etc/rc.d/mdconfig2: DEBUG: md99 type: vnode /etc/rc.d/mdconfig2: DEBUG: md99 dev: /dev/md99 /etc/rc.d/mdconfig2: DEBUG: md99 file: /usr/home/ncvs.dsk /etc/rc.d/mdconfig2: DEBUG: md99 fs: /usr/home /etc/rc.d/mdconfig2: DEBUG: md99 owner: /etc/rc.d/mdconfig2: DEBUG: md99 perms: /etc/rc.d/mdconfig2: DEBUG: md99 files: /etc/rc.d/mdconfig2: DEBUG: md99 populate cmd: /etc/rc.d/mdconfig2: ERROR: md99 already exists This error comes from when it is checking if the device already exists: if mdconfig -l -u ${_md} >/dev/null 2>&1; then err 3 "${_md} already exists" fi The problem is that mdconfig -l doesn't return an error code when it is asked to list a non-existant device. hp010# ls /dev/md* /dev/mdctl hp010# mdconfig -l -u md99 ; echo $? 0 hp010# mdconfig -a -t vnode -f /usr/home/ncvs.dsk -u md99 ; echo $? 0 hp010# mdconfig -l -u md0 ; echo $? md0 vnode 5.0G /usr/home/ncvs.dsk 0 This problem affects both the /etc/rc.d/mdconfig and mdconfig2 scripts. Scot NOTE: The attached patch adds mdconfig[,2]_list - its use is to allow the scripts to configure md devices that don't start at 0. -- DISCLAIMER: No electrons were mamed while sending this message. Only slightly bruised. ------=_Part_155205_17368898.1178908916030 Content-Type: text/x-diff; name=mdconfig.patch; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: base64 X-Attachment-Id: f_f1kz5szb Content-Disposition: attachment; filename="mdconfig.patch" SW5kZXg6IG1kY29uZmlnCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT0KUkNTIGZpbGU6IC9ob21lL25jdnMvc3JjL2V0Yy9y Yy5kL21kY29uZmlnLHYKcmV0cmlldmluZyByZXZpc2lvbiAxLjQKZGlmZiAtdSAtcjEuNCBtZGNv bmZpZwotLS0gbWRjb25maWcJMzEgRGVjIDIwMDYgMTA6Mzc6MTggLTAwMDAJMS40CisrKyBtZGNv bmZpZwkxMSBNYXkgMjAwNyAxODoxODo1MCAtMDAwMApAQCAtMTkxLDYgKzE5MSwxNCBAQAogCQkJ X21kY29uZmlnX3VuaXQ9JCgoJHtfbWRjb25maWdfdW5pdH0gKyAxKSkKIAkJZmkKIAlkb25lCisJ aWYgWyAtbiAiJHttZGNvbmZpZ19saXN0fSIgXSA7IHRoZW4KKwkJZm9yIF9tZGNvbmZpZ19kZXYg aW4gJHttZGNvbmZpZ19saXN0fSA7IGRvCisJCQlldmFsIF9tZGNvbmZpZ19jb25maWc9XCRtZGNv bmZpZ18ke21kY29uZmlnX2Rldn0KKwkJCWlmIFsgLW4gIiR7X21kY29uZmlnX2NvbmZpZ30iIF0g OyB0aGVuCisJCQkJX21kY29uZmlnX2xpc3Q9IiR7X21kY29uZmlnX2xpc3R9JHtfbWRjb25maWdf bGlzdDorIH0ke19tZGNvbmZpZ19kZXZ9IgorCQkJZmkKKwkJZG9uZQorCWZpCiBmaQogCQogcnVu X3JjX2NvbW1hbmQgIiR7X21kY29uZmlnX2NtZH0iCkluZGV4OiBtZGNvbmZpZzIKPT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PQpSQ1MgZmlsZTogL2hvbWUvbmN2cy9zcmMvZXRjL3JjLmQvbWRjb25maWcyLHYKcmV0cmlldmlu ZyByZXZpc2lvbiAxLjQKZGlmZiAtdSAtcjEuNCBtZGNvbmZpZzIKLS0tIG1kY29uZmlnMgkzMSBE ZWMgMjAwNiAxMDozNzoxOCAtMDAwMAkxLjQKKysrIG1kY29uZmlnMgkxMSBNYXkgMjAwNyAxODox NTo1MyAtMDAwMApAQCAtMjIyLDYgKzIyMiwxNCBAQAogCQkJX21kY29uZmlnMl91bml0PSQoKCR7 X21kY29uZmlnMl91bml0fSArIDEpKQogCQlmaQogCWRvbmUKKwlpZiBbIC1uICIke21kY29uZmln Ml9saXN0fSIgXSA7IHRoZW4KKwkJZm9yIF9tZGNvbmZpZzJfZGV2IGluICR7bWRjb25maWcyX2xp c3R9IDsgZG8KKwkJCWV2YWwgX21kY29uZmlnMl9jb25maWc9XCRtZGNvbmZpZ18ke21kY29uZmln Ml9kZXZ9CisJCQlpZiBbIC1uICIke19tZGNvbmZpZzJfY29uZmlnfSIgXSA7IHRoZW4KKwkJCQlf bWRjb25maWcyX2xpc3Q9IiR7X21kY29uZmlnMl9saXN0fSR7X21kY29uZmlnMl9saXN0OisgfSR7 X21kY29uZmlnMl9kZXZ9IgorCQkJZmkKKwkJZG9uZQorCWZpCiBmaQogCQogcnVuX3JjX2NvbW1h bmQgIiR7X21kY29uZmlnMl9jbWR9Igo= ------=_Part_155205_17368898.1178908916030--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?790a9fff0705111141n3731f75at23aae6f0482bd638>