linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jack Wang <jinpu.wang@cloud.ionos.com>
To: linux-block@vger.kernel.org
Cc: axboe@kernel.dk, hch@infradead.org, sagi@grimberg.me,
	bvanassche@acm.org, danil.kipnis@cloud.ionos.com,
	Md Haris Iqbal <haris.iqbal@cloud.ionos.com>
Subject: [PATCH for-next 1/8] block/rnbd-clt: Make path parameter optional for map_device
Date: Thu, 26 Nov 2020 11:47:16 +0100	[thread overview]
Message-ID: <20201126104723.150674-2-jinpu.wang@cloud.ionos.com> (raw)
In-Reply-To: <20201126104723.150674-1-jinpu.wang@cloud.ionos.com>

From: Md Haris Iqbal <haris.iqbal@cloud.ionos.com>

During map_device if the given session exists, then the path parameter is
not used. In such a case, the path parameter is redundant.

This commit makes the path parameter optional for map_device. When the
path parameter is not given, if the session exists then that is used to
establish the rtrs connection.

If the session does not exist, and the path parameter is also missing,
then map_device fails.

Signed-off-by: Md Haris Iqbal <haris.iqbal@cloud.ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
---
 drivers/block/rnbd/rnbd-clt-sysfs.c | 1 -
 drivers/block/rnbd/rnbd-clt.c       | 6 ++++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/block/rnbd/rnbd-clt-sysfs.c b/drivers/block/rnbd/rnbd-clt-sysfs.c
index 4f4474eecadb..e7b41ec7cd6a 100644
--- a/drivers/block/rnbd/rnbd-clt-sysfs.c
+++ b/drivers/block/rnbd/rnbd-clt-sysfs.c
@@ -37,7 +37,6 @@ enum {
 };
 
 static const unsigned int rnbd_opt_mandatory[] = {
-	RNBD_OPT_PATH,
 	RNBD_OPT_DEV_PATH,
 	RNBD_OPT_SESSNAME,
 };
diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c
index 8b2411ccbda9..edefa0761a81 100644
--- a/drivers/block/rnbd/rnbd-clt.c
+++ b/drivers/block/rnbd/rnbd-clt.c
@@ -1193,6 +1193,12 @@ find_and_get_or_create_sess(const char *sessname,
 	else if (!first)
 		return sess;
 
+	if (!path_cnt) {
+		pr_err("Session %s not found, and path parameter not given", sessname);
+		err = -ENXIO;
+		goto put_sess;
+	}
+
 	rtrs_ops = (struct rtrs_clt_ops) {
 		.priv = sess,
 		.link_ev = rnbd_clt_link_ev,
-- 
2.25.1


  reply	other threads:[~2020-11-26 10:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 10:47 [PATCH for-next 0/8] update for rnbd Jack Wang
2020-11-26 10:47 ` Jack Wang [this message]
2020-11-26 10:47 ` [PATCH for-next 2/8] block/rnbd-clt: support mapping two devices with the same name from different servers Jack Wang
2020-11-26 10:47 ` [PATCH for-next 3/8] Documentation/ABI/rnbd-clt: fix typo in sysfs-class-rnbd-client Jack Wang
2020-11-26 10:47 ` [PATCH for-next 4/8] Documentation/ABI/rnbd-clt: session name is appended to the device path Jack Wang
2020-11-26 10:47 ` [PATCH for-next 5/8] block/rnbd-srv: close a mapped device from server side Jack Wang
2020-11-26 10:47 ` [PATCH for-next 6/8] Documentation/ABI/rnbd-srv: add document for force_close Jack Wang
2020-11-26 10:47 ` [PATCH for-next 7/8] block/rnbd: call kobject_put in the failure path Jack Wang
2020-11-26 10:47 ` [PATCH for-next 8/8] block/rnbd-clt: Dynamically alloc buffer for pathname & blk_symlink_name Jack Wang
2020-12-04 10:15 ` [PATCH for-next 0/8] update for rnbd Jinpu Wang
2020-12-04 16:41 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201126104723.150674-2-jinpu.wang@cloud.ionos.com \
    --to=jinpu.wang@cloud.ionos.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=danil.kipnis@cloud.ionos.com \
    --cc=haris.iqbal@cloud.ionos.com \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).