On 03/13/14 at 11:37am, WANG Chao wrote:
On 03/12/14 at 05:59pm, Baoquan He wrote:
+#handle the case user does not specify the dump target explicitly
> +handle_default_dump_target()
> {
> local _target
> local _mntpoint
> + local _ret
>
> _target=$(get_user_configured_dump_disk)
> [ -n "$_target" ] && return
> @@ -368,11 +368,16 @@ check_block_dump_target()
> _target=$(get_root_fs_device)
> if [ -b "$_target" ]; then
> mkdir -p $SAVE_PATH
> - _mntpoint=`df $SAVE_PATH | tail -1 | awk '{print $NF}'`
> + _ret=$?
> + if [ $_ret -ne 0 ]; then
> + perror_exit "mkdir failed on $SAVE_PATH"
> + fi
> + _mntpoint=$(df $SAVE_PATH | tail -1 | awk '{print $NF}')
How about using `findmnt -n -T $SAVE_PATH -o TARGET` instead of df ...
Sorry, forget to reply. As we talked, it's the same as "df".
"path" need
be created in advance for old code. I will try Vivek's suggestion that
user need make sure "path" is existing.
> if [ "$_mntpoint" != "/" ]; then
> - perror "No dump target specified. Default dump target is rootfs
block device."
> - perror "But dump path $SAVE_PATH is not backed by rootfs block
device. "
> - perror_exit "Either explicitly specify a dump target or specify a
dump path backed by rootfs block device"
> + SAVE_PATH=$(echo $SAVE_PATH | sed "s,$_mntpoint,,")
How about using ${SAVE_PATH##$_mntpoint}
Better, will use.
Baoquan
Thanks
> + _target=$(findmnt -k -f -n -o SOURCE $_mntpoint)
> + add_mount "$_target"
> + check_size fs $_target