Re: [PATCH net v2] net: lapb: Add locking to the lapb module

From: Xie He
Date: Tue Jan 19 2021 - 18:59:07 EST


On Tue, Jan 19, 2021 at 3:34 AM Martin Schiller <ms@xxxxxxxxxx> wrote:
>
> > 4. In lapb_device_event, replace the "lapb_disconnect_request" call
> > with
> > the content of "lapb_disconnect_request", to avoid trying to hold the
> > lock twice. When I do this, I removed "lapb_start_t1timer" because I
> > don't think it's necessary to start the timer when "NETDEV_GOING_DOWN".
>
> I don't like the code redundancy this creates. Maybe you should move the
> actual functionality from lapb_disconnect_request() to a
> __lapb_disconnect_request(), and in lapb_disconnect_request() call this
> function including locking around it and also in lapb_device_event
> (without locking).
>
> Calling lapb_start_t1timer() on a "NETDEV_GOING_DOWN" event does not
> hurt and is correct from a protocol flow point of view after sending
> the DISC.

Thanks! I created a new __lapb_disconnect_request function and the
code indeed looked cleaner. I'll send a new version.