>>>>> " " == Matthew Wilcox <[EMAIL PROTECTED]> writes:
> Umm.. that's your opinion. I don't see how `making them
> mandatory' would make this better or worse than if they check
> for deadlock. If they're mandatory, a process doing a read()
> which conflicts will block forever whether they're checked for
> deadlock or not.
As I understood it, you were talking about dropping deadlock detection
upon taking the lock. If the above statement means that your plan is
that processes are to check for deadlocks before they take a lock,
then you still have a race: checking for deadlocks and deciding
whether or not to block has to be an atomic operation.
Mandatory locking doesn't make deadlocking worse as such, however it
forces you to use locking more often. The alternative to trying to
take a lock when you're told -EAGAIN would be to poll, which is
usually more inefficient.
>> Ideally the VFS locking manager wants to provide a service to
>> samba, NFS and their ilk, whereby they ask for a lock. If
>> waiting would deadlock, send back an immediate answer to the
>> caller. If not, then the locking manager should be responsible
>> for scheduling a lock immediately after the blocking lock is
>> released, and notifying the caller that it can proceed.
> did you read my proposal? was that not exactly what i
> suggested?
I'm probably confused about the phrasing of the paragraph reading:
But what if we simply replace the blocking lock with the would-block
lock? That implies that the caller of ->lock() decides what to do with
the -EWOULDBLOCK return code -- if it's fcntl(), it puts the process
to sleep; if it's lockd, it just carries on.
So specifically what you mean to say is that `the VFS takes charge of
keeping track of the list of blocked locks, and that it will notify
lockd|fcntl through some callback mechanism when the blocking lock is
freed, and the waiting lock has been taken'? If so, I'm happy.
> Actually, we _do_ want to give the filesystems the opportunity
> to handle their own locks without poking around in the guts of
> locks.c as lockd currently does. Did my proposal seem
> unacceptable to you?
I'm a unhappy about the proposal that lockd might end up calling some
re-exported networked filesystem. That's going to give rise to DOSes,
unless you fork a thread each time in order to allow blocking. Still,
it's up to the user not to do screwy things like that (re-exporting
can fail in so many other ways)...
The other gripe is
With the changes above, even this code can go away. The nfs client can
keep a per-fs list of locks, and reestablish them at server restart.
No need to interact with the local locking at all.
Such a list of locks needs services in order to do lock merging etc as
per the existing posix locks. It makes sense to share this code with
the standard posix lock code.
Cheers,
Trond
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]