tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: vrele vs. syncer deadlock



On Sun, Dec 11, 2016 at 08:39:06PM +0000, Michael van Elst wrote:
 > >On a low-memory machine Nick ran into the following deadlock:
 > 
 > >  (a) rename -> vrele on child -> inactive -> truncate -> getblk ->
 > >      no memory in buffer pool -> wait for syncer
 > >  (b) syncer waiting for locked parent vnode from the rename
 > 
 > >Does anyone have any suggestions for a patch to address this problem
 > >without first rewriting the syncer?
 > 
 > The syncer could skip locked vnodes if there are processes waiting for
 > a buffer.

That turns out to be a can of worms: you can't just skip locked
vnodes, because if they're constantly busy they might never get
written. You also don't want to just iterate the vnode cache twice,
because that's bound to result in syncing some files twice. So you
either need to hold the busy ones until they unlock, or keep a list of
vnodes you haven't synced yet on this pass. The former is problematic;
the latter a pretty big nuisance.

Also it's fairly easy to get into dynamic stability or starvation
problems if you aren't careful. (This is the real reason you don't
want to just go through twice, once nonblocking and once blocking.)

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index