Re: [PATCH] esx: Fix race condition in esxVI_EnsureSession

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

 



On 05/01/2011 01:57 PM, Matthias Bolte wrote:
> When the session has expired then multiple threads can race while
> reestablishing it.
> 
> This race condition is not that critical as it requires a special usage
> pattern to be triggerd. It can only happen when an application doesn't

s/triggerd/triggered/

> do API calls for quite some time (the session expires after 30 min
> inactivity) and then multiple threads doing simultaneous API calls and
> end up doing simultaneous calls to esxVI_EnsureSession.
> ---
>  src/esx/esx_vi.c |   47 +++++++++++++++++++++++++++++++++++------------
>  src/esx/esx_vi.h |    4 +++-
>  2 files changed, 38 insertions(+), 13 deletions(-)

C code - I'm back in my element!

> +++ b/src/esx/esx_vi.h
> @@ -185,6 +185,7 @@ int esxVI_SharedCURL_Remove(esxVI_SharedCURL *shared, esxVI_CURL *curl);
>   */
>  
>  struct _esxVI_Context {
> +    /* All members are used read-only after esxVI_Context_Connect ... */
>      esxVI_CURL *curl;
>      char *url;
>      char *ipAddress;
> @@ -193,7 +194,8 @@ struct _esxVI_Context {
>      esxVI_ServiceContent *service;
>      esxVI_APIVersion apiVersion;
>      esxVI_ProductVersion productVersion;
> -    esxVI_UserSession *session;
> +    esxVI_UserSession *session; /* ... except the session ... */
> +    virMutexPtr sessionLock; /* ... that is protected by this mutex */

ACK, and thanks for those comments.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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