From: Mr NeilBrown Date: Sun, 7 Jun 2020 23:24:25 +0000 (-0400) Subject: LU-9859 libcfs: don't call unshare_fs_struct() X-Git-Tag: 2.13.55~44 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=9013eb2bb5492b1e8321d0ed534bee566f19627b LU-9859 libcfs: don't call unshare_fs_struct() 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 Change-Id: I7309b6ed184b14a272bad7dc5149ad36281f948e Reviewed-on: https://review.whamcloud.com/39132 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Yang Sheng Reviewed-by: Oleg Drokin --- diff --git a/libcfs/include/libcfs/libcfs.h b/libcfs/include/libcfs/libcfs.h index afb748d..5caff08 100644 --- a/libcfs/include/libcfs/libcfs.h +++ b/libcfs/include/libcfs/libcfs.h @@ -86,11 +86,6 @@ static inline int notifier_from_ioctl_errno(int err) 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) diff --git a/libcfs/libcfs/linux/linux-curproc.c b/libcfs/libcfs/linux/linux-curproc.c index be449ad..5413a60 100644 --- a/libcfs/libcfs/linux/linux-curproc.c +++ b/libcfs/libcfs/linux/linux-curproc.c @@ -41,7 +41,6 @@ #include #include #endif -#include #include #include #include diff --git a/libcfs/libcfs/linux/linux-prim.c b/libcfs/libcfs/linux/linux-prim.c index 76b4ca9..5609c52 100644 --- a/libcfs/libcfs/linux/linux-prim.c +++ b/libcfs/libcfs/linux/linux-prim.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #ifdef HAVE_SCHED_HEADERS #include diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index fc040f3..f046d6c 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -35,7 +35,6 @@ #include #include -#include #include #include #include diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index bd2c02a..62dc27e 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -2641,8 +2641,6 @@ static int target_recovery_thread(void *arg) int rc = 0; ENTRY; - - unshare_fs_struct(); OBD_ALLOC_PTR(thread); if (thread == NULL) RETURN(-ENOMEM); diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 4458ebc..5598558 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -2627,8 +2627,6 @@ static int ldlm_lock_replay_thread(void *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); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index cd9f5ae..4b77a39 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -49,6 +49,7 @@ #include #include #include +#include #ifndef HAVE_CPUS_READ_LOCK #include diff --git a/lustre/obdclass/llog.c b/lustre/obdclass/llog.c index 2f8c046..d2c731b 100644 --- a/lustre/obdclass/llog.c +++ b/lustre/obdclass/llog.c @@ -774,8 +774,6 @@ static int llog_process_thread_daemonize(void *arg) } 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) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index da20b66..269e430 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -39,6 +39,7 @@ #define DEBUG_SUBSYSTEM S_OSD +#include #include #include #include diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 6221bbc..389e6c9 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -1487,9 +1487,6 @@ static int ptlrpc_invalidate_import_thread(void *data) 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); diff --git a/lustre/ptlrpc/pinger.c b/lustre/ptlrpc/pinger.c index 6b6cbe0..83344bd 100644 --- a/lustre/ptlrpc/pinger.c +++ b/lustre/ptlrpc/pinger.c @@ -578,8 +578,6 @@ static int ping_evictor_main(void *arg) time64_t expire_time; ENTRY; - unshare_fs_struct(); - CDEBUG(D_HA, "Starting Ping Evictor\n"); pet_state = PET_READY; while (1) { diff --git a/lustre/ptlrpc/ptlrpcd.c b/lustre/ptlrpc/ptlrpcd.c index b3a06a5..b92eed2 100644 --- a/lustre/ptlrpc/ptlrpcd.c +++ b/lustre/ptlrpc/ptlrpcd.c @@ -442,9 +442,6 @@ static int ptlrpcd(void *arg) 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); diff --git a/lustre/ptlrpc/sec_ctx.c b/lustre/ptlrpc/sec_ctx.c index 1d22b90..6342749 100644 --- a/lustre/ptlrpc/sec_ctx.c +++ b/lustre/ptlrpc/sec_ctx.c @@ -27,6 +27,7 @@ #define DEBUG_SUBSYSTEM S_FILTER #include +#include #include #include #include diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index c55f70e..05514cf 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -2746,7 +2746,6 @@ static int ptlrpc_main(void *arg) 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); @@ -2954,8 +2953,6 @@ static int ptlrpc_hr_main(void *arg) 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];