tech-kern archive

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

Re: Locking strategy for device deletion (also see PR kern/48536)



> On Jun 8, 2016, at 10:16 AM, Paul Goyette <paul%whooppee.com@localhost> wrote:
> 
> On Wed, 8 Jun 2016, Michael van Elst wrote:
> 
>> paul%whooppee.com@localhost (Paul Goyette) writes:
>> 
>>>> See misfs/specfs/spec_vnops.c::spec_close().
>> 
>>> yes, that would certainly explain the situation.  It does, however, make
>>> it rather difficult to maintain a valid ref-count!
>> 
>> specfs does the open refcounting. The device only has a single bit, open
>> sets it and close clears it. That bit is added to a common counter
>> that is used for other references.
> 
> Hmmm.  Would it be valid, then, for my close() routine to reset the ref-count to zero rather than simply decrementing?  Does the close() only get called if there are _NO_ outstanding open()s for _any_ process?

It seems rather odd to have something that calls itself a reference count but isn't counted down.   If that is actually correct, it should be a "referenced" boolean.  But if it really is meant to be a reference count and it seems to need forcing to zero, that would suggest there is a missing decrement bug somewhere.

	paul



Home | Main Index | Thread Index | Old Index