diff options
author | truckman <truckman@FreeBSD.org> | 2004-07-05 21:32:01 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2004-07-05 21:32:01 +0000 |
commit | 690b842bc55872b2b6a648925842b29f58daf63c (patch) | |
tree | 6b19dcf5121a3a4a411b9f7668b749e6c7b37092 | |
parent | 782281411585b11c71b5fc34d535c71848a7efd9 (diff) | |
download | FreeBSD-src-690b842bc55872b2b6a648925842b29f58daf63c.zip FreeBSD-src-690b842bc55872b2b6a648925842b29f58daf63c.tar.gz |
Unconditionally set last_work_seen while in the SYNCER_RUNNING state
so that last_work_seen has a reasonable value at the transition
to the SYNCER_SHUTTING_DOWN state, even if net_worklist_len happened
to be zero at the time.
Initialize last_work_seen to zero as a safety measure in case the
syncer never ran in the SYNCER_RUNNING state.
Tested by: phk
-rw-r--r-- | sys/kern/vfs_subr.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 43b992a..b04ec4b 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1531,7 +1531,7 @@ sched_sync(void) int syncer_final_iter; mtx_lock(&Giant); - last_work_seen = -1; + last_work_seen = 0; syncer_final_iter = 0; syncer_state = SYNCER_RUNNING; starttime = time_second; @@ -1585,11 +1585,10 @@ sched_sync(void) * Return to the SHUTTING_DOWN state if any * new work appears. */ - if (net_worklist_len > 0) { + if (net_worklist_len > 0 || syncer_state == SYNCER_RUNNING) last_work_seen = syncer_delayno; - if (syncer_state == SYNCER_FINAL_DELAY) - syncer_state = SYNCER_SHUTTING_DOWN; - } + if (net_worklist_len > 0 && syncer_state == SYNCER_FINAL_DELAY) + syncer_state = SYNCER_SHUTTING_DOWN; while ((vp = LIST_FIRST(slp)) != NULL) { if (VOP_ISLOCKED(vp, NULL) != 0 || vn_start_write(vp, &mp, V_NOWAIT) != 0) { |