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 Wed, 8 Jun 2016, J. Hannken-Illjes wrote:

Well, it almost works!  Just one little problem...  :)

For some reason, the device's open() routine is being called twice, but the close() routine is only called once.  So every iteration leaves the refcount with a net increment of one.

I cannot figure out why/how the open routine is called twice.

IIRC the device open() operation gets called on every open while
the device close() operation gets called on last close only.

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!


+------------------+--------------------------+------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:      |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+------------------------+


Home | Main Index | Thread Index | Old Index