Whamcloud - gitweb
LU-3772 ptlrpc: fix nrs cleanup
[fs/lustre-release.git] / lustre / ptlrpc / nrs.c
index 4a3c976..6d02aa5 100644 (file)
@@ -1019,7 +1019,13 @@ static void nrs_svcpt_cleanup_locked(struct ptlrpc_service_part *svcpt)
        LASSERT(mutex_is_locked(&nrs_core.nrs_mutex));
 
 again:
-       nrs = nrs_svcpt2nrs(svcpt, hp);
+       /* scp_nrs_hp could be NULL due to short of memory. */
+       nrs = hp ? svcpt->scp_nrs_hp : &svcpt->scp_nrs_reg;
+       /* check the nrs_svcpt to see if nrs is initialized. */
+       if (!nrs || !nrs->nrs_svcpt) {
+               EXIT;
+               return;
+       }
        nrs->nrs_stopping = 1;
 
        cfs_list_for_each_entry_safe(policy, tmp, &nrs->nrs_policy_list,