Ccing him. Karel, can you help reviewing this patch to differenciate
bind mount?
On 02/10/15 at 06:46pm, Minfei Huang wrote:
The crash dump is saved in the /sysroot/crash directory, not the
/sysroot/var/crash in the atomic system.
We found we have the uncorrect dump directory, when we use command
"findmnt" to find the dump directory's mountpoint which is a bind
mounted directory.
To solve this issue, we should determine the real mountpont, if the
directory is a bind mounted directory.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
kdump-lib.sh | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index f24f08d..e4df376 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -86,9 +86,41 @@ get_root_fs_device()
return
}
+# findmnt uses the option "-v, --nofsroot" to exclusive the [/dir]
+# in the SOURCE column for bind-mounts, then if $_dev equals to
+# $_dev_no_bind, the mountpoint is not bind mounted directory.
+is_bind_mount()
+{
+ local _dev=$(findmnt -k -n -r -o SOURCE $1)
+ local _dev_no_bind=$(findmnt -k -n -r -v -o SOURCE $1)
+
+ if [[ $_dev = $_dev_no_bind ]]; then
+ return 1
+ else
+ return 0
+ fi
+}
+
+# We are looking to see if a part of dump path is mounted on some disk.
+# But we don't want to look for bind mounted directories. So we should
+# determine the real mountpoint, if the directory is a bind mounted
+# directory.
get_mntpoint_from_path()
{
- echo $(df $1 | tail -1 | awk '{print $NF}')
+ local _mnt=$(df $1 | tail -1 | awk '{print $NF}')
+
+ if is_bind_mount $mnt; then
+ # bind mounted directory, we should find the real mount point
+ # where the device mounts.
+ for m in `findmnt -k -n -r -o TARGET $_dev_no_bind`; do
+ if ! is_bind_mount $m; then
+ echo $m
+ break
+ fi
+ done
+ else
+ echo $_mnt
+ fi
}
get_target_from_path()
--
2.2.2
_______________________________________________
kexec mailing list
kexec(a)lists.fedoraproject.org
https://lists.fedoraproject.org/mailman/listinfo/kexec