Index: vfs_subr.c =================================================================== RCS file: /usr/cvs/src/sys/kern/vfs_subr.c,v retrieving revision 1.687 diff -u -r1.687 vfs_subr.c --- vfs_subr.c 31 Oct 2006 21:48:53 -0000 1.687 +++ vfs_subr.c 7 Nov 2006 18:33:22 -0000 @@ -1630,8 +1630,8 @@ EVENTHANDLER_REGISTER(shutdown_pre_sync, syncer_shutdown, td->td_proc, SHUTDOWN_PRI_LAST); + mtx_lock(&sync_mtx); for (;;) { - mtx_lock(&sync_mtx); if (syncer_state == SYNCER_FINAL_DELAY && syncer_final_iter == 0) { mtx_unlock(&sync_mtx); @@ -1696,7 +1696,6 @@ } if (syncer_state == SYNCER_FINAL_DELAY && syncer_final_iter > 0) syncer_final_iter--; - mtx_unlock(&sync_mtx); /* * The variable rushjob allows the kernel to speed up the * processing of the filesystem syncer process. A rushjob @@ -1707,13 +1706,10 @@ * ahead of the disk that the kernel memory pool is being * threatened with exhaustion. */ - mtx_lock(&sync_mtx); if (rushjob > 0) { rushjob -= 1; - mtx_unlock(&sync_mtx); continue; } - mtx_unlock(&sync_mtx); /* * Just sleep for a short period if time between * iterations when shutting down to allow some I/O @@ -1727,10 +1723,10 @@ * filesystem activity. */ if (syncer_state != SYNCER_RUNNING) - tsleep(&dummychan, PPAUSE, "syncfnl", + msleep(&dummychan, &sync_mtx, PPAUSE, "syncfnl", hz / SYNCER_SHUTDOWN_SPEEDUP); else if (time_uptime == starttime) - tsleep(&lbolt, PPAUSE, "syncer", 0); + msleep(&lbolt, &sync_mtx, PPAUSE, "syncer", 0); } }