RE: [PATCH] hv_sock: Fix data loss upon socket close

From: Sunil Muthuswamy
Date: Tue May 14 2019 - 12:35:17 EST




> -----Original Message-----
> From: linux-hyperv-owner@xxxxxxxxxxxxxxx <linux-hyperv-owner@xxxxxxxxxxxxxxx> On Behalf Of David Miller
> Sent: Thursday, May 9, 2019 1:58 PM
> To: Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx>
> Cc: KY Srinivasan <kys@xxxxxxxxxxxxx>; Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>; Stephen Hemminger
> <sthemmin@xxxxxxxxxxxxx>; sashal@xxxxxxxxxx; Dexuan Cui <decui@xxxxxxxxxxxxx>; Michael Kelley <mikelley@xxxxxxxxxxxxx>;
> netdev@xxxxxxxxxxxxxxx; linux-hyperv@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH] hv_sock: Fix data loss upon socket close
>
> From: Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx>
> Date: Wed, 8 May 2019 23:10:35 +0000
>
> > +static inline void hvs_shutdown_lock_held(struct hvsock *hvs, int mode)
>
> Please do not use the inline keyword in foo.c files, let the compiler decide.
>
Thanks, will fix in the next version.
> Also, longer term thing, I notice that vsock_remove_socket() is very
> inefficient locking-wise. It takes the table lock to do the placement
> test, and takes it again to do the removal. Might even be racy.
Agreed. The check & remove should be done as an atomic operation.
This can be taken up as a separate patch.