97358a6 Do not unlink sanlock lockfile on shutdown

3 files Authored by nsoffer 6 years ago, Committed by teigland 6 years ago,
    Do not unlink sanlock lockfile on shutdown
    
    Unlinking a lockfile is racy; another instance may have the same
    lockfile open, waiting on the lock.
    
    This is a possible failure mode:
    
    1. Process 1 holds the lock.
    2. Process 2 opens the lockfile and tries to acquire the lockfile.
    3. Process 1 unlinks the lockfile and releases it.
    4. Process 2 acquires the unlinked lockfile.
    5. Process 3 creates a new lockfile acquires it.
    
    So we may end with 2 processes, both thinking they are the only instance
    running.
    
    This issue may be fixed by checking the lockfile inode before and after
    locking to detect deleted lockfile. But there is a simpler solution;
    since we have exactly one lockfile, don't delete it.
    
    Signed-off-by: Nir Soffer <nsoffer@redhat.com>
    
        
file modified
+0 -10
file modified
+0 -1
file modified
+1 -1