Tidy up system shutdown.
This commit is contained in:
parent
b87323363c
commit
da6303bacc
@ -245,6 +245,9 @@ doadump(void)
|
||||
static void
|
||||
boot(int howto)
|
||||
{
|
||||
int first_buf_printf;
|
||||
|
||||
first_buf_printf = 1;
|
||||
|
||||
/* collect extra flags that shutdown_nice might have set */
|
||||
howto |= shutdown_howto;
|
||||
@ -272,7 +275,6 @@ boot(int howto)
|
||||
#endif
|
||||
|
||||
waittime = 0;
|
||||
printf("syncing disks, buffers remaining... ");
|
||||
|
||||
sync(&thread0, NULL);
|
||||
|
||||
@ -295,6 +297,10 @@ boot(int howto)
|
||||
}
|
||||
if (nbusy == 0)
|
||||
break;
|
||||
if (first_buf_printf) {
|
||||
printf("syncing disks, buffers remaining... ");
|
||||
first_buf_printf = 0;
|
||||
}
|
||||
printf("%d ", nbusy);
|
||||
if (nbusy < pbusy)
|
||||
iter = 0;
|
||||
@ -576,20 +582,22 @@ void
|
||||
kproc_shutdown(void *arg, int howto)
|
||||
{
|
||||
struct proc *p;
|
||||
char procname[MAXCOMLEN + 1];
|
||||
int error;
|
||||
|
||||
if (panicstr)
|
||||
return;
|
||||
|
||||
p = (struct proc *)arg;
|
||||
printf("Waiting (max %d seconds) for system process `%s' to stop...",
|
||||
kproc_shutdown_wait, p->p_comm);
|
||||
strlcpy(procname, p->p_comm, sizeof(procname));
|
||||
printf("Waiting (max %d seconds) for system process `%s' to stop...\n",
|
||||
kproc_shutdown_wait, procname);
|
||||
error = kthread_suspend(p, kproc_shutdown_wait * hz);
|
||||
|
||||
if (error == EWOULDBLOCK)
|
||||
printf("timed out\n");
|
||||
printf("Stop of '%s' timed out\n", procname);
|
||||
else
|
||||
printf("stopped\n");
|
||||
printf("Process '%s' stopped\n", procname);
|
||||
}
|
||||
|
||||
/* Registration of dumpers */
|
||||
|
@ -1546,10 +1546,12 @@ sched_sync(void)
|
||||
int last_work_seen;
|
||||
int net_worklist_len;
|
||||
int syncer_final_iter;
|
||||
int first_printf;
|
||||
|
||||
mtx_lock(&Giant);
|
||||
last_work_seen = 0;
|
||||
syncer_final_iter = 0;
|
||||
first_printf = 1;
|
||||
syncer_state = SYNCER_RUNNING;
|
||||
starttime = time_second;
|
||||
|
||||
@ -1561,12 +1563,20 @@ sched_sync(void)
|
||||
if (syncer_state == SYNCER_FINAL_DELAY &&
|
||||
syncer_final_iter == 0) {
|
||||
mtx_unlock(&sync_mtx);
|
||||
printf("done.\n");
|
||||
kthread_suspend_check(td->td_proc);
|
||||
mtx_lock(&sync_mtx);
|
||||
}
|
||||
net_worklist_len = syncer_worklist_len - sync_vnode_count;
|
||||
if (syncer_state != SYNCER_RUNNING && starttime != time_second)
|
||||
if (syncer_state != SYNCER_RUNNING &&
|
||||
starttime != time_second) {
|
||||
if (first_printf) {
|
||||
printf("Syncer syncing disks, "
|
||||
"buffers remaining... ");
|
||||
first_printf = 0;
|
||||
}
|
||||
printf("%d ", net_worklist_len);
|
||||
}
|
||||
starttime = time_second;
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user