On a Monday in 2020, Christian Schoenebeck wrote:
QEMU 4.2 added a new option 'multidevs' for 9pfs. The
following patch adds
support for this new option to libvirt.
In short, what is this about: to distinguish files uniquely from each other
in general, numeric file IDs are typically used for comparison, which in
practice is the combination of a file's device ID and the file's inode
number. Unfortunately 9p protocol's QID field used for this purpose,
currently is too small to fit both the device ID and inode number in, which
hence is a problem if one 9pfs export contains multiple devices and may
thus lead to misbheaviours on guest (e.g. with SAMBA file servers) in that
case due to potential file ID collisions.
To mitigate this problem with 9pfs a 'multidevs' option was introduced in
QEMU 4.2 for defining how to deal with this, e.g. multidevs=remap will cause
QEMU's 9pfs implementation to remap all inodes from host side to different
inode numbers on guest side in a way that prevents file ID collisions.
NOTE: In the libvirt docs changes of this libvirt patch I simply assumed
"since 6.2.0". So the final libvirt version number would need to be adjusted
in that text if necessary.
See QEMU discussion with following Message-ID for details:
8a2ffe17fda3a86b9a5a437e1245276881f1e235.1567680121.git.qemu_oss(a)crudebyte.com
v2->v3:
* Rebased to master (SHA-1 e4bf03b8ff).
* Auto sense QEMU capability for command line option fsdev.multidevs
instead of checking for QEMU version 4.2. [patch 1]
* Auto regenerated capabilities data for all archs (fixes capability
test). [patch 1]
* Added XML test. [patch 2]
* Added argv test. [patch 3]
Message-ID of v2: cover.1584723662.git.qemu_oss(a)crudebyte.com
Christian Schoenebeck (3):
qemu: capabilities: add QEMU_CAPS_VIRTFS_MULTIDEVS
conf: add 'multidevs' option
qemu: add support for 'multidevs' option
docs/formatdomain.html.in | 40 ++++++++++++-
docs/schemas/domaincommon.rng | 10 ++++
src/conf/domain_conf.c | 29 ++++++++++
src/conf/domain_conf.h | 13 +++++
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 7 +++
src/qemu/qemu_domain.c | 12 ++++
.../caps_4.2.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 +
.../caps_4.2.0.x86_64.xml | 1 +
.../caps_5.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 +
.../caps_5.0.0.x86_64.xml | 1 +
.../virtio-9p-multidevs.x86_64-latest.args | 45 +++++++++++++++
.../qemuxml2argvdata/virtio-9p-multidevs.xml | 53 ++++++++++++++++++
tests/qemuxml2argvtest.c | 2 +
.../virtio-9p-multidevs.x86_64-latest.xml | 56 +++++++++++++++++++
tests/qemuxml2xmltest.c | 2 +
19 files changed, 277 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/virtio-9p-multidevs.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/virtio-9p-multidevs.xml
create mode 100644 tests/qemuxml2xmloutdata/virtio-9p-multidevs.x86_64-latest.xml
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano