Yet another tweak to the shutdown messages in boot():
Don't count busy buffers before the initial call to sync() and don't skip the initial sync() if no busy buffers were called. Always call sync() at least once if syncing is requested. This defers the "Syncing disks, buffers remaining..." message until after the initial sync() call and the first count of busy buffers. This backs out changes in kern_shutdown 1.162. Print a different message when there are no busy buffers after the initial sync(), which is now the expected situation. Print an additional message when syncing has completed successfully in the unusual situation where the work of syncing was done by boot(). Uppercase one message to make it consistent with all of the other kernel shutdown messages. Discussed with: bde (in a much earlier form, prior to 1.162) Reviewed by: njl (in an earlier form)
This commit is contained in:
parent
e3edab4a91
commit
b6915bdbe5
@ -255,6 +255,7 @@ doadump(void)
|
||||
static void
|
||||
boot(int howto)
|
||||
{
|
||||
static int first_buf_printf = 1;
|
||||
|
||||
/* collect extra flags that shutdown_nice might have set */
|
||||
howto |= shutdown_howto;
|
||||
@ -281,18 +282,7 @@ boot(int howto)
|
||||
int subiter;
|
||||
#endif
|
||||
|
||||
for (nbusy = 0, bp = &buf[nbuf]; --bp >= buf; )
|
||||
if (((bp->b_flags & B_INVAL) == 0 &&
|
||||
BUF_REFCNT(bp) > 0) ||
|
||||
((bp->b_flags & (B_DELWRI|B_INVAL)) == B_DELWRI))
|
||||
nbusy++;
|
||||
if (nbusy == 0) {
|
||||
printf("Skipping final sync, no buffers remaining\n");
|
||||
goto unmountall;
|
||||
}
|
||||
|
||||
waittime = 0;
|
||||
printf("Syncing disks, buffers remaining... ");
|
||||
|
||||
sync(&thread0, NULL);
|
||||
|
||||
@ -313,8 +303,15 @@ boot(int howto)
|
||||
nbusy++;
|
||||
}
|
||||
}
|
||||
if (nbusy == 0)
|
||||
if (nbusy == 0) {
|
||||
if (first_buf_printf)
|
||||
printf("No buffers busy after final sync");
|
||||
break;
|
||||
}
|
||||
if (first_buf_printf) {
|
||||
printf("Syncing disks, buffers remaining... ");
|
||||
first_buf_printf = 0;
|
||||
}
|
||||
printf("%d ", nbusy);
|
||||
if (nbusy < pbusy)
|
||||
iter = 0;
|
||||
@ -345,7 +342,6 @@ boot(int howto)
|
||||
#endif
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
/*
|
||||
* Count only busy local buffers to prevent forcing
|
||||
* a fsck if we're just a client of a wedged NFS server
|
||||
@ -374,13 +370,14 @@ boot(int howto)
|
||||
* Failed to sync all blocks. Indicate this and don't
|
||||
* unmount filesystems (thus forcing an fsck on reboot).
|
||||
*/
|
||||
printf("giving up on %d buffers\n", nbusy);
|
||||
printf("Giving up on %d buffers\n", nbusy);
|
||||
DELAY(5000000); /* 5 seconds */
|
||||
} else {
|
||||
if (!first_buf_printf)
|
||||
printf("Final sync complete\n");
|
||||
/*
|
||||
* Unmount filesystems
|
||||
*/
|
||||
unmountall:
|
||||
if (panicstr == 0)
|
||||
vfs_unmountall();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user