Fcntl hangs in 2.2.5 on Solaris
davecb at canada.sun.com
Mon Aug 12 10:09:00 GMT 2002
Ok, I've been looking at portable locking mechanisms and fcntl.
A Smarter Colleague (Mark) pointed out that there are
scalability issues with fcntl locks on both Solaris
and Linux, but quite different ones. Instead, we've been
working with the posix locks, to make them as robust as possible.
In particular, I'm using pthread_mutex_lock() in my code
at work, to do locking on Linux and Solaris, and have been
reasonably happy with it: I'm planning to shift another
program over from realtime semaphores to pthread_mutex_locks
to make avoiding priority inversions easier.
This would be a better mechnaism to use for the "spinlocks"
case, removing the sparc-only ldstub calls, and the gcc-only
assembler, in favor of a lock that doesn't spin, and does
have good behavior under evil stresses.
In particular, for anyone who supports EOWNERDEAD, we
can put in under #ifdef EOWNERDEAD a call to a guaranteed cleanup
routine, (pthread_mutex_consistent_np) which will recover the state,
after which it can be straightened out, released or recreated.
It also doesn't spin (;-))
So: while it's actually in the workaround code, there is
a robust and low-cost lock we can use.
I'd like to work with someone who groks the spinlock code
to see if we can do this.
David Collier-Brown, | Always do right. This will gratify
Performance & Engineering | some people and astonish the rest.
Americas Customer Engineering, | -- Mark Twain
(905) 415-2849 | davecb at canada.sun.com
More information about the samba-technical