Whamcloud - gitweb
LU-14462 gss: remove HAVE_SETNS from lgss_keyring 67/41967/3
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 9 Mar 2021 16:11:44 +0000 (17:11 +0100)
committerOleg Drokin <green@whamcloud.com>
Tue, 30 Mar 2021 04:16:34 +0000 (04:16 +0000)
For the sake of simplification, a previous patch removed the config
check that sets HAVE_SETNS, due to the fact that in kernels 3.10+
function setns() necessarily exists.
In this case, all #ifdef on HAVE_SETNS are erroneous because it is
not set whereas the function is actually available.
So remove all references to HAVE_SETNS in the code.

Fixes: 8e88bbfef5 ("LU-12477 lustre: remove obsolete config checks")
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: Iab0726c3e847a210185cc8c9353a79976acb1381
Reviewed-on: https://review.whamcloud.com/41967
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/gss/lgss_keyring.c

index dfcb0ad..93fd94c 100644 (file)
@@ -902,7 +902,6 @@ out:
 
 static int associate_with_ns(char *path)
 {
-#ifdef HAVE_SETNS
        int fd, rc = -1;
 
        fd = open(path, O_RDONLY);
@@ -912,9 +911,6 @@ static int associate_with_ns(char *path)
        }
 
        return rc;
-#else
-       return -1;
-#endif /* HAVE_SETNS */
 }
 
 static int prepare_and_instantiate(struct lgss_cred *cred, key_serial_t keyid,
@@ -967,10 +963,8 @@ int main(int argc, char *argv[])
        char                          path[PATH_MAX] = "";
        int                           other_ns = 0;
        int                           rc = 0;
-#ifdef HAVE_SETNS
        struct stat                   parent_ns = { .st_ino = 0 };
        struct stat                   caller_ns = { .st_ino = 0 };
-#endif
 
        set_log_level();
 
@@ -1064,7 +1058,6 @@ int main(int argc, char *argv[])
        cred->lc_svc_type = uparam.kup_svc_type;
        cred->lc_self_nid = uparam.kup_selfnid;
 
-#ifdef HAVE_SETNS
        /* Is caller in different namespace? */
        snprintf(path, sizeof(path), "/proc/%d/ns/mnt", getpid());
        if (stat(path, &parent_ns)) {
@@ -1077,7 +1070,6 @@ int main(int argc, char *argv[])
                else if (caller_ns.st_ino != parent_ns.st_ino)
                        other_ns = 1;
        }
-#endif /* HAVE_SETNS */
 
        /*
         * if caller's namespace is different, fork a child and associate it