If no sync flag specified and mount the dump device with default
option, it will be mounted with async flag. User space programs
such as makedumpfile, when trying to write vmcore to thinp
target, will not know if the autoextend of thin pool fails:
[ 3.895165] kdump[703]: saving vmcore
[ 4.084815] device-mapper: thin: 253:2: reached low water mark for data device: sending
event.
[ 4.086282] device-mapper: thin: 253:2: switching pool to out-of-data-space (queue IO)
mode
[ 66.528180] device-mapper: thin: 253:2: switching pool to out-of-data-space (error IO)
mode
[ 66.531791] EXT4-fs warning (device dm-3): ext4_end_bio:323: I/O error 3 writing to
inode 131075 (offset 5259264 size 2580480 starting block 36608)
[ 66.536132] Buffer I/O error on device dm-3, logical block 36100
...
[ 66.557164] JBD2: Detected IO errors while flushing file data on dm-3-8
Copying data : [100.0 %] - eta: 0s
[ 67.247209] kdump.sh[704]: The dumpfile is saved to
/kdumproot/mnt///127.0.0.1-2022-04-07-17:41:31/vmcore-incomplete.
[ 67.248769] kdump.sh[704]: makedumpfile Completed.
[ 67.278042] JBD2: Detected IO errors while flushing file data on dm-3-8
[ 67.327795] kdump[709]: saving vmcore complete
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ User space program doesn't know
incomplete saving
In this patch, if we are dumping to lvm2 thinp target, we will mount
the device with sync flag, so the user space program will know
immediately if autoextend fails, so it can be handled properly.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
mkdumprd | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mkdumprd b/mkdumprd
index 3e250e0..a9c24c0 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -81,6 +81,11 @@ to_mount()
fi
fi
+ # mount lvm2 thinp target with sync option, so user process will know
+ # immediately if thin pool autoextend fails.
+ is_lvm2_thinp_dump_target $_target &&
+ _sed_cmd+='s/\(^\|,\)async\($\|,\)/\1/g;' &&
+ _sed_cmd+='s/$/,sync/;'
# mount fs target as rw in 2nd kernel
_sed_cmd+='s/\(^\|,\)ro\($\|,\)/\1rw\2/g;'
# with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
--
2.33.1