diff options
author | Jeff Roberson <jeff@FreeBSD.org> | 2006-03-02 08:52:53 +0000 |
---|---|---|
committer | Jeff Roberson <jeff@FreeBSD.org> | 2006-03-02 08:52:53 +0000 |
commit | b9b12498fd6230c411a61a5ef1d954450670b0d7 (patch) | |
tree | 9248fccfe3646340c6460a64136957063ce4edaa /sys/ufs | |
parent | 301af28a06869270844eca0c7e4db2a806fbbcaf (diff) | |
download | src-b9b12498fd6230c411a61a5ef1d954450670b0d7.tar.gz src-b9b12498fd6230c411a61a5ef1d954450670b0d7.zip |
- Acquire lk in softdep_slowdown so that it's owned when we call
softdep_speedup().
- Assert that lk is held in softdep_speedup() rather than acquiring it.
This avoids a potential lock recursion.
Notes
Notes:
svn path=/head/; revision=156206
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_softdep.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 62dd5f665e09..600203dd05b3 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -705,12 +705,12 @@ softdep_flush(void) static int softdep_speedup(void) { - ACQUIRE_LOCK(&lk); + + mtx_assert(&lk, MA_OWNED); if (req_pending == 0) { req_pending = 1; wakeup(&req_pending); } - FREE_LOCK(&lk); return speedup_syncer(); } @@ -5551,14 +5551,18 @@ softdep_slowdown(vp) { int max_softdeps_hard; + ACQUIRE_LOCK(&lk); max_softdeps_hard = max_softdeps * 11 / 10; if (num_dirrem < max_softdeps_hard / 2 && num_inodedep < max_softdeps_hard && - VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps) + VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps) { + FREE_LOCK(&lk); return (0); + } if (VFSTOUFS(vp->v_mount)->um_numindirdeps >= maxindirdeps) softdep_speedup(); stat_sync_limit_hit += 1; + FREE_LOCK(&lk); return (1); } |