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

Re: [win-pv-devel] [PATCH] Protect BackendPath from race using StateLock



> -----Original Message-----
> From: win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx [mailto:win-pv-devel-
> bounces@xxxxxxxxxxxxxxxxxxxx] On Behalf Of Ben Chalmers
> Sent: 20 January 2015 14:27
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Ben Chalmers
> Subject: [win-pv-devel] [PATCH] Protect BackendPath from race using
> StateLock
> 
> The BackendPath can change as part of PDO state transitions, leading
> to a race with the frontend thread.  Since the frontend state lock is
> locked through state transitions, taking the lock is sufficient to
> avoid the race
> 
> Signed-off-by: Ben Chalmers <Ben.Chalmers@xxxxxxxxxx>

Acked-by: Paul Durrant <paul.durrant@xxxxxxxxxx>

> ---
>  src/xenvbd/frontend.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/xenvbd/frontend.c b/src/xenvbd/frontend.c
> index 25b268d..f01b142 100644
> --- a/src/xenvbd/frontend.c
> +++ b/src/xenvbd/frontend.c
> @@ -1579,12 +1579,15 @@ FrontendBackendPathChanged(
>      __in  PXENVBD_FRONTEND        Frontend
>      )
>  {
> +    KIRQL       Irql;
> +    KeAcquireSpinLock(&Frontend->StateLock, &Irql);
>      // Only attempt this if Active, Active is set/cleared on D3->D0/D0->D3
>      if (Frontend->Active) {
>          // Note: Nothing may have changed with this target, this could be
> caused by another target changing
>          __ReadDiskInfo(Frontend);
>          __CheckBackendForEject(Frontend);
>      }
> +    KeReleaseSpinLock(&Frontend->StateLock, Irql);
>  }
> 
>  __checkReturn
> --
> 1.9.5.msysgit.0
> 
> 
> _______________________________________________
> win-pv-devel mailing list
> win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.