kexec: implement -y (--no-sync) option
Subsystems (2)
PATCH 1/2 kexec: implement -y (--no-sync) option
From a32a35e46a950cd0e4b4e317a9062c41e79fbfeb Mon Sep 17 00:00:00 2001
From: Tejun Heo <[email protected]>
Date: Thu, 26 Mar 2015 14:56:26 -0400
During kernel develoment, kexec can be used to get out of sticky situations without going through possibly lenghty reboot; however, there are situations where the filesystem and/or storage stack are known to be misbehaving and performing sync before kexecing is dangerous or just never finishes.
This patch implement -y (--no-sync) option which makes kexec skip syncing in the similar way as -x (--no-ifdown).
--- kexec/kexec.8 | 8 ++++++-- kexec/kexec.c | 8 +++++++- kexec/kexec.h | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-)
kexec/kexec.8 +6 -2
@@ -6,7 +6,7 @@ kexec \- directly boot into a new kernel .SH SYNOPSIS .B /sbin/kexec -.B [-v (\-\-version)] [-f (\-\-force)] [-x (\-\-no-ifdown)] [-l (\-\-load)] [-p (\-\-load-panic)] [-u (\-\-unload)] [-e (\-\-exec)] [-t (\-\-type)] +.B [-v (\-\-version)] [-f (\-\-force)] [-x (\-\-no-ifdown)] [-y (\-\-no-sync)] [-l (\-\-load)] [-p (\-\-load-panic)] [-u (\-\-unload)] [-e (\-\-exec)] [-t (\-\-type)] .BI [\-\-mem\-min= addr ] .BI [\-\-mem\-max= addr ]
@@ -148,7 +148,11 @@ Return the version number of the installed utility. .TP .B \-x\ (\-\-no\-ifdown) Shut down the running kernel, but restore the interface on reload. (If -this option is used, it must be specified last.) +this option is used, it must be one of last options specified.) +.TP +.B \-y\ (\-\-no\-sync) +Shut down the running kernel, but skip syncing the filesystems. (If +this option is used, it must be one of last options specified.) .TP .BI \-\-mem\-min= addr Specify the lowest memory address
kexec/kexec.c +7 -1
@@ -913,7 +913,10 @@ void usage(void)" -f, --force Force an immediate kexec,\n" " don't call shutdown.\n" " -x, --no-ifdown Don't bring down network interfaces.\n" -" (if used, must be last option\n" +" (if used, must be one of last options\n" +" specified)\n" +" -y, --no-sync Don't sync filesystems before kexec.\n" +" (if used, must be one of last options\n" " specified)\n" " -l, --load Load the new kernel into the\n" " current kernel.\n"
@@ -1218,6 +1221,9 @@ int main(int argc, char *argv[])case OPT_NOIFDOWN : do_ifdown =0 ;break ; +case OPT_NOSYNC : + do_sync =0 ; +break ;case OPT_FORCE : do_load =1 ; do_shutdown =0 ;
kexec/kexec.h +3 -1
@@ -209,6 +209,7 @@ extern int file_types;#define OPT_DEBUG 'd'#define OPT_FORCE 'f'#define OPT_NOIFDOWN 'x' +#define OPT_NOSYNC 'y'#define OPT_EXEC 'e'#define OPT_LOAD 'l'#define OPT_UNLOAD 'u'
@@ -227,6 +228,7 @@ extern int file_types; { "version", 0, 0, OPT_VERSION }, \ { "force", 0, 0, OPT_FORCE }, \ { "no-ifdown", 0, 0, OPT_NOIFDOWN }, \ + { "no-sync", 0, 0, OPT_NOSYNC }, \ { "load", 0, 0, OPT_LOAD }, \ { "unload", 0, 0, OPT_UNLOAD }, \ { "exec", 0, 0, OPT_EXEC }, \
@@ -241,7 +243,7 @@ extern int file_types; { "kexec-file-syscall", 0, 0, OPT_KEXEC_FILE_SYSCALL }, \ { "debug", 0, 0, OPT_DEBUG }, \ -#define KEXEC_OPT_STR "h?vdfxluet:ps" +#define KEXEC_OPT_STR "h?vdfxyluet:ps" extern void dbgprint_mem_range(const char *prefix, struct memory_range *mr, int nr_mr);extern void die (const char *fmt, ...)
Signature · 7 lines
2.1.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 2/2 kexec: remove ordering constraints from -x (--no-ifdown) and -y (--no-sync)
From 81b5889b49f0f2448c3e9543c5c936d52348910c Mon Sep 17 00:00:00 2001
From: Tejun Heo <[email protected]>
Date: Thu, 26 Mar 2015 15:11:09 -0400
Currently, the two options must be the last ones to be honored; otherwise, they can get silently ignored and both the manpage and help text point it out. This is error-prone and trivial to fix. There isn't much point in pointing something out in documentation when the peculiarity can be removed with four lines of extra code.
Update option handling so that the two arguments are honored regardless of their positions.
--- kexec/kexec.8 | 6 ++---- kexec/kexec.c | 17 +++++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-)
kexec/kexec.8 +2 -4
@@ -147,12 +147,10 @@ target kernel. If a capture kernel is being unloaded then specify -p with -u. Return the version number of the installed utility. .TP .B \-x\ (\-\-no\-ifdown) -Shut down the running kernel, but restore the interface on reload. (If -this option is used, it must be one of last options specified.) +Shut down the running kernel, but restore the interface on reload. .TP .B \-y\ (\-\-no\-sync) -Shut down the running kernel, but skip syncing the filesystems. (If -this option is used, it must be one of last options specified.) +Shut down the running kernel, but skip syncing the filesystems. .TP .BI \-\-mem\-min= addr Specify the lowest memory address
kexec/kexec.c +9 -8
@@ -913,11 +913,7 @@ void usage(void)" -f, --force Force an immediate kexec,\n" " don't call shutdown.\n" " -x, --no-ifdown Don't bring down network interfaces.\n" -" (if used, must be one of last options\n" -" specified)\n" " -y, --no-sync Don't sync filesystems before kexec.\n" -" (if used, must be one of last options\n" -" specified)\n" " -l, --load Load the new kernel into the\n" " current kernel.\n" " -p, --load-panic Load the new kernel for use on panic.\n"
@@ -1170,8 +1166,8 @@ int main(int argc, char *argv[])int do_exec =0 ;int do_load_jump_back_helper =0 ;int do_shutdown =1 ; -int do_sync =1 ; -int do_ifdown =0 ; +int do_sync =1 , skip_sync =0 ; +int do_ifdown =0 , skip_ifdown =0 ;int do_unload =0 ;int do_reuse_initrd =0 ;int do_kexec_file_syscall =0 ;
@@ -1219,10 +1215,10 @@ int main(int argc, char *argv[])case OPT_DEBUG : kexec_debug =1 ;case OPT_NOIFDOWN : - do_ifdown =0 ; + skip_ifdown =1 ;break ;case OPT_NOSYNC : - do_sync =0 ; + skip_sync =1 ;break ;case OPT_FORCE : do_load =1 ;
@@ -1321,6 +1317,11 @@ int main(int argc, char *argv[]) } } +if (skip_ifdown) + do_ifdown =0 ; +if (skip_sync) + do_sync =0 ; +if (do_load && (kexec_flags &KEXEC_ON_CRASH ) && !is_crashkernel_mem_reserved ()) { die("Memory for crashkernel is not reserved\n"
Signature · 7 lines
2.1.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 2/2] kexec: remove ordering constraints from -x (--no-ifdown) and -y (--no-sync)
Quoted 10 lines · Tejun Heo
From
81b5889b49f0f2448c3e9543c5c936d52348910cMon Sep 17 00:00:00 2001
From: Tejun Heo <[email protected]>
Date: Thu, 26 Mar 2015 15:11:09 -0400Currently, the two options must be the last ones to be honored; otherwise, they can get silently ignored and both the manpage and help text point it out. This is error-prone and trivial to fix. There isn't much point in pointing something out in documentation when the peculiarity can be removed with four lines of extra code.
Quoted 4 lines
Update option handling so that the two arguments are honored regardless of their positions.
Signed-off-by Tejun Heo <[email protected]>
Ping?
Thanks.
Signature · 6 lines
tejun _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 2/2] kexec: remove ordering constraints from -x (--no-ifdown) and -y (--no-sync)
Quoted 11 lines · Tejun Heo
Quoted 10 lines · Tejun Heo
From
81b5889b49f0f2448c3e9543c5c936d52348910cMon Sep 17 00:00:00 2001
From: Tejun Heo <[email protected]>
Date: Thu, 26 Mar 2015 15:11:09 -0400Currently, the two options must be the last ones to be honored; otherwise, they can get silently ignored and both the manpage and help text point it out. This is error-prone and trivial to fix. There isn't much point in pointing something out in documentation when the peculiarity can be removed with four lines of extra code.
Quoted 6 lines
Quoted 4 lines
Update option handling so that the two arguments are honored regardless of their positions.
Signed-off-by Tejun Heo <[email protected]>Ping?
Hi Tejun,
For some reason I don't seem to have this patch in my inbox. Could you repost it?
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 1/2 kexec: implement -y (--no-sync) option
From a32a35e46a950cd0e4b4e317a9062c41e79fbfeb Mon Sep 17 00:00:00 2001
From: Tejun Heo <[email protected]>
Date: Thu, 26 Mar 2015 14:56:26 -0400
During kernel develoment, kexec can be used to get out of sticky situations without going through possibly lenghty reboot; however, there are situations where the filesystem and/or storage stack are known to be misbehaving and performing sync before kexecing is dangerous or just never finishes.
This patch implement -y (--no-sync) option which makes kexec skip syncing in the similar way as -x (--no-ifdown).
---
Hello, Simon.
Heh, weird. Let's see if it goes through this time.
Thanks.
kexec/kexec.8 | 8 ++++++-- kexec/kexec.c | 8 +++++++- kexec/kexec.h | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-)
kexec/kexec.8 +6 -2
@@ -6,7 +6,7 @@ kexec \- directly boot into a new kernel .SH SYNOPSIS .B /sbin/kexec -.B [-v (\-\-version)] [-f (\-\-force)] [-x (\-\-no-ifdown)] [-l (\-\-load)] [-p (\-\-load-panic)] [-u (\-\-unload)] [-e (\-\-exec)] [-t (\-\-type)] +.B [-v (\-\-version)] [-f (\-\-force)] [-x (\-\-no-ifdown)] [-y (\-\-no-sync)] [-l (\-\-load)] [-p (\-\-load-panic)] [-u (\-\-unload)] [-e (\-\-exec)] [-t (\-\-type)] .BI [\-\-mem\-min= addr ] .BI [\-\-mem\-max= addr ]
@@ -148,7 +148,11 @@ Return the version number of the installed utility. .TP .B \-x\ (\-\-no\-ifdown) Shut down the running kernel, but restore the interface on reload. (If -this option is used, it must be specified last.) +this option is used, it must be one of last options specified.) +.TP +.B \-y\ (\-\-no\-sync) +Shut down the running kernel, but skip syncing the filesystems. (If +this option is used, it must be one of last options specified.) .TP .BI \-\-mem\-min= addr Specify the lowest memory address
kexec/kexec.c +7 -1
@@ -913,7 +913,10 @@ void usage(void)" -f, --force Force an immediate kexec,\n" " don't call shutdown.\n" " -x, --no-ifdown Don't bring down network interfaces.\n" -" (if used, must be last option\n" +" (if used, must be one of last options\n" +" specified)\n" +" -y, --no-sync Don't sync filesystems before kexec.\n" +" (if used, must be one of last options\n" " specified)\n" " -l, --load Load the new kernel into the\n" " current kernel.\n"
@@ -1218,6 +1221,9 @@ int main(int argc, char *argv[])case OPT_NOIFDOWN : do_ifdown =0 ;break ; +case OPT_NOSYNC : + do_sync =0 ; +break ;case OPT_FORCE : do_load =1 ; do_shutdown =0 ;
kexec/kexec.h +3 -1
@@ -209,6 +209,7 @@ extern int file_types;#define OPT_DEBUG 'd'#define OPT_FORCE 'f'#define OPT_NOIFDOWN 'x' +#define OPT_NOSYNC 'y'#define OPT_EXEC 'e'#define OPT_LOAD 'l'#define OPT_UNLOAD 'u'
@@ -227,6 +228,7 @@ extern int file_types; { "version", 0, 0, OPT_VERSION }, \ { "force", 0, 0, OPT_FORCE }, \ { "no-ifdown", 0, 0, OPT_NOIFDOWN }, \ + { "no-sync", 0, 0, OPT_NOSYNC }, \ { "load", 0, 0, OPT_LOAD }, \ { "unload", 0, 0, OPT_UNLOAD }, \ { "exec", 0, 0, OPT_EXEC }, \
@@ -241,7 +243,7 @@ extern int file_types; { "kexec-file-syscall", 0, 0, OPT_KEXEC_FILE_SYSCALL }, \ { "debug", 0, 0, OPT_DEBUG }, \ -#define KEXEC_OPT_STR "h?vdfxluet:ps" +#define KEXEC_OPT_STR "h?vdfxyluet:ps" extern void dbgprint_mem_range(const char *prefix, struct memory_range *mr, int nr_mr);extern void die (const char *fmt, ...)
Signature · 7 lines
2.1.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 2/2 kexec: remove ordering constraints from -x (--no-ifdown) and -y (--no-sync)
From 81b5889b49f0f2448c3e9543c5c936d52348910c Mon Sep 17 00:00:00 2001
From: Tejun Heo <[email protected]>
Date: Thu, 26 Mar 2015 15:11:09 -0400
Currently, the two options must be the last ones to be honored; otherwise, they can get silently ignored and both the manpage and help text point it out. This is error-prone and trivial to fix. There isn't much point in pointing something out in documentation when the peculiarity can be removed with four lines of extra code.
Update option handling so that the two arguments are honored regardless of their positions.
--- kexec/kexec.8 | 6 ++---- kexec/kexec.c | 17 +++++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-)
kexec/kexec.8 +2 -4
@@ -147,12 +147,10 @@ target kernel. If a capture kernel is being unloaded then specify -p with -u. Return the version number of the installed utility. .TP .B \-x\ (\-\-no\-ifdown) -Shut down the running kernel, but restore the interface on reload. (If -this option is used, it must be one of last options specified.) +Shut down the running kernel, but restore the interface on reload. .TP .B \-y\ (\-\-no\-sync) -Shut down the running kernel, but skip syncing the filesystems. (If -this option is used, it must be one of last options specified.) +Shut down the running kernel, but skip syncing the filesystems. .TP .BI \-\-mem\-min= addr Specify the lowest memory address
kexec/kexec.c +9 -8
@@ -913,11 +913,7 @@ void usage(void)" -f, --force Force an immediate kexec,\n" " don't call shutdown.\n" " -x, --no-ifdown Don't bring down network interfaces.\n" -" (if used, must be one of last options\n" -" specified)\n" " -y, --no-sync Don't sync filesystems before kexec.\n" -" (if used, must be one of last options\n" -" specified)\n" " -l, --load Load the new kernel into the\n" " current kernel.\n" " -p, --load-panic Load the new kernel for use on panic.\n"
@@ -1170,8 +1166,8 @@ int main(int argc, char *argv[])int do_exec =0 ;int do_load_jump_back_helper =0 ;int do_shutdown =1 ; -int do_sync =1 ; -int do_ifdown =0 ; +int do_sync =1 , skip_sync =0 ; +int do_ifdown =0 , skip_ifdown =0 ;int do_unload =0 ;int do_reuse_initrd =0 ;int do_kexec_file_syscall =0 ;
@@ -1219,10 +1215,10 @@ int main(int argc, char *argv[])case OPT_DEBUG : kexec_debug =1 ;case OPT_NOIFDOWN : - do_ifdown =0 ; + skip_ifdown =1 ;break ;case OPT_NOSYNC : - do_sync =0 ; + skip_sync =1 ;break ;case OPT_FORCE : do_load =1 ;
@@ -1321,6 +1317,11 @@ int main(int argc, char *argv[]) } } +if (skip_ifdown) + do_ifdown =0 ; +if (skip_sync) + do_sync =0 ; +if (do_load && (kexec_flags &KEXEC_ON_CRASH ) && !is_crashkernel_mem_reserved ()) { die("Memory for crashkernel is not reserved\n"
Signature · 7 lines
2.1.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Hi Tejun,
Quoted 13 lines · Tejun Heo
Quoted 1 line
From
a32a35e46a950cd0e4b4e317a9062c41e79fbfebMon Sep 17 00:00:00 2001From: Tejun Heo <[email protected]>
Date: Thu, 26 Mar 2015 14:56:26 -0400During kernel develoment, kexec can be used to get out of sticky situations without going through possibly lenghty reboot; however, there are situations where the filesystem and/or storage stack are known to be misbehaving and performing sync before kexecing is dangerous or just never finishes.
This patch implement -y (--no-sync) option which makes kexec skip syncing in the similar way as -x (--no-ifdown).
Quoted 6 lines
Signed-off-by Tejun Heo <[email protected]>Suggested-by Chris Mason <[email protected]>---
Hello, Simon.Heh, weird. Let's see if it goes through this time.
Indeed. I have the patches this time.
They both look good and I have applied them.
Quoted 91 lines
Thanks.
kexec/kexec.8 | 8 ++++++-- kexec/kexec.c | 8 +++++++- kexec/kexec.h | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-)kexec/kexec.8 +6
-2@@ -6,7 +6,7 @@ kexec \- directly boot into a new kernel .SH SYNOPSIS .B /sbin/kexec -.B [-v (\-\-version)] [-f (\-\-force)] [-x (\-\-no-ifdown)] [-l (\-\-load)] [-p (\-\-load-panic)] [-u (\-\-unload)] [-e (\-\-exec)] [-t (\-\-type)] +.B [-v (\-\-version)] [-f (\-\-force)] [-x (\-\-no-ifdown)] [-y (\-\-no-sync)] [-l (\-\-load)] [-p (\-\-load-panic)] [-u (\-\-unload)] [-e (\-\-exec)] [-t (\-\-type)] .BI [\-\-mem\-min= addr ] .BI [\-\-mem\-max= addr ]@@ -148,7 +148,11 @@ Return the version number of the installed utility. .TP .B \-x\ (\-\-no\-ifdown) Shut down the running kernel, but restore the interface on reload. (If -this option is used, it must be specified last.) +this option is used, it must be one of last options specified.) +.TP +.B \-y\ (\-\-no\-sync) +Shut down the running kernel, but skip syncing the filesystems. (If +this option is used, it must be one of last options specified.) .TP .BI \-\-mem\-min= addr Specify the lowest memory addresskexec/kexec.c +7
-1@@ -913,7 +913,10 @@ void usage(void)" -f, --force Force an immediate kexec,\n" " don't call shutdown.\n" " -x, --no-ifdown Don't bring down network interfaces.\n" -" (if used, must be last option\n" +" (if used, must be one of last options\n" +" specified)\n" +" -y, --no-sync Don't sync filesystems before kexec.\n" +" (if used, must be one of last options\n" " specified)\n" " -l, --load Load the new kernel into the\n" " current kernel.\n" @@ -1218,6 +1221,9 @@ int main(int argc, char *argv[])case OPT_NOIFDOWN : do_ifdown =0 ;break ; +case OPT_NOSYNC : + do_sync =0 ; +break ;case OPT_FORCE : do_load =1 ; do_shutdown =0 ;kexec/kexec.h +3
-1@@ -209,6 +209,7 @@ extern int file_types;#define OPT_DEBUG 'd'#define OPT_FORCE 'f'#define OPT_NOIFDOWN 'x' +#define OPT_NOSYNC 'y'#define OPT_EXEC 'e'#define OPT_LOAD 'l'#define OPT_UNLOAD 'u'@@ -227,6 +228,7 @@ extern int file_types; { "version", 0, 0, OPT_VERSION }, \ { "force", 0, 0, OPT_FORCE }, \ { "no-ifdown", 0, 0, OPT_NOIFDOWN }, \ + { "no-sync", 0, 0, OPT_NOSYNC }, \ { "load", 0, 0, OPT_LOAD }, \ { "unload", 0, 0, OPT_UNLOAD }, \ { "exec", 0, 0, OPT_EXEC }, \@@ -241,7 +243,7 @@ extern int file_types; { "kexec-file-syscall", 0, 0, OPT_KEXEC_FILE_SYSCALL }, \ { "debug", 0, 0, OPT_DEBUG }, \ -#define KEXEC_OPT_STR "h?vdfxluet:ps" +#define KEXEC_OPT_STR "h?vdfxyluet:ps" extern void dbgprint_mem_range(const char *prefix, struct memory_range *mr, int nr_mr);extern void die (const char *fmt, ...)Signature · 1 line
2.1.0
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 4 lines · Simon Horman
Quoted 1 line
Heh, weird. Let's see if it goes through this time.
Indeed. I have the patches this time.
They both look good and I have applied them.
Awesome, thanks!
Signature · 6 lines
tejun _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec