There's an unnecessary blank line here.
I hate code that jumps into braced blocks with goto. Would it be possible for
you to do:
readers_only:
if (downgrading)
goto wake_readers;
...
wake_readers:
/* Grant an infinite number of read locks to the readers at the front
...
instead, please?
Also, since the labels 'undo' and 'try_again' are now specific to the writer
path, can you label them 'undo_write' and 'try_again_write' just to make it
obvious?
Other than that, no particular objections to this patch.
David
--