Whamcloud - gitweb
LU-8436 nodemap: MGS local MGC should not get_config
[fs/lustre-release.git] / lustre / mgc / mgc_request.c
index 0d568d3..7d35508 100644 (file)
@@ -485,12 +485,9 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg)
                config_log_put(cld_params);
        }
 
-       if (cld_nodemap) {
-               mutex_lock(&cld_nodemap->cld_lock);
-               cld_nodemap->cld_stopping = 1;
-               mutex_unlock(&cld_nodemap->cld_lock);
+       /* don't set cld_stopping on nm lock as other targets may be active */
+       if (cld_nodemap)
                config_log_put(cld_nodemap);
-       }
 
        /* drop the ref from the find */
        config_log_put(cld);
@@ -553,10 +550,13 @@ static void do_requeue(struct config_llog_data *cld)
 
        LASSERT(atomic_read(&cld->cld_refcount) > 0);
 
-       /* Do not run mgc_process_log on a disconnected export or an
+       /*
+        * Do not run mgc_process_log on a disconnected export or an
         * export which is being disconnected. Take the client
-        * semaphore to make the check non-racy. */
-       down_read(&cld->cld_mgcexp->exp_obd->u.cli.cl_sem);
+        * semaphore to make the check non-racy.
+        */
+       down_read_nested(&cld->cld_mgcexp->exp_obd->u.cli.cl_sem,
+                        OBD_CLI_SEM_MGC);
        if (cld->cld_mgcexp->exp_obd->u.cli.cl_conn_count != 0) {
                CDEBUG(D_MGC, "updating log %s\n", cld->cld_logname);
                rc = mgc_process_log(cld->cld_mgcexp->exp_obd, cld);
@@ -1573,6 +1573,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc,
 static int mgc_process_recover_nodemap_log(struct obd_device *obd,
                                           struct config_llog_data *cld)
 {
+       struct ptlrpc_connection *mgc_conn;
        struct ptlrpc_request *req = NULL;
        struct config_llog_instance *cfg = &cld->cld_cfg;
        struct mgs_config_body *body;
@@ -1580,17 +1581,23 @@ static int mgc_process_recover_nodemap_log(struct obd_device *obd,
        struct nodemap_config *new_config = NULL;
        struct lu_nodemap *recent_nodemap = NULL;
        struct ptlrpc_bulk_desc *desc;
-       struct page **pages;
+       struct page **pages = NULL;
        __u64 config_read_offset = 0;
-       int nrpages;
+       int nrpages = 0;
        bool eof = true;
        bool mne_swab = false;
        int i;
        int ealen;
        int rc;
-
        ENTRY;
 
+       mgc_conn = class_exp2cliimp(cld->cld_mgcexp)->imp_connection;
+
+       /* don't need to get local config */
+       if (cld_is_nodemap(cld) &&
+           (LNET_NETTYP(LNET_NIDNET(mgc_conn->c_peer.nid)) == LOLND))
+               GOTO(out, rc = 0);
+
         /* allocate buffer for bulk transfer.
          * if this is the first time for this mgs to read logs,
          * CONFIG_READ_NRPAGES_INIT will be used since it will read all logs