Virtiofsd has two implementations: C and Rust. The former is now
deprecated (QEMU commit v7.0.0-rc0~52^2~1) and in fact removed
from QEMU (QEMU commit v8.0.0-rc0~55). While Rust version was
originally a drop in replacement it is not the case anymore. Some
arguments are silently ignored (like file locking) and there's no
way to make them work for both implementations.
Remove support for the C implementation.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_validate.c | 6 ++++++
src/qemu/qemu_virtiofs.c | 14 ++++----------
tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml | 1 -
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index e475ad035e..2c70409756 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -4368,6 +4368,12 @@ qemuValidateDomainDeviceDefFS(virDomainFSDef *fs,
_("virtiofs does not support fmode and dmode"));
return -1;
}
+ if (fs->flock != VIR_TRISTATE_SWITCH_ABSENT ||
+ fs->posix_lock != VIR_TRISTATE_SWITCH_ABSENT) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("file locking is not supported"));
+ return -1;
+ }
if (qemuValidateDomainDefVhostUserRequireSharedMemory(def, "virtiofs")
< 0) {
return -1;
}
diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c
index 230f85c291..7ff6066f07 100644
--- a/src/qemu/qemu_virtiofs.c
+++ b/src/qemu/qemu_virtiofs.c
@@ -132,6 +132,10 @@ qemuVirtioFSBuildCommandLine(virQEMUDriverConfig *cfg,
g_autoptr(virCommand) cmd = NULL;
g_auto(virBuffer) opts = VIR_BUFFER_INITIALIZER;
+ /* Some @fs attributes (lock and posix_lock) are not handled here nor
+ * anywhwere else. The reason is they exist because (now deprecated) C
+ * implementation of virtiofsd supported them, but RUST implementation does
+ * not. And we only support the latter. */
cmd = virCommandNew(fs->binary);
virCommandAddArgFormat(cmd, "--fd=%d", *fd);
@@ -151,16 +155,6 @@ qemuVirtioFSBuildCommandLine(virQEMUDriverConfig *cfg,
else if (fs->xattr == VIR_TRISTATE_SWITCH_OFF)
virBufferAddLit(&opts, ",no_xattr");
- if (fs->flock == VIR_TRISTATE_SWITCH_ON)
- virBufferAddLit(&opts, ",flock");
- else if (fs->flock == VIR_TRISTATE_SWITCH_OFF)
- virBufferAddLit(&opts, ",no_flock");
-
- if (fs->posix_lock == VIR_TRISTATE_SWITCH_ON)
- virBufferAddLit(&opts, ",posix_lock");
- else if (fs->posix_lock == VIR_TRISTATE_SWITCH_OFF)
- virBufferAddLit(&opts, ",no_posix_lock");
-
virCommandAddArgBuffer(cmd, &opts);
if (fs->thread_pool_size >= 0)
diff --git a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
index 81de8c0dd7..5bc758b8d6 100644
--- a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
+++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
@@ -31,7 +31,6 @@
<binary path='/usr/libexec/virtiofsd' xattr='on'>
<cache mode='always'/>
<sandbox mode='chroot'/>
- <lock posix='off' flock='off'/>
<thread_pool size='16'/>
</binary>
<source dir='/path'/>
--
2.41.0