Whamcloud - gitweb
LU-19098 hsm: don't print progname twice with lhsmtool
[fs/lustre-release.git] / lustre / ptlrpc / sec_ctx.c
index 6342749..a680fe3 100644 (file)
@@ -1,25 +1,5 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- *
- * http://www.gnu.org/licenses/gpl-2.0.html
- *
- * GPL HEADER END
- */
+// SPDX-License-Identifier: GPL-2.0
+
 /*
  * Copyright (c) 2014, 2017, Intel Corporation.
  */
 /* Debugging check only needed during development */
 #ifdef OBD_CTXT_DEBUG
 # define ASSERT_CTXT_MAGIC(magic) LASSERT((magic) == OBD_RUN_CTXT_MAGIC)
-# define ASSERT_NOT_KERNEL_CTXT(msg) LASSERTF(!segment_eq(get_fs(), KERNEL_DS),\
-                                             msg)
-# define ASSERT_KERNEL_CTXT(msg) LASSERTF(segment_eq(get_fs(), KERNEL_DS), msg)
 #else
 # define ASSERT_CTXT_MAGIC(magic) do {} while(0)
-# define ASSERT_NOT_KERNEL_CTXT(msg) do {} while(0)
-# define ASSERT_KERNEL_CTXT(msg) do {} while(0)
 #endif
 
 static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
@@ -74,11 +49,9 @@ void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx)
        if (new_ctx->dt != NULL)
                return;
 
-       //ASSERT_NOT_KERNEL_CTXT("already in kernel context!\n");
        ASSERT_CTXT_MAGIC(new_ctx->magic);
        OBD_SET_CTXT_MAGIC(save);
 
-       save->fs = get_fs();
        LASSERT(ll_d_count(current->fs->pwd.dentry));
        LASSERT(ll_d_count(new_ctx->pwd));
        save->pwd = dget(current->fs->pwd.dentry);
@@ -91,7 +64,6 @@ void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx)
        LASSERT(new_ctx->pwdmnt);
 
        current->fs->umask = 0; /* umask already applied on client */
-       set_fs(new_ctx->fs);
        ll_set_fs_pwd(current->fs, new_ctx->pwdmnt, new_ctx->pwd);
 }
 EXPORT_SYMBOL(push_ctxt);
@@ -103,14 +75,12 @@ void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx)
                return;
 
        ASSERT_CTXT_MAGIC(saved->magic);
-       ASSERT_KERNEL_CTXT("popping non-kernel context!\n");
 
-       LASSERTF(current->fs->pwd.dentry == new_ctx->pwd, "%p != %p\n",
+       LASSERTF(current->fs->pwd.dentry == new_ctx->pwd, "%px != %px\n",
                 current->fs->pwd.dentry, new_ctx->pwd);
-       LASSERTF(current->fs->pwd.mnt == new_ctx->pwdmnt, "%p != %p\n",
+       LASSERTF(current->fs->pwd.mnt == new_ctx->pwdmnt, "%px != %px\n",
                 current->fs->pwd.mnt, new_ctx->pwdmnt);
 
-       set_fs(saved->fs);
        ll_set_fs_pwd(current->fs, saved->pwdmnt, saved->pwd);
 
        dput(saved->pwd);