Skip to content

Commit

Permalink
block/rnbd-clt: Make path parameter optional for map_device
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Md Haris Iqbal authored and Jens Axboe committed Dec 4, 2020
1 parent 3b9351f commit ce9fe18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion drivers/block/rnbd/rnbd-clt-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ enum {
};

static const unsigned int rnbd_opt_mandatory[] = {
RNBD_OPT_PATH,
RNBD_OPT_DEV_PATH,
RNBD_OPT_SESSNAME,
};
Expand Down
6 changes: 6 additions & 0 deletions drivers/block/rnbd/rnbd-clt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ce9fe18

Please sign in to comment.