• Trond Myklebust's avatar
    [PATCH] NLM: Fix the NLM_GRANTED callback checks · 5ac5f9d1
    Trond Myklebust authored
    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.
    
    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.
    
    By checking the filehandle and server IP address, we ensure that this only
    happens if the locks truly are referencing the same file.
    Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    5ac5f9d1
clntlock.c 6.31 KB