test: add file locking test

Exercise IORING_OP_FLOCK and IORING_OP_OFD_LOCK:

- Basic conflict matrix for flock (exclusive vs shared, LOCK_NB) and
  OFD locks (overlapping vs disjoint ranges, read vs write, NOWAIT)
- Interop with the flock(2) and fcntl(2) F_OFD_SETLK syscalls, which
  share the same lock space
- Pending acquisition of a contended lock, granted once the holder
  drops the conflicting lock
- Async cancelation of a pending request, verifying the lock was not
  acquired
- OFD owner semantics: a dup'ed fd shares lock ownership, overlapping
  requests merge rather than conflict
- Ring teardown with a request still parked on a conflicting lock,
  which must neither hang nor leave the lock acquired
- Deliberate error cases: invalid operations, lock types and flags,
  stray sqe fields, bad fds, lock type vs open mode mismatches, and
  range overflows

All tests are run both with a default ring and with DEFER_TASKRUN, and
skipped on kernels without file locking support.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 files changed