• Pavel Emelyanov's avatar
    locks: Don't dump locks in per-task manner (v3) · 53537f52
    Pavel Emelyanov authored
    We have a problem with file locks (bug #2512) -- the /proc/locks
    file shows the ID of lock creator, not the owner. Thus, if the
    creator died, but holder is still alive, criu fails to dump the
    lock held by latter task.
    
    The proposal is to find who _might_ hold the lock by checking
    for dev:inode pairs on lock vs file descriptors being dumped.
    If the creator of the lock is still alive, then he will take
    the priority.
    
    One thing to note about flocks -- these belong to file entries,
    not to tasks. Thus, when we meet one, we should check whether
    the flock is really held by task's FD by trying to set yet
    another one. In case of success -- lock really belongs to fd
    we dump, in case it doesn't trylock should fail.
    
    At the very end -- walk the list of locks and dump them all at
    once, which is possible by merge of per-task file-locks images
    into one global one.
    Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
    53537f52
file-lock.h 1.48 KB