Re: [PATCH] Make udf(4) MPSAFE and use shared lookups

From: John Baldwin <jhb_at_freebsd.org>
Date: Tue, 2 Dec 2008 18:28:36 -0500
On Saturday 22 November 2008 06:50:28 am Kostik Belousov wrote:
> udf_vget() does insmntque() before vnode is fully initialized, allowing
> other threads to find the vnode on the mount list. This is typical for
> !MPSAFE fs, and it seems corresponding call was not marked XXX for udf.

It does the same as ufs.  ufs only partially initializes the i-node (as much 
as both cd9660 and udf do) and then exclusive locks the vnode before 
insmntque().  They then finish initializing the i-node (bread() the d-node, 
for example) and finally drop the vnode lock.

> udf_lookup for ISDOTDOT case unlocks dvp before vget'ing "..", allowing
> the same race on forced unmount as ufs (I will finally commit ufs patch
> today). The race happens for !MPSAFE code too, but it is easier to
> execute without Giant.

Every fs is going to need this workaround it seems.  Would be nice if there 
was an easier way to avoid cut and pasting this code N times.  Perhaps we 
could make lookup() check VI_DOOMED instead?  I had changed it do that at one 
point, but then someone pointed me at the deadfs stuff and said that was 
sufficient.

-- 
John Baldwin
Received on Tue Dec 02 2008 - 22:30:46 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:38 UTC