[PATCH] qemu: virtiofs: format --rlimit-nofile

Adam Julis posted 1 patch 3 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/66f9b86e3ba0dff88da192f3ea7652422db77e41.1721122809.git.ajulis@redhat.com
src/qemu/qemu_virtiofs.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH] qemu: virtiofs: format --rlimit-nofile
Posted by Adam Julis 3 months, 2 weeks ago
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/485
Signed-off-by: Adam Julis <ajulis@redhat.com>
---
 src/qemu/qemu_virtiofs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c
index 0e3c7dbb58..703f1226a2 100644
--- a/src/qemu/qemu_virtiofs.c
+++ b/src/qemu/qemu_virtiofs.c
@@ -194,6 +194,9 @@ qemuVirtioFSBuildCommandLine(virQEMUDriverConfig *cfg,
     if (fs->thread_pool_size >= 0)
         virCommandAddArgFormat(cmd, "--thread-pool-size=%i", fs->thread_pool_size);
 
+    if (fs->rlimit_nofile > 0)
+        virCommandAddArgFormat(cmd, "--rlimit-nofile=%llu", fs->rlimit_nofile);
+
     if (cfg->virtiofsdDebug) {
         if (virBitmapIsBitSet(fs->caps, QEMU_VHOST_USER_FS_FEATURE_SEPARATE_OPTIONS))
             virCommandAddArgList(cmd, "--log-level", "debug", NULL);
-- 
2.45.2
Re: [PATCH] qemu: virtiofs: format --rlimit-nofile
Posted by Michal Prívozník 3 months, 2 weeks ago
On 7/16/24 11:41, Adam Julis wrote:
> Resolves: https://gitlab.com/libvirt/libvirt/-/issues/485
> Signed-off-by: Adam Julis <ajulis@redhat.com>
> ---
>  src/qemu/qemu_virtiofs.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c
> index 0e3c7dbb58..703f1226a2 100644
> --- a/src/qemu/qemu_virtiofs.c
> +++ b/src/qemu/qemu_virtiofs.c
> @@ -194,6 +194,9 @@ qemuVirtioFSBuildCommandLine(virQEMUDriverConfig *cfg,
>      if (fs->thread_pool_size >= 0)
>          virCommandAddArgFormat(cmd, "--thread-pool-size=%i", fs->thread_pool_size);
>  
> +    if (fs->rlimit_nofile > 0)
> +        virCommandAddArgFormat(cmd, "--rlimit-nofile=%llu", fs->rlimit_nofile);
> +
>      if (cfg->virtiofsdDebug) {
>          if (virBitmapIsBitSet(fs->caps, QEMU_VHOST_USER_FS_FEATURE_SEPARATE_OPTIONS))
>              virCommandAddArgList(cmd, "--log-level", "debug", NULL);

A bit surprised you don't need to call virCommandSetMaxFiles() to raise
the limit if needed, but then again - in session mode the daemon won't
be able to do that anyways.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal