Re: [PATCH] block/rnbd: send_msg_close if any error occurs after send_msg_open

From: Jinpu Wang
Date: Fri Sep 18 2020 - 04:18:41 EST


On Fri, Sep 18, 2020 at 9:24 AM Gioh Kim <gi-oh.kim@xxxxxxxxxxxxxxx> wrote:
>
> From: Gioh Kim <gi-oh.kim@xxxxxxxxxxxxxxx>
>
> After send_msg_open is done, send_msg_close should be done
> if any error occurs and it is necessary to recover
> what has been done.
>
> Signed-off-by: Gioh Kim <gi-oh.kim@xxxxxxxxxxxxxxx>
Looks good to me!
Thanks!
Acked-by: Jack Wang <jinpu.wang@xxxxxxxxxxxxxxx>
> ---
> drivers/block/rnbd/rnbd-clt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c
> index cc6a4e2587ae..4a24603d5224 100644
> --- a/drivers/block/rnbd/rnbd-clt.c
> +++ b/drivers/block/rnbd/rnbd-clt.c
> @@ -1520,7 +1520,7 @@ struct rnbd_clt_dev *rnbd_clt_map_device(const char *sessname,
> "map_device: Failed to configure device, err: %d\n",
> ret);
> mutex_unlock(&dev->lock);
> - goto del_dev;
> + goto send_close;
> }
>
> rnbd_clt_info(dev,
> @@ -1539,6 +1539,8 @@ struct rnbd_clt_dev *rnbd_clt_map_device(const char *sessname,
>
> return dev;
>
> +send_close:
> + send_msg_close(dev, dev->device_id, WAIT);
> del_dev:
> delete_dev(dev);
> put_dev:
> --
> 2.20.1
>