• Jeff Layton's avatar
    nfsd: don't thrash the cl_lock while freeing an open stateid · d83017f9
    Jeff Layton authored
    When we remove the client_mutex, we'll have a potential race between
    FREE_STATEID and CLOSE.
    
    The root of the problem is that we are walking the st_locks list,
    dropping the spinlock and then trying to release the persistent
    reference to the lockstateid. In between, a FREE_STATEID call can come
    along and take the lock, find the stateid and then try to put the
    reference. That leads to a double put.
    
    Fix this by not releasing the cl_lock in order to release each lock
    stateid. Use put_generic_stateid_locked to unhash them and gather them
    onto a list, and free_ol_stateid_reaplist to free any that end up on the
    list.
    Signed-off-by: default avatarJeff Layton <jlayton@primarydata.com>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
    d83017f9
nfs4state.c 156 KB