Re: [PATCH] NLM: Fix the NLM_GRANTED callback checks

From: Trond Myklebust
Date: Mon Feb 13 2006 - 18:30:31 EST


On Mon, 2006-02-13 at 15:20 -0800, Andrew Morton wrote:
> Trond Myklebust <Trond.Myklebust@xxxxxxxxxx> wrote:
> >
> > Currently when the NLM_GRANTED callback comes in, lockd walks the list of
> > blocked locks in search of a match to the lock that the NLM server has
> > granted. Although it checks the lock pid, start and end, it fails to check
> > the filehandle and the server address.
> >
>
> What are the consequences of this bug?

If 2 threads attached to the same process are blocking on different
locks on different files (maybe even on different servers) but have the
same lock arguments (i.e. same offset+length - actually quite common,
since most processes try to lock the entire file) then the first GRANTED
call that wakes one up will also wake the other.

By checking the filehandle and server IP address, we ensure that this
only happens if the locks truly are referencing the same file.

Cheers,
Trond
-
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/