Re: [PATCH 5/9] virDomainObjListAdd: Leave def assigning as an exercise for caller

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

 




On 30.05.2019 12:34, Michal Privoznik wrote:
> Some driver have concept of jobs (e.g. qemu, lxc, libxl and vz).
> This means that whenever something wants to modify a domain
> object it needs to acquire job (to mutually exclude with other
> threads trying to modify the same object). And aforementioned
> drivers do that more or less successfully. Except for
> virDomainObjListAdd() which may modify the domain object without
> acquiring job. This is harmful because if a thread that's
> executing say an API in qemu driver unlock a domain object and
> locks it again the object has changed even though the thread
> acquired job before.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/bhyve/bhyve_driver.c    | 10 ++++++----
>  src/conf/virdomainobjlist.c | 29 +++++++----------------------
>  src/conf/virdomainobjlist.h |  3 +--
>  src/libxl/libxl_driver.c    | 22 ++++++++++++----------
>  src/libxl/libxl_migration.c | 12 ++++++------
>  src/lxc/lxc_driver.c        | 10 +++++-----
>  src/openvz/openvz_conf.c    | 12 ++++++------
>  src/openvz/openvz_driver.c  | 17 +++++++++--------
>  src/qemu/qemu_driver.c      | 22 +++++++++++-----------
>  src/qemu/qemu_migration.c   |  6 +++---
>  src/test/test_driver.c      | 21 ++++++++++++---------
>  src/vmware/vmware_conf.c    |  4 ++--
>  src/vmware/vmware_driver.c  |  9 ++++-----
>  src/vz/vz_sdk.c             |  4 +++-
>  14 files changed, 87 insertions(+), 94 deletions(-)
> 

Let's remove now unused VIR_DOMAIN_OBJ_LIST_ADD_LIVE entirely.

diff --git a/src/conf/virdomainobjlist.h b/src/conf/virdomainobjlist.h
index 552a7cf..54e7871 100644
--- a/src/conf/virdomainobjlist.h
+++ b/src/conf/virdomainobjlist.h
@@ -38,8 +38,7 @@ virDomainObjPtr virDomainObjListFindByName(virDomainObjListPtr doms,
                                            const char *name);
 
 enum {
-    VIR_DOMAIN_OBJ_LIST_ADD_LIVE = (1 << 0),
-    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE = (1 << 1),
+    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE = (1 << 0),
 };
 virDomainObjPtr virDomainObjListAdd(virDomainObjListPtr doms,
                                     virDomainDefPtr def,


Reviewed-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>

--
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