From: Silvan Kaiser <silvan@quobyte.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, kwolf@redhat.com, hreitz@redhat.com,
pierrick.bouvier@linaro.org, eblake@redhat.com,
armbru@redhat.com, Silvan Kaiser <silvan@quobyte.com>
Subject: [PATCH v1 0/3] block: Add 'posix' option for file locking
Date: Thu, 26 Mar 2026 10:19:45 +0100 [thread overview]
Message-ID: <20260326091948.194529-1-silvan@quobyte.com> (raw)
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
next reply other threads:[~2026-03-26 9:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 9:19 Silvan Kaiser [this message]
2026-03-26 9:19 ` [PATCH 1/3] block: Add 'posix' option for file locking Silvan Kaiser
2026-03-26 9:19 ` [PATCH 2/3] docs/system: Document locking=posix option for file block driver Silvan Kaiser
2026-03-26 9:19 ` [PATCH 3/3] tests/qemu-iotests: Add test 315 for locking=posix Silvan Kaiser
2026-03-26 9:34 ` [PATCH v1 0/3] block: Add 'posix' option for file locking Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260326091948.194529-1-silvan@quobyte.com \
--to=silvan@quobyte.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox