- 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.
This commit is contained in:
Jeff Roberson 2006-03-02 08:52:53 +00:00
parent 301af28a06
commit b9b12498fd

View File

@ -705,12 +705,12 @@ softdep_flush(void)
static int static int
softdep_speedup(void) softdep_speedup(void)
{ {
ACQUIRE_LOCK(&lk);
mtx_assert(&lk, MA_OWNED);
if (req_pending == 0) { if (req_pending == 0) {
req_pending = 1; req_pending = 1;
wakeup(&req_pending); wakeup(&req_pending);
} }
FREE_LOCK(&lk);
return speedup_syncer(); return speedup_syncer();
} }
@ -5551,14 +5551,18 @@ softdep_slowdown(vp)
{ {
int max_softdeps_hard; int max_softdeps_hard;
ACQUIRE_LOCK(&lk);
max_softdeps_hard = max_softdeps * 11 / 10; max_softdeps_hard = max_softdeps * 11 / 10;
if (num_dirrem < max_softdeps_hard / 2 && if (num_dirrem < max_softdeps_hard / 2 &&
num_inodedep < max_softdeps_hard && num_inodedep < max_softdeps_hard &&
VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps) VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps) {
FREE_LOCK(&lk);
return (0); return (0);
}
if (VFSTOUFS(vp->v_mount)->um_numindirdeps >= maxindirdeps) if (VFSTOUFS(vp->v_mount)->um_numindirdeps >= maxindirdeps)
softdep_speedup(); softdep_speedup();
stat_sync_limit_hit += 1; stat_sync_limit_hit += 1;
FREE_LOCK(&lk);
return (1); return (1);
} }