On Mon, May 19, 2014 at 10:42:19PM +0800, WANG Chao wrote:
This patch does the following two changes in 2nd kernel:
a). dump target is mounted under /sysroot
b). append "x-initrd.mount" to the mount options.
Can you please break it down in two separate patches. They are two
distinct functionalities.
With a). we don't need to track what we've mounted in 2nd kernel. We
can just umount recursively every mount in /sysroot by command:
umount -R /sysroot
It's very convenient to do so, because it's hard to track what we've
mounted when we're in error handling path. So mount everything under
/sysroot is reasonable and practical for us.
With b). the mount unit becomes required by "initrd-root-fs.target"
rather than it used to be "local-fs.target".
The difference between "initrd-root-fs.target" and "local-fs.target"
is,
the former has OnFailureIsolate=yes but the later does not. From
system.unit(5):
OnFailureIsolate=
Takes a boolean argument. If true, the unit listed in OnFailure=
will be enqueued in isolation mode, i.e. all units that are not its
dependency will be stopped. If this is set, only a single unit may
be listed in OnFailure=. Defaults to false.
With OnFailure=emergency.target and OnFailureIsolate=yes, when error
occurred during the boot, systemd will "isolate" to emergency.target,
that means all the service will be stopped except the dependencies of
emergency.target. So that systemd boot process will be interrupt and
leave emergency.target as the only one running. Without the isolate,
systemd will continue to boot and emergency.target will be interrupted.
Both a) and b) are prerequisite for introducing kdump error handling
later.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
mkdumprd | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/mkdumprd b/mkdumprd
index b49b74f..a38d190 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -97,19 +97,20 @@ target_is_root() {
# caller should ensure $1 is valid and mounted in 1st kernel
to_mount() {
- local _dev=$1 _s _t _o _mntopts _pdev
-
- _s=$(findmnt -k -f -n -r -o SOURCE $_dev)
- _t=$(findmnt -k -f -n -r -o TARGET,FSTYPE $_dev)
- _o=$(findmnt -k -f -n -r -o OPTIONS $_dev)
- _o=${_o/#ro/rw} #mount fs target as rw in 2nd kernel
- # "nofail" mount could be run later than kdump.sh. So we don't pass
nofail
- # for short term.
- #_o="${_o},nofail" #with nofail set, systemd won't block for mount
failure
- _mntopts="$_t $_o"
+ local _dev=$1 _source _target _fstype _options _mntopts _pdev
+
+ _source=$(findmnt -k -f -n -r -o SOURCE $_dev)
+ _target=$(findmnt -k -f -n -r -o TARGET $_dev)
+ # mount under /sysroot in 2nd kernel, and we umount -R /sysroot before exit
+ _target="/sysroot$_target"
+ _fstype=$(findmnt -k -f -n -r -o FSTYPE $_dev)
+ _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
+ _options=${_options/#ro/rw} #mount fs target as rw in 2nd kernel
+ _options="$_options,x-initrd.mount"
I am not sure about using x-initrd.mount. I think this flag was introduced
so that if one wanted to mount a file system in initrd early, they can
specify this in /etc/fstab of root file system.
mounts which are part of /etc/fstab of dract (and not root), automatically
imply that they need to be mounted in initrd and they don't need this
flag.
You are using this flag because of dependencies and there are no
guarantees around that and it can change.
I think we need to raise this issue with dracut and systemd folks and ask
how do we make sure that if a file system specified in /etc/fstab of
initrd fails to mount, how do we enforce that we drop into emergency shell
(instead of continuing with the boot).
If they come back saying that use "x-initrd.mount", then so be it. Atleast
this point needs to be raised with dracut and systemd developers.
Thanks
Vivek
+ _mntopts="$_target $_fstype $_options"
#for non-nfs _dev converting to use udev persistent name
- if [ -b "$_s" ]; then
- _pdev="$(get_persistent_dev $_s)"
+ if [ -b "$_source" ]; then
+ _pdev="$(get_persistent_dev $_source)"
if [ $? -ne 0 ]; then
return 1
fi
--
1.9.0
_______________________________________________
kexec mailing list
kexec(a)lists.fedoraproject.org
https://lists.fedoraproject.org/mailman/listinfo/kexec