Skip to content
  • Xiong Zhou's avatar
    generic: add OFD lock tests · 4a6d40ad
    Xiong Zhou authored
    
    
    Test OFD locks. Use fcntl F_OFD_SETLK/F_OFD_GETLK, to verify we are
    being given correct advices through getlk by kernel.
    
    The basic idea is one setlk routine setting locks via fcntl *_SETLK,
    followed by operations like clone, dup then close fd; another
    routine getlk getting locks via fcntl *_GETLK.
    
    Firstly in setlk routine process P0, place a lock L0 on an opened
    testfile, then do clone or dup and close relative fd.
    
    In getlk process P2, do fcntl *_GETLK with lock L1 after get
    notified by setlk routine.
    
    In the end, getlk routine check the returned struct flock.l_type to
    see if the lock mechanism works fine.
    
    Test combainations of:
    - shared or exclusive lock
    - these locks are conflicting or not
    - one OFD lock and one POSIX lock
    - that open testfile RDONLY or RDWR
    - clone with CLONE_FILES or not
    - dup and close newfd
    
    [eguan: made some minor non-functional changes]
    
    Signed-off-by: default avatarXiong Zhou <xzhou@redhat.com>
    Reviewed-by: default avatarEryu Guan <eguan@redhat.com>
    Signed-off-by: default avatarEryu Guan <eguan@redhat.com>
    4a6d40ad