aboutsummaryrefslogtreecommitdiff
path: root/drivers/block/rnbd
diff options
context:
space:
mode:
authorMd Haris Iqbal2020-11-26 11:47:16 +0100
committerJens Axboe2020-12-04 09:41:10 -0700
commitce9fe18abb7c86a71b545e1cdd60fe333bf462a3 (patch)
treef909cf31013ebbfae3797d67762701aa6f898261 /drivers/block/rnbd
parent3b9351f0fd14f2e9ef3141f0d894076517400e6e (diff)
block/rnbd-clt: Make path parameter optional for map_device
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> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/rnbd')
-rw-r--r--drivers/block/rnbd/rnbd-clt-sysfs.c1
-rw-r--r--drivers/block/rnbd/rnbd-clt.c6
2 files changed, 6 insertions, 1 deletions
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,