Please discard this patch. In mkdumprd we just add the mount info which will mount the needed device. In this stage we don't care the real dump path. Any point is OK, we just need care about the dump path. E.g on Atomic we have below mount point for lvm device. Then current code will take the first one, namely "/". It's fine, we just need dump to /ostree/deploy/rhel-atomic-host/var/crash.
-bash-4.2# findmnt -k -n -r -o TARGET /dev/mapper/atomicos-root / /sysroot /var /usr
On 03/04/15 at 01:07am, Minfei Huang wrote:
The filesystem support the device to be mounted different mount points. The root path in the device may be different, if the mount point is mounted by bind mode. In order to dump core correctly, we should find the root path in the device.
Following is the case that device is mounted by bind mode.
TARGET SOURCE FSTYPE OPTIONS /mnt/ext4 /dev/vda btrfs rw,relatime,seclabel,space_cache TARGET SOURCE FSTYPE OPTIONS /mnt/bind-dir /dev/vda[/var] btrfs rw,relatime,seclabel,space_cache
We can find that /mnt/bind-dir is mounted in the path /dev/vda[/var], in the other word, the /mnt/bind-dir points to the /var directory in the /dev/vda. The /mnt/ext4 is the root path in the device.
Signed-off-by: Minfei Huang mhuang@redhat.com
kdump-lib.sh | 7 ++++++- mkdumprd | 8 ++------ 2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 74b3c1c..4301eb4 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -135,7 +135,12 @@ get_fs_type_from_target()
get_mntpoint_from_target() {
- echo $(findmnt -k -f -n -r -o TARGET $1)
- for _mnt in $(findmnt -k -n -r -o TARGET $1)
- do
if ! is_bind_mount $_mnt; then
echo $_mnt
fi
- done
}
# get_option_value <option_name> diff --git a/mkdumprd b/mkdumprd index a8f9cbb..7fdcebf 100644 --- a/mkdumprd +++ b/mkdumprd @@ -100,7 +100,7 @@ to_mount() { 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)
- _target=$(get_mntpoint_from_target $_dev) # mount under /sysroot if dump to root disk or mount under #/kdumproot/$_target in other cases in 2nd kernel. systemd #will be in charge to umount it.
@@ -144,10 +144,6 @@ to_mount() { echo "$_pdev $_mntopts" }
-to_mount_point() {
- echo $(findmnt -k -f -n -r -o TARGET $1)
-}
is_readonly_mount() { local _mnt _mnt=$(findmnt -k -f -n -r -o OPTIONS $1) @@ -201,7 +197,7 @@ mkdir_save_path_ssh() #Function: get_fs_size #$1=dump target get_fs_size() {
- local _mnt=$(to_mount_point $1)
- local _mnt=$(get_mntpoint_from_target $1) echo -n $(df -P "${_mnt}/$SAVE_PATH"|tail -1|awk '{print $4}')
}
-- 1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec