Skip to contentSkip to conversation

misc fix and cleanup for rnbd

PATCH Applied Jack Wang 2 participants 5 messages Oct 13, 2020

Subsystems (2)
lore
Share & tools
lore

Jack Wang

author
#0 lore raw

cover misc fix and cleanup for rnbd

Hi Jens,

Please consider to include following changes to upstream.

The first one is just a resend, Gioh sent it 2 weeks ago, it got ignored somehow.

The second one is just a small clean up.

The third one is a small bugfix.

Regards!
Jack Wang

Gioh Kim (1):
block/rnbd-clt: send_msg_close if any error occurs after send_msg_open

Guoqing Jiang (1):
block/rnbd-clt: remove nr argument from send_usr_msg

Jack Wang (1):
block/rnbd-clt: do not cap max_hw_sectors & max_segments with remote
device

 drivers/block/rnbd/rnbd-clt.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 1/3 block/rnbd-clt: remove nr argument from send_usr_msg

From: Guoqing Jiang <[email protected]>

The argument is not needed since all callers pass 1 for it.

---
 drivers/block/rnbd/rnbd-clt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/block/rnbd/rnbd-clt.c +5 -5
index cc6a4e2587ae..cffb750db7a4 100644
@@ -433,7 +433,7 @@ enum wait_type {
 };
 
 static int send_usr_msg(struct rtrs_clt *rtrs, int dir,
-			struct rnbd_iu *iu, struct kvec *vec, size_t nr,
+			struct rnbd_iu *iu, struct kvec *vec,
 			size_t len, struct scatterlist *sg, unsigned int sg_len,
 			void (*conf)(struct work_struct *work),
 			int *errno, enum wait_type wait)
@@ -447,7 +447,7 @@ static int send_usr_msg(struct rtrs_clt *rtrs, int dir,
 		.conf_fn = msg_conf,
 	};
 	err = rtrs_clt_request(dir, &req_ops, rtrs, iu->permit,
-				vec, nr, len, sg, sg_len);
+				vec, 1, len, sg, sg_len);
 	if (!err && wait) {
 		wait_event(iu->comp.wait, iu->comp.errno != INT_MAX);
 		*errno = iu->comp.errno;
@@ -492,7 +492,7 @@ static int send_msg_close(struct rnbd_clt_dev *dev, u32 device_id, bool wait)
 	msg.device_id	= cpu_to_le32(device_id);
 
 	WARN_ON(!rnbd_clt_get_dev(dev));
-	err = send_usr_msg(sess->rtrs, WRITE, iu, &vec, 1, 0, NULL, 0,
+	err = send_usr_msg(sess->rtrs, WRITE, iu, &vec, 0, NULL, 0,
 			   msg_close_conf, &errno, wait);
 	if (err) {
 		rnbd_clt_put_dev(dev);
@@ -581,7 +581,7 @@ static int send_msg_open(struct rnbd_clt_dev *dev, bool wait)
 
 	WARN_ON(!rnbd_clt_get_dev(dev));
 	err = send_usr_msg(sess->rtrs, READ, iu,
-			   &vec, 1, sizeof(*rsp), iu->sglist, 1,
+			   &vec, sizeof(*rsp), iu->sglist, 1,
 			   msg_open_conf, &errno, wait);
 	if (err) {
 		rnbd_clt_put_dev(dev);
@@ -635,7 +635,7 @@ static int send_msg_sess_info(struct rnbd_clt_session *sess, bool wait)
 		goto put_iu;
 	}
 	err = send_usr_msg(sess->rtrs, READ, iu,
-			   &vec, 1, sizeof(*rsp), iu->sglist, 1,
+			   &vec, sizeof(*rsp), iu->sglist, 1,
 			   msg_sess_info_conf, &errno, wait);
 	if (err) {
 		rnbd_clt_put_sess(sess);
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH 2/3 block/rnbd-clt: do not cap max_hw_sectors & max_segments with remote device

In reply to Jack Wang

The max_hw_secotrs is only limited by the transport, not remote device, block layer on server side will split to the device limit if it's too big.

The max_segments, similar, and rtrs server will submit single buffer, so no need to cap.

---
 drivers/block/rnbd/rnbd-clt.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/block/rnbd/rnbd-clt.c +0 -5
index cffb750db7a4..22381aee1cf4 100644
@@ -91,11 +91,6 @@ static int rnbd_clt_set_dev_attr(struct rnbd_clt_dev *dev,
 	dev->max_hw_sectors = sess->max_io_size / SECTOR_SIZE;
 	dev->max_segments = BMAX_SEGMENTS;
 
-	dev->max_hw_sectors = min_t(u32, dev->max_hw_sectors,
-				    le32_to_cpu(rsp->max_hw_sectors));
-	dev->max_segments = min_t(u16, dev->max_segments,
-				  le16_to_cpu(rsp->max_segments));
-
 	return 0;
 }
 
Signature · 1 line
2.25.1
author
#3 lore raw

PATCH 3/3 block/rnbd-clt: send_msg_close if any error occurs after send_msg_open

In reply to Jack Wang

From: Gioh Kim <[email protected]>

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.

---
 drivers/block/rnbd/rnbd-clt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/block/rnbd/rnbd-clt.c +3 -1
index 22381aee1cf4..9ab9c467f272 100644
@@ -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:
Signature · 1 line
2.25.1
maintainer Applied
#4 lore raw
In reply to Jack Wang
Quoted 10 lines · Jack Wang

Hi Jens,

Please consider to include following changes to upstream.

The first one is just a resend, Gioh sent it 2 weeks ago, it got ignored somehow.

The second one is just a small clean up.

The third one is a small bugfix.

Applied, thanks.

Signature · 1 line
Jens Axboe