On 04/08/15 at 12:30am, Minfei Huang wrote:
The filesystem support the device to be mounted different mount
points.
^ Please add a
"on"
here.
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
^
change it to "in". ^ change it to vmcore.
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.
What do you mean here? In the end who is the mount point you want to
get? Please describe it clearly. Make people who don't talk to you face
to face can understand it.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
kdump-lib.sh | 11 ++++++++++-
mkdumprd | 8 ++------
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 2ad528e..75d7673 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -135,7 +135,16 @@ 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
+ return
You make a change against non bind mount case. non bind mount don't get
a mntpoint any more. Is that OK? And I don't see you explain it in patch
log.
+ fi
+ done
+
+ echo "Mount $1 firstly, without the bind mode" >&2
+ exit 1
}
# 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