tech-kern archive

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

Re: Making forced unmounts work



On Nov 29, 2012, at 5:17 PM, David Holland <dholland-tech%netbsd.org@localhost> 
wrote:

> On Mon, Nov 26, 2012 at 03:06:34PM +0100, J. Hannken-Illjes wrote:
>> In short the attached diff:
>> 
>> - Adds a new kernel-internal errno ERESTARTVOP and changes VCALL() to
>>  restart a vnode operation once it returns ERESTARTVOP.
>> 
>> - Changes fstrans_start() to take an optional `hint vnode' and return
>>  ERESTARTVOP if the vnode becomes dead.
> 
> Is there any major reason we can't just use ERESTART and rerun the
> whole syscall?

Not all vnode operations come from a syscall and to me it looks cleaner
to use one private errno for exactly this purpose.

> I see there are two references to ERESTARTVOP in genfs_io.c, and I
> don't see what they're for without digging deeper, but given that they
> appear to make locking behavior depend on the error condition maybe it
> would be better not to do that too. :-/

This is the wonderful world of VOP_GETPAGES() and VOP_PUTPAGES().  Both
are called with vnode interlock held and when it is needed and possible
to check the vnode the interlock has been released.  When these operations
return ERESTARTVOP we have to lock the interlock because dead_getpages()
and dead_putpages need it on entry (just to release it).

It is possible to directly return the error from genfs_XXXpages() though.
To me it looks clearer to always go the ERESTARTVOP route.

> Also I wonder if there's any way to accomplish this that doesn't
> require adding fstrans calls to every operation in every fs.

Not in a clean way.  We would need some kind of reference counting for
vnode operations and that is quite impossible as vnode operations on
devices or fifos sometimes wait forever and are called from other fs
like ufsspec_read() for example.  How could we protect UFS updating
access times here?

--
J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig 
(Germany)



Home | Main Index | Thread Index | Old Index