Yeah, I think the original author was a little imprecise in his description
of the semantics. The freebsd flock(2) manpage says:
A shared lock may be upgraded to an exclusive lock, and vice versa, sim
ply by specifying the appropriate lock type; this results in the previous
lock being released and the new lock applied (possibly after other pro
cesses have gained and released the lock).
So I think what they're trying to say is that changing the lock type is
exactly equivalent to removing the existing lock and then applying the
new lock; it just happens to be one syscall. Using cond_resched() looks
like the right approach.
-- Revolutions do not require corporate support. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/