The Samba-Bugzilla – Attachment 5073 Details for
Bug 6979
ctdb fatal error on restoring nonzero scheudling priority
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
save off and restore the scheduling priority
0001-Save-and-restore-scheduling-policy.patch (text/plain), 2.40 KB, created by
Jim McDonough
on 2009-12-09 11:14:01 UTC
(
hide
)
Description:
save off and restore the scheduling priority
Filename:
MIME Type:
Creator:
Jim McDonough
Created:
2009-12-09 11:14:01 UTC
Size:
2.40 KB
patch
obsolete
>From b2239236a8954daadb95b8eaa85c96bf4975ccee Mon Sep 17 00:00:00 2001 >From: Jim McDonough <jmcd@samba.org> >Date: Wed, 9 Dec 2009 12:01:04 -0500 >Subject: [PATCH] Save and restore scheduling policy. > >Without this, if started with a non-zero priority, on the >restore, it will fail, because SCHED_OTHER only allows >a priority of zero. >--- > common/ctdb_util.c | 19 ++++++++++++++++--- > include/ctdb_private.h | 1 + > 2 files changed, 17 insertions(+), 3 deletions(-) > >diff --git a/common/ctdb_util.c b/common/ctdb_util.c >index 787d8d7..480ee50 100644 >--- a/common/ctdb_util.c >+++ b/common/ctdb_util.c >@@ -333,12 +333,21 @@ struct ctdb_rec_data *ctdb_marshall_loop_next(struct ctdb_marshall_buffer *m, st > */ > void ctdb_set_scheduler(struct ctdb_context *ctdb) > { >-#if HAVE_SCHED_SETSCHEDULER >+#if HAVE_SCHED_SETSCHEDULER > struct sched_param p; >+ >+ /* save off the policy */ >+ ctdb->saved_scheduler_policy = sched_getscheduler(0); >+ if (ctdb->saved_scheduler_policy == -1) { >+ DEBUG(DEBUG_CRIT,("Unable to get scheduler policy (%s)\n", >+ strerror(errno))); >+ return; >+ } >+ > if (ctdb->saved_scheduler_param == NULL) { > ctdb->saved_scheduler_param = talloc_size(ctdb, sizeof(p)); > } >- >+ > if (sched_getparam(0, (struct sched_param *)ctdb->saved_scheduler_param) == -1) { > DEBUG(DEBUG_ERR,("Unable to get old scheduler params\n")); > return; >@@ -362,10 +371,14 @@ void ctdb_set_scheduler(struct ctdb_context *ctdb) > void ctdb_restore_scheduler(struct ctdb_context *ctdb) > { > #if HAVE_SCHED_SETSCHEDULER >+ if (ctdb->saved_scheduler_policy == -1) { >+ ctdb_fatal(ctdb, "No saved scheduler policy\n"); >+ } > if (ctdb->saved_scheduler_param == NULL) { > ctdb_fatal(ctdb, "No saved scheduler parameters\n"); > } >- if (sched_setscheduler(0, SCHED_OTHER, (struct sched_param *)ctdb->saved_scheduler_param) == -1) { >+ if (sched_setscheduler(0, ctdb->saved_scheduler_policy, >+ (struct sched_param *)ctdb->saved_scheduler_param) == -1) { > ctdb_fatal(ctdb, "Unable to restore old scheduler parameters\n"); > } > #endif >diff --git a/include/ctdb_private.h b/include/ctdb_private.h >index 142bbd5..311b912 100644 >--- a/include/ctdb_private.h >+++ b/include/ctdb_private.h >@@ -434,6 +434,7 @@ struct ctdb_context { > struct ctdb_client_ip *client_ip_list; > bool do_setsched; > bool do_checkpublicip; >+ int saved_scheduler_policy; > void *saved_scheduler_param; > struct _trbt_tree_t *server_ids; > const char *event_script_dir; >-- >1.6.4.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 6979
: 5073