Re: nfs: infinite loop in fcntl(F_SETLKW)

From: Miklos Szeredi
Date: Fri Apr 18 2008 - 08:49:01 EST


> > > > 1) if !FL_SLEEP, then return 0 if granted, -EAGAIN on contention
> > > > 2) if FL_SLEEP and fl_grant == NULL, then return 0 if granted, block on
> > > > contention
> > > > 3) if FL_SLEEP and fl_grant != NULL, then return 0 if granted, on
> > > > contention:
> > > > a) either return -EINPROGRESS and call fl_grant when granted
> > > > b) or return -EAGAIN and call fl_notify when the lock needs retrying
> > >
> > > I'd put it this way (after a quick check of the code to convince myself
> > > I'm remembering this right...):
> > >
> > > 1) If FL_SLEEP, then return 0 if granted, and on contention either:
> > > a) block, or
> > > b) return -EAGAIN, and call fl_notify when the lock should be
> > > retried.
> >
> > Gfs2 seems to return -EINPROGRESS regardless of the FL_SLEEP flag:
>
> Oops, you're right; in FL_SLEEP case fs/lockd/svclock.c:nlmsvc_lock()
> returns NLM_LCK_BLOCKED. I believe it'll get an fl_grant() callback
> after that and do a grant call back to the client, but I haven't
> checked....
>
> Note, as has been pointed out by Mark Snitzer
> (http://article.gmane.org/gmane.linux.nfs/17801/), this limits the kind
> of error reporting the filesystem can do--if it needs to block on the
> initial lock call, it has to commit to queueing up, and eventually
> granting, the lock.

OK, but that AFAICS is a lock manager implementation issue, not an API
issue. Which is important, but not as important as the API ;)

> > > OK, but I haven't read your patch yet, apologies....
> >
> > No problem. Here it is again with some cosmetic fixes and testing.
>
> Thanks! Ping me in a couple days if I haven't made any comments. From
> a quick skim the GFS2 change and the error return change both seem
> reasonable.
>
> I need to a real GFS2 testing setup.... (Did you test GFS2 locking
> specifically?)

No gfs2, only ext3.

Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/