Re: [PATCH] AFS: Implement file locking

David Howells
2007-05-29T09:35:01Z

J. Bruce Fields <bfields@fieldses.org> wrote:

> You can contrive examples of applications that would be correct given
> the standard fcntl behavior, but that would deadlock on a system that
> didn't allow read locks to jump the queue in the above situation.

Yes, but you can also contrive starvation if you allow locks to jump the
queue. Obviously, the Linux kernel behaviour is to allow readlocks to jump
the queue if a readlock is currently in force, so I have to conform to that,
whether I like it or not.

I'll need to test the upgrade/downgrade case. I don't know whether the AFS
server supports that. If it doesn't, I can emulate downgrade, but not upgrade
- not unless I only ever ask it for exclusive locks.

Lock upgrading is really, really easy to contrive deadlock for.

David