diff options
author | jhb <jhb@FreeBSD.org> | 2003-04-22 20:45:38 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-04-22 20:45:38 +0000 |
commit | ced60d737ac0e99b71a066dfb899c47260e50d34 (patch) | |
tree | 7b8a1605bcad801107c58b02f35616921edc488c /sys/ufs | |
parent | 07d96464543509654b723dc053b7dbbf9b917293 (diff) | |
download | FreeBSD-src-ced60d737ac0e99b71a066dfb899c47260e50d34.zip FreeBSD-src-ced60d737ac0e99b71a066dfb899c47260e50d34.tar.gz |
Lock both the proc lock and sched_lock when calling sched_nice since
kg_nice is now protected by both. Being protected by both means that
other places in the kernel that want to read kg_nice only need one of the
two locks.
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_snapshot.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 478c3f5..afae8e8 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -300,8 +300,12 @@ restart: * Recind nice scheduling while running with the filesystem suspended. */ if (td->td_ksegrp->kg_nice > 0) { + PROC_LOCK(td->td_proc); + mtx_lock_spin(&sched_lock); saved_nice = td->td_ksegrp->kg_nice; sched_nice(td->td_ksegrp, 0); + mtx_unlock_spin(&sched_lock); + PROC_UNLOCK(td->td_proc); } /* * Suspend operation on filesystem. @@ -644,8 +648,13 @@ done: free(copy_fs->fs_csp, M_UFSMNT); bawrite(sbp); out: - if (saved_nice > 0) + if (saved_nice > 0) { + PROC_LOCK(td->td_proc); + mtx_lock_spin(&sched_lock); sched_nice(td->td_ksegrp, saved_nice); + mtx_unlock_spin(&sched_lock); + PROC_UNLOCK(td->td_proc); + } if (fs->fs_active != 0) { FREE(fs->fs_active, M_DEVBUF); fs->fs_active = 0; |