[PATCH] virnodedeviceobj: Don't unlock virNodeDeviceObj in virNodeDeviceObjListRemove()

Michal Prívozník mprivozn at redhat.com
Wed Feb 2 07:33:19 UTC 2022


On 2/1/22 15:43, Michal Privoznik wrote:
> When virNodeDeviceObjListRemove() is called, the passed
> virNodeDeviceObj is removed from internal list of node devices
> and then unrefed and unlocked. While the former is warranted (the
> object was refed at the beginning of the function) the unlock is
> not. In fact, it's wrong from conceptual POV. We still want
> threads working on the object tu mutually exclude each other.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/conf/virnodedeviceobj.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
> index 2e4ef2df3c..7a560349d4 100644
> --- a/src/conf/virnodedeviceobj.c
> +++ b/src/conf/virnodedeviceobj.c
> @@ -524,7 +524,7 @@ virNodeDeviceObjListRemove(virNodeDeviceObjList *devs,
>      virObjectRWLockWrite(devs);
>      virObjectLock(obj);
>      virNodeDeviceObjListRemoveLocked(devs, obj);
> -    virNodeDeviceObjEndAPI(&obj);
> +    virObjectUnref(obj);
>      virObjectRWUnlock(devs);
>  }
>  

Self-NAK, I need to squash in two more bits.

Michal




More information about the libvir-list mailing list