summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWANG Chao <chaowang@redhat.com>2013-05-14 18:32:50 +0800
committerSimon Horman <horms@verge.net.au>2013-05-15 09:33:35 +0900
commit40e8e4009d1b946f2fe16b80f01edb01ee69f33a (patch)
treefb5fc4c13bd98d7893722727f10805ededc6697c
parentfe78022896d69a4c818039717eb9785798b16c9a (diff)
downloadkexec-tools-40e8e4009d1b946f2fe16b80f01edb01ee69f33a.tar.gz
kexec: check if memory is reserved only when loading kdump kernel.
When memory for crashkernel isn't reserved, it's confusing that kexec spits error message for unloading kdump kernel as if we were loading it: # kexec -p -u Memory for crashkernel is not reserved Please reserve memory by passing "crashkernel=X@Y" parameter to the kernel Then try loading kdump kernel # echo $? 1 It's more appropriate to test if memory is reserved only when loading kdump kernel. With this patch: # kexec -p -u # echo $? 0 It's also the same behavior with the case of trying to unload kernel from unloaded state. Signed-off-by: WANG Chao <chaowang@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/kexec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kexec/kexec.c b/kexec/kexec.c
index 911c0f68..6a13f791 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1175,7 +1175,8 @@ int main(int argc, char *argv[])
}
}
- if ((kexec_flags & KEXEC_ON_CRASH) && !is_crashkernel_mem_reserved()) {
+ if (do_load && (kexec_flags & KEXEC_ON_CRASH) &&
+ !is_crashkernel_mem_reserved()) {
die("Memory for crashkernel is not reserved\n"
"Please reserve memory by passing"
"\"crashkernel=X@Y\" parameter to kernel\n"