Subject: VONWORKLST problems with cached ubc mappings
To: None <tech-kern@netbsd.org>
From: Darrin B.Jewell <dbj@netbsd.org>
List: tech-kern
Date: 09/27/2006 20:25:23
I am investigating some observed problems on msdosfs in sources from
about 2006-04-04.  This shows up as either writes not getting flushed
to disk, or else the debug assertion "(vp->v_flag & VONWORKLST)"
failing in genfs_putpages.

I've done some investigation and I think the following his happening.

A vnode gets written with msdofs_write, this faults pages in to
a ubc_alloc mapping and the mapping gets cached.  The fault marks
the vnode VONWORKLST.  When these pages are eventually cleaned, the
VONWORKLST flag gets appropriately cleared.

Later, a second msdosfs_write to the same pages calls ubc_alloc
and gets the previously cached mapping.  Since it finds the
cached mapping and UBC_FAULTBUSY is not used, there is no
getpages call, and the pages are dirtied without the vnode
being tagged with VONWORKLST.

Now the vnode has dirty pages without being marked VONWORKLST.
If it does eventually get flushed, this results in the DEBUG panic.

I suspect that this problem still exists, and it also might occur on
other filesystems when pages are rewritten.  Has anyone else seen
this?

Darrin