On Thu, May 08, 2014 at 07:37:13PM +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.
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
Why do we need to "umount" everything under /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):
I don't understand why do we need this. initrd-root-fs.target should be dependent only on root mount unit and no other mount unit. And if one can't mount root, that's a fatal failure and launching emergency shell in "Isolate" mode makes sense.
But not reaching local-fs.target should not be a fatal failure. One should still be able to continue with boot. And to me it makes sense that in this case emergecny shell is launched without isolating rest of the serivces.
That also means that if we fail to mount an nfs or non-root file system, we will fall into emergency shell with sysroot mounted? That's what we want.
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.
What do you mean by emergency.target will be interrupted.
Thanks Vivek
Both a) and b) are prerequisite for introducing kdump error handling later.
Signed-off-by: WANG Chao chaowang@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"
- _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@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec