diff mbox series

[for-next,3/3] block/rnbd-clt: send_msg_close if any error occurs after send_msg_open

Message ID 20201013103050.33269-4-jinpu.wang@cloud.ionos.com (mailing list archive)
State New, archived
Headers show
Series misc fix and cleanup for rnbd | expand

Commit Message

Jinpu Wang Oct. 13, 2020, 10:30 a.m. UTC
From: Gioh Kim <gi-oh.kim@cloud.ionos.com>

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@cloud.ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
---
 drivers/block/rnbd/rnbd-clt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c
index 22381aee1cf4..9ab9c467f272 100644
--- a/drivers/block/rnbd/rnbd-clt.c
+++ b/drivers/block/rnbd/rnbd-clt.c
@@ -1515,7 +1515,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,
@@ -1534,6 +1534,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: