• NeilBrown's avatar
    locks: move checks from locks_free_lock() to locks_release_private() · 5926459e
    NeilBrown authored
    Code that allocates locks using locks_alloc_lock() will free it
    using locks_free_lock(), and will benefit from the BUG_ON()
    consistency checks therein.
    
    However some code (nfsd and lockd) allocate a lock embedded in
    some other data structure, and so free the lock themselves after
    calling locks_release_private().  This path does not benefit from
    the consistency checks.
    
    To help catch future errors, move the BUG_ON() checks to
    locks_release_private() - which locks_free_lock() already calls.
    This ensures that all users for locks will find out if the lock
    isn't detached properly before being free.
    Signed-off-by: default avatarNeilBrown <neilb@suse.com>
    Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
    5926459e
locks.c 77.2 KB