Messages in this thread | | | Date | Mon, 14 Apr 2008 13:19:09 -0400 | Subject | Re: nfs: infinite loop in fcntl(F_SETLKW) | From | "J. Bruce Fields" <> |
| |
On Sun, Apr 13, 2008 at 10:28:08AM +0200, Miklos Szeredi wrote: > > Apologies, that was indeed a behavioral change introduced in a commit > > that claimed just to be shuffling code around. > > Another complaint about this series: using EINPROGRESS to signal > asynchronous locking looks really fishy. How does the filesystem > know, that the caller wants to do async locking?
The caller sets a fl_grant callback. But I guess the interesting question is how the caller knows that the filesystem is really going to return the results asynchronously:
> How do we make sure, > that the filesystem (like fuse or 9p, which "blindly" return the error > from the server) doesn't return EINPROGRESS even when it's _not_ doing > an asynchronous lock?
Right, there's no safeguard there--if fuse returns EINPROGRESS, then we'll wait for a grant callback that's not going to come. It should time out, so that's not a total disaster, but still.
Anyway, I'm not sure what to do about that.
> > I think it would have been much cleaner to have a completely separate > interface for async locking, instead of trying to cram that into > f_op->lock().
Maybe so. ->lock() had quite a bit crammed into it even before this.
> Would that be possible to fix now? Or at least make EINPROGRESS a > kernel-internal error value (>512), to make it that it has a special > meaning for the _kernel only_?
Perhaps so.
The behavior of lockd will still depend to some degree on the exact error returned from the filesystem--e.g. if you return -EAGAIN from ->lock() without later calling ->fl_grant() it will cause some unexpected delays. (Though again clients will eventually give up and poll for the lock.)
--b.
| |