On 07/11/2014 07:03 PM, Vivek Goyal wrote:
On Thu, Jun 12, 2014 at 08:26:22PM +0530, Hari Bathini wrote:
> The script dracut-kdump.sh is responsible for capturing vmcore during
> second kernel boot. Currently this script gets installed into kdump
> initrd as part of kdumpbase dracut module. Since it's always installed
> into kdump initrd, this script assumes that '/proc/vmcore' will always
> be present when it is invoked.
>
> With fadump support, 'dracut-kdump.sh' script also gets installed into
> default initrd to capture vmcore generated by firmware assisted dump.
> Thus in fadump case, the same initrd is going to be used for normal
> boot as well as boot after system crash. Hence a check is required to
> see if '/proc/vmcore' file exists before executing steps to capture
> vmcore. This check will help to bypass the vmcore capture steps during
> normal boot process.
>
> Signed-off-by: Mahesh Salgaonkar <mahesh(a)linux.vnet.ibm.com>
> ---
> dracut-kdump.sh | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/dracut-kdump.sh b/dracut-kdump.sh
> index cb13d92..55ac8bc 100755
> --- a/dracut-kdump.sh
> +++ b/dracut-kdump.sh
> @@ -1,5 +1,8 @@
> #!/bin/sh
>
> +# continue only if /proc/vmcore is present.
> +[ ! -f /proc/vmcore ] && return
> +
How do we know if it is an error or it is fadump case. What if due to
some bug /proc/vmcore is not present in case of kdump. We would like
to detect that case and give proper error message.
I think you need to drop some kind of file in initramfs which tells you
that you are running from an initramfs built for fadump. Say
"fadump_initramfs". This can be done during initramfs build process.
A file inside initramfs may not work, as once the initramfs is built,
it will be used for normal as well as kdump kernel.
We may need to think of something else..
But looking at the code, the chances of /proc/vmcore not being present
seem very slim..
Thanks
Hari
And then check for presence of that file and return.
Thanks
Vivek