Skip to content

block: Add 'posix' option for file locking

Silvan Kaiser qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3block: Add 'posix' option for file lockingblock/file-posix.c include/qemu/osdep.h qapi/block-core.json +1 more+35 -110 replies
2/3docs/system: Document locking=posix option for file block driverdocs/system/qemu-block-drivers.rst.inc qemu-options.hx+9 -40 replies
3/3tests/qemu-iotests: Add test 315 for locking=posixtests/qemu-iotests/315 tests/qemu-iotests/315.out+95 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/3] block: Add 'posix' option for file locking

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
Signature · 6 lines
2.47.3


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