]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
block/rnbd-clt: Make path parameter optional for map_device
authorMd Haris Iqbal <haris.iqbal@cloud.ionos.com>
Thu, 26 Nov 2020 10:47:16 +0000 (11:47 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 4 Dec 2020 16:41:10 +0000 (09:41 -0700)
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>
drivers/block/rnbd/rnbd-clt-sysfs.c
drivers/block/rnbd/rnbd-clt.c

index 4f4474eecadb76b3fa6e4f180a030d70f2695dd4..e7b41ec7cd6a2ff29aec4c92041fff523c4b983d 100644 (file)
@@ -37,7 +37,6 @@ enum {
 };
 
 static const unsigned int rnbd_opt_mandatory[] = {
-       RNBD_OPT_PATH,
        RNBD_OPT_DEV_PATH,
        RNBD_OPT_SESSNAME,
 };
index 8b2411ccbda97c4f613882bbdea554cf6b89e904..edefa0761a814bde56602e5e4b1cbb7fa4961b3c 100644 (file)
@@ -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,