On 20/11/19(Wed) 22:24, Alexander Bluhm wrote: > Hi, > > Quite often I see "panic: unmount: dangling vnode". My test > regress/sys/kern/mount triggers it, but it also happens when rebooting > virtual machines. > > The problem is, when dirty buffers are flushed to disk, the unmount > process sleeps. If the file system is busy, other processes can > create new dirty buffers by writing files. > > First I tired to block these writes. But this is very complex. A > much simpler solution is to flush a few times. With this diff I > could not trigger the problem anymore.
How complex is it? Blocking these writes sounds like an improvement to me. It might be a lot of work or the problem you're trying to avoid. But it is a bigger step toward unlocking the kernel. Any condition that depends on tsleep(9) and the KERNEL_LOCK() will sooner or later be replaced by something else. If you put a barrier-style mechanism to prevent writes to happen as soon as unmount(9) happens, we can build on top of it.