Whamcloud - gitweb
LU-9859 libcfs: don't call unshare_fs_struct() 32/39132/3
authorMr NeilBrown <neilb@suse.de>
Sun, 7 Jun 2020 23:24:25 +0000 (19:24 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 4 Jul 2020 03:05:47 +0000 (03:05 +0000)
A kthread runs with the same fs_struct as init.
It is only helpful to unshare this if the thread
will change one of the fields in the fs_struct:
 root directory
 current working directory
 umask.

No lustre kthread changes any of these, so there is
no need to call unshare_fs_struct().

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I7309b6ed184b14a272bad7dc5149ad36281f948e
Reviewed-on: https://review.whamcloud.com/39132
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
14 files changed:
libcfs/include/libcfs/libcfs.h
libcfs/libcfs/linux/linux-curproc.c
libcfs/libcfs/linux/linux-prim.c
lustre/include/lustre_compat.h
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_request.c
lustre/llite/llite_lib.c
lustre/obdclass/llog.c
lustre/osd-ldiskfs/osd_handler.c
lustre/ptlrpc/import.c
lustre/ptlrpc/pinger.c
lustre/ptlrpc/ptlrpcd.c
lustre/ptlrpc/sec_ctx.c
lustre/ptlrpc/service.c

index afb748d..5caff08 100644 (file)
@@ -86,11 +86,6 @@ static inline int notifier_from_ioctl_errno(int err)
        return notifier_from_errno(err) | NOTIFY_STOP_MASK;
 }
 
        return notifier_from_errno(err) | NOTIFY_STOP_MASK;
 }
 
-/*
- * Defined by platform
- */
-int unshare_fs_struct(void);
-
 int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data);
 
 #define container_of0(ptr, type, member) container_of_safe(ptr, type, member)
 int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data);
 
 #define container_of0(ptr, type, member) container_of_safe(ptr, type, member)
index be449ad..5413a60 100644 (file)
@@ -41,7 +41,6 @@
 #include <linux/sched/signal.h>
 #include <linux/sched/mm.h>
 #endif
 #include <linux/sched/signal.h>
 #include <linux/sched/mm.h>
 #endif
-#include <linux/fs_struct.h>
 #include <linux/pagemap.h>
 #include <linux/compat.h>
 #include <linux/thread_info.h>
 #include <linux/pagemap.h>
 #include <linux/compat.h>
 #include <linux/thread_info.h>
index 76b4ca9..5609c52 100644 (file)
@@ -36,7 +36,6 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
-#include <linux/fs_struct.h>
 #include <linux/sched.h>
 #ifdef HAVE_SCHED_HEADERS
 #include <linux/sched/mm.h>
 #include <linux/sched.h>
 #ifdef HAVE_SCHED_HEADERS
 #include <linux/sched/mm.h>
index fc040f3..f046d6c 100644 (file)
@@ -35,7 +35,6 @@
 
 #include <linux/aio.h>
 #include <linux/fs.h>
 
 #include <linux/aio.h>
 #include <linux/fs.h>
-#include <linux/fs_struct.h>
 #include <linux/namei.h>
 #include <linux/pagemap.h>
 #include <linux/posix_acl_xattr.h>
 #include <linux/namei.h>
 #include <linux/pagemap.h>
 #include <linux/posix_acl_xattr.h>
index bd2c02a..62dc27e 100644 (file)
@@ -2641,8 +2641,6 @@ static int target_recovery_thread(void *arg)
        int rc = 0;
 
        ENTRY;
        int rc = 0;
 
        ENTRY;
-
-       unshare_fs_struct();
        OBD_ALLOC_PTR(thread);
        if (thread == NULL)
                RETURN(-ENOMEM);
        OBD_ALLOC_PTR(thread);
        if (thread == NULL)
                RETURN(-ENOMEM);
index 4458ebc..5598558 100644 (file)
@@ -2627,8 +2627,6 @@ static int ldlm_lock_replay_thread(void *data)
 {
        struct obd_import *imp = data;
 
 {
        struct obd_import *imp = data;
 
-       unshare_fs_struct();
-
        CDEBUG(D_HA, "lock replay thread %s to %s@%s\n",
               imp->imp_obd->obd_name, obd2cli_tgt(imp->imp_obd),
               imp->imp_connection->c_remote_uuid.uuid);
        CDEBUG(D_HA, "lock replay thread %s to %s@%s\n",
               imp->imp_obd->obd_name, obd2cli_tgt(imp->imp_obd),
               imp->imp_connection->c_remote_uuid.uuid);
index cd9f5ae..4b77a39 100644 (file)
@@ -49,6 +49,7 @@
 #include <linux/delay.h>
 #include <linux/uidgid.h>
 #include <linux/security.h>
 #include <linux/delay.h>
 #include <linux/uidgid.h>
 #include <linux/security.h>
+#include <linux/fs_struct.h>
 
 #ifndef HAVE_CPUS_READ_LOCK
 #include <libcfs/linux/linux-cpu.h>
 
 #ifndef HAVE_CPUS_READ_LOCK
 #include <libcfs/linux/linux-cpu.h>
index 2f8c046..d2c731b 100644 (file)
@@ -774,8 +774,6 @@ static int llog_process_thread_daemonize(void *arg)
        }
        task_unlock(lpi->lpi_reftask);
 
        }
        task_unlock(lpi->lpi_reftask);
 
-       unshare_fs_struct();
-
        /* client env has no keys, tags is just 0 */
        rc = lu_env_init(&env, LCT_LOCAL | LCT_MG_THREAD);
        if (rc)
        /* client env has no keys, tags is just 0 */
        rc = lu_env_init(&env, LCT_LOCAL | LCT_MG_THREAD);
        if (rc)
index da20b66..269e430 100644 (file)
@@ -39,6 +39,7 @@
 
 #define DEBUG_SUBSYSTEM S_OSD
 
 
 #define DEBUG_SUBSYSTEM S_OSD
 
+#include <linux/fs_struct.h>
 #include <linux/kallsyms.h>
 #include <linux/module.h>
 #include <linux/user_namespace.h>
 #include <linux/kallsyms.h>
 #include <linux/module.h>
 #include <linux/user_namespace.h>
index 6221bbc..389e6c9 100644 (file)
@@ -1487,9 +1487,6 @@ static int ptlrpc_invalidate_import_thread(void *data)
         struct obd_import *imp = data;
 
         ENTRY;
         struct obd_import *imp = data;
 
         ENTRY;
-
-       unshare_fs_struct();
-
         CDEBUG(D_HA, "thread invalidate import %s to %s@%s\n",
                imp->imp_obd->obd_name, obd2cli_tgt(imp->imp_obd),
                imp->imp_connection->c_remote_uuid.uuid);
         CDEBUG(D_HA, "thread invalidate import %s to %s@%s\n",
                imp->imp_obd->obd_name, obd2cli_tgt(imp->imp_obd),
                imp->imp_connection->c_remote_uuid.uuid);
index 6b6cbe0..83344bd 100644 (file)
@@ -578,8 +578,6 @@ static int ping_evictor_main(void *arg)
        time64_t expire_time;
 
        ENTRY;
        time64_t expire_time;
 
        ENTRY;
-       unshare_fs_struct();
-
        CDEBUG(D_HA, "Starting Ping Evictor\n");
        pet_state = PET_READY;
        while (1) {
        CDEBUG(D_HA, "Starting Ping Evictor\n");
        pet_state = PET_READY;
        while (1) {
index b3a06a5..b92eed2 100644 (file)
@@ -442,9 +442,6 @@ static int ptlrpcd(void *arg)
        int                             exit = 0;
 
        ENTRY;
        int                             exit = 0;
 
        ENTRY;
-
-       unshare_fs_struct();
-
        if (cfs_cpt_bind(cfs_cpt_tab, pc->pc_cpt) != 0)
                CWARN("Failed to bind %s on CPT %d\n", pc->pc_name, pc->pc_cpt);
 
        if (cfs_cpt_bind(cfs_cpt_tab, pc->pc_cpt) != 0)
                CWARN("Failed to bind %s on CPT %d\n", pc->pc_name, pc->pc_cpt);
 
index 1d22b90..6342749 100644 (file)
@@ -27,6 +27,7 @@
 #define DEBUG_SUBSYSTEM S_FILTER
 
 #include <linux/fs.h>
 #define DEBUG_SUBSYSTEM S_FILTER
 
 #include <linux/fs.h>
+#include <linux/fs_struct.h>
 #include <libcfs/libcfs.h>
 #include <lvfs.h>
 #include <obd_class.h>
 #include <libcfs/libcfs.h>
 #include <lvfs.h>
 #include <obd_class.h>
index c55f70e..05514cf 100644 (file)
@@ -2746,7 +2746,6 @@ static int ptlrpc_main(void *arg)
 
        thread->t_task = current;
        thread->t_pid = current->pid;
 
        thread->t_task = current;
        thread->t_pid = current->pid;
-       unshare_fs_struct();
 
        if (svc->srv_cpt_bind) {
                rc = cfs_cpt_bind(svc->srv_cptable, svcpt->scp_cpt);
 
        if (svc->srv_cpt_bind) {
                rc = cfs_cpt_bind(svc->srv_cptable, svcpt->scp_cpt);
@@ -2954,8 +2953,6 @@ static int ptlrpc_hr_main(void *arg)
        if (env == NULL)
                RETURN(-ENOMEM);
 
        if (env == NULL)
                RETURN(-ENOMEM);
 
-       unshare_fs_struct();
-
        rc = cfs_cpt_bind(ptlrpc_hr.hr_cpt_table, hrp->hrp_cpt);
        if (rc != 0) {
                char threadname[20];
        rc = cfs_cpt_bind(ptlrpc_hr.hr_cpt_table, hrp->hrp_cpt);
        if (rc != 0) {
                char threadname[20];