[PATCH v2 3/6] virThreadPool: Prevent switching between zero and non-zero maxWorkers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



...since maxWorkers=0 is only intended for virtlockd or virlogd which
must not be multithreaded.

Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx>
Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>
Reviewed-by: Bjoern Walk <bwalk@xxxxxxxxxxxxx>
---
 src/util/virthreadpool.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c
index f18eafb35deb..e615c8c07c82 100644
--- a/src/util/virthreadpool.c
+++ b/src/util/virthreadpool.c
@@ -479,6 +479,14 @@ virThreadPoolSetParameters(virThreadPoolPtr pool,
         goto error;
     }
 
+    if ((maxWorkers == 0 && pool->maxWorkers > 0) ||
+        (maxWorkers > 0 && pool->maxWorkers == 0)) {
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("maxWorkers must not be switched from zero to non-zero"
+                         " and vice versa"));
+        goto error;
+    }
+
     if (minWorkers >= 0) {
         if ((size_t) minWorkers > pool->nWorkers &&
             virThreadPoolExpand(pool, minWorkers - pool->nWorkers,
-- 
2.13.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux