locks: add fl_notify arguments for asynchronous lock return
Quoted 19 lines · J. Bruce Fields
From: Marc Eshel <[email protected]> - unquoted
Acquiring a lock on a cluster filesystem may require communication with remote hosts, and to avoid blocking lockd or nfsd threads during such communication, we allow the results to be returned asynchronously.
When a ->lock() call needs to block, the file system will return
-EINPROGRESS, and then later return the results with a call to the routine in thefl_notifyfield of thelock_manager_operationsstruct.Note that this is different from the ->lock() call discovering that there is a conflict which would cause the caller to block; this is still handled in the same way as before. In fact, we don't currently handle "blocking" locks at all; those are less urgent, because the filesystem can always just return an immediate
-EAGAINwithout denying the lock.So this asynchronous interface is only used in the case of a non-blocking lock, where we must know whether to allow or deny the lock now.
Quoted 8 lines
We're using
fl_notifyto asynchronously return the result of a lock request. So we wantfl_notifyto be able to return a status and, if appropriate, a conflicting lock.This only current caller of
fl_notifyis in the blocked case, in which case we don't use these extra arguments.We also allow
fl_notifyto return an error. (Also ignored for now.)
I don't really like the overload of fl_notify. What the reason not to use a separate callback?
Quoted 5 lines · Christoph Hellwig
Quoted 4 lines · J. Bruce Fields
We're using
fl_notifyto asynchronously return the result of a lock request. So we wantfl_notifyto be able to return a status and, if appropriate, a conflicting lock.
Quoted 7 lines
Quoted 4 lines
This only current caller of
fl_notifyis in the blocked case, in which case we don't use these extra arguments.We also allow
fl_notifyto return an error. (Also ignored for now.)I don't really like the overload of
fl_notify. What the reason not to use a separate callback?
My vague memory is that Trond said something to the affect of "fl_notify is there, let's use it rather than adding yet another callback."
But our new usage of fl_notify does requires slightly different arguments and returns, and is used in a subtly different case. So I wouldn't object to a new callback. Trond?
--b.