summaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lustre/ldlm
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2018-03-02 10:31:25 +1100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-06 04:20:23 -0800
commit26f7a294e5ecd46856cb9f5b718e995f1ec46779 (patch)
treecc399900348b213709dbf8915791c8e49906b2fa /drivers/staging/lustre/lustre/ldlm
parent165020462d26d6925cbd2d25dfbd4ff1a8fba103 (diff)
downloadop-kernel-dev-26f7a294e5ecd46856cb9f5b718e995f1ec46779.zip
op-kernel-dev-26f7a294e5ecd46856cb9f5b718e995f1ec46779.tar.gz
staging: lustre: ptlrpc: move thread creation out of module initialization
When the ptlrpc module is loaded, it starts the pinger thread and calls LNetNIInit which starts various threads. We don't need these threads until the module is actually being used, such as when a lustre filesystem is mounted. So move the thread creation into new ptlrpc_inc_ref() (modeled on ptlrpcd_inc_ref()), and call that when needed, such as at mount time. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lustre/ldlm')
-rw-r--r--drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
index 58913e6..c772c68 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
@@ -869,6 +869,10 @@ int ldlm_get_ref(void)
{
int rc = 0;
+ rc = ptlrpc_inc_ref();
+ if (rc)
+ return rc;
+
mutex_lock(&ldlm_ref_mutex);
if (++ldlm_refcount == 1) {
rc = ldlm_setup();
@@ -877,14 +881,18 @@ int ldlm_get_ref(void)
}
mutex_unlock(&ldlm_ref_mutex);
+ if (rc)
+ ptlrpc_dec_ref();
+
return rc;
}
void ldlm_put_ref(void)
{
+ int rc = 0;
mutex_lock(&ldlm_ref_mutex);
if (ldlm_refcount == 1) {
- int rc = ldlm_cleanup();
+ rc = ldlm_cleanup();
if (rc)
CERROR("ldlm_cleanup failed: %d\n", rc);
@@ -894,6 +902,8 @@ void ldlm_put_ref(void)
ldlm_refcount--;
}
mutex_unlock(&ldlm_ref_mutex);
+ if (!rc)
+ ptlrpc_dec_ref();
}
static ssize_t cancel_unused_locks_before_replay_show(struct kobject *kobj,
OpenPOWER on IntegriCloud