mkdumprd: try to get mount options from fstab first

Previously if a target need mount info, the relevant mount options
are got from /proc/mounts by below command:
findmnt -k -f -n -r -o OPTIONS $_dev

This will bring problems. Since /proc/mounts will give out a set
which contains each option. Some options have value specified by
user, some options just have default value if user doesn't specify.
If some mount options are not supported very well, bugs occured.
The more options, the worse.

So in this patch, we try to check fstab to get mount options firstly,
this give user a chance to decide which options they really want.
If they don't give a fstab entry, then we trust all options in
/proc/mounts.

Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
Baoquan He 2014-09-04 17:38:17 +08:00 committed by WANG Chao
parent c88a6bb5b6
commit 0aa4890cc5
1 changed files with 2 additions and 1 deletions

View File

@ -104,7 +104,8 @@ to_mount() {
# 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=$(findmnt --fstab -f -n -r -o OPTIONS $_dev)
[ -z "$_options" ] && _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
_options=${_options/#ro/rw} #mount fs target as rw in 2nd kernel
# "x-initrd.mount" mount failure will trigger isolate emergency service
# W/o this, systemd won't isolate, thus we won't get to emergency.