tech-kern archive

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

Re: PUFFS ADVLOCK is too greedy



On Fri, Nov 11, 2011 at 11:11:35AM +0100, Emmanuel Dreyfus wrote:
> 
> Here is where the extra ADVLOCK happen:
> sys_exit -> exit1 -> fd_free -> fd_close -> VOP_ADVLOCK
> 
> In a nutshell, NetBSD clears locks on all file descriptor when a process
> exit, that include read-only descriptors, and FUSE filesystems seem to
> be unconfortable with that.
> 
> I am not sure of where this should be fixed: should we avoid unlocking
> read-only files in fd_close()? That seems a good idea performance-wise.

I think that is required by POSIX.
Any close() of a file by a process removes ALL locks held by that
process (on that file), not just those acquired through that fd.

Yes that has nasty side effects, especially in threaded processes,
or when library routines open/close files that might have locks
on them in other parts of the process.)
Similarly there isn't a file locking scheme that can be used between
threads os a single process.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index