QEMU currently supports three values for the 'locking' property of
file-based block devices: 'auto' (the default), 'on', and 'off'.
When OFD (Open File Descriptor) locks are available, 'auto' and 'on'
use them; when they are not, 'on' falls back to POSIX locks with a
warning.

This series adds a fourth value, 'posix', which explicitly forces the
use of traditional POSIX locks (F_SETLK/F_GETLK) regardless of OFD
availability.  The motivation is that some userspace filesystem
implementations (e.g. FUSE) handle POSIX locks correctly but do not
fully support OFD lock semantics.  Issues with OFD support detection
on underlying file systems and some OFD guarantees not being fully
supported can prohibit users from using the default OFD locking.
Previously, users in this situation had no way to force POSIX locking
without disabling locking entirely.

The series is structured as:
  1/3 - core implementation in block/file-posix.c, util/osdep.c,
        include/qemu/osdep.h and qapi/block-core.json
  2/3 - documentation updates in qemu-options.hx and
        docs/system/qemu-block-drivers.rst.inc
  3/3 - new iotest 315 verifying the option is accepted without
        fallback warnings and that POSIX locks are applied

Silvan Kaiser (3):
  block: Add 'posix' option for file locking
  docs/system: Document locking=posix option for file block driver
  tests/qemu-iotests: Add test 315 for locking=posix

 block/file-posix.c                     | 18 ++++--
 docs/system/qemu-block-drivers.rst.inc |  3 +
 include/qemu/osdep.h                   |  1 +
 qapi/block-core.json                   | 18 +++++-
 qemu-options.hx                        | 10 +--
 tests/qemu-iotests/315                 | 88 ++++++++++++++++++++++++++
 tests/qemu-iotests/315.out             |  7 ++
 util/osdep.c                           |  9 ++-
 8 files changed, 139 insertions(+), 15 deletions(-)
 create mode 100755 tests/qemu-iotests/315
 create mode 100644 tests/qemu-iotests/315.out

-- 
2.47.3


-- 
Quobyte GmbH, Berlin, AG Charlottenburg HRB 149012 B, Dr. Felix Hupfeld, 
Dr. Bjoern Kolbeck

Reply via email to