From: adilger Date: Wed, 14 Apr 2004 20:36:54 +0000 (+0000) Subject: Fix the RPC lprocfs stats. The lprocfs entries need to be created before X-Git-Tag: v1_8_0_110~486^6~5 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=419b87cbd51ad96477f4e42f7c6261888d852918;p=fs%2Flustre-release.git Fix the RPC lprocfs stats. The lprocfs entries need to be created before we call ptlrpc_init_svc() or it will silently not create any "stats" entry. b=1519 --- diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 78b0da2..a9ccebd 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -1819,6 +1819,9 @@ static int mdt_setup(struct obd_device *obd, obd_count len, void *buf) int rc = 0; ENTRY; + lprocfs_init_vars(mdt, &lvars); + lprocfs_obd_setup(obd, lvars.obd_vars); + mds->mds_service = ptlrpc_init_svc(MDS_NBUFS, MDS_BUFSIZE, MDS_MAXREQSIZE, MDS_REQUEST_PORTAL, MDC_REPLY_PORTAL, @@ -1827,7 +1830,7 @@ static int mdt_setup(struct obd_device *obd, obd_count len, void *buf) if (!mds->mds_service) { CERROR("failed to start service\n"); - RETURN(rc = -ENOMEM); + GOTO(err_lprocfs, rc = -ENOMEM); } rc = ptlrpc_start_n_threads(obd, mds->mds_service, MDT_NUM_THREADS, @@ -1866,9 +1869,6 @@ static int mdt_setup(struct obd_device *obd, obd_count len, void *buf) if (rc) GOTO(err_thread3, rc); - lprocfs_init_vars(mdt, &lvars); - lprocfs_obd_setup(obd, lvars.obd_vars); - RETURN(0); err_thread3: @@ -1877,17 +1877,16 @@ err_thread2: ptlrpc_unregister_service(mds->mds_setattr_service); err_thread: ptlrpc_unregister_service(mds->mds_service); +err_lprocfs: + lprocfs_obd_cleanup(obd); return rc; } - static int mdt_cleanup(struct obd_device *obd, int flags) { struct mds_obd *mds = &obd->u.mds; ENTRY; - lprocfs_obd_cleanup(obd); - ptlrpc_stop_all_threads(mds->mds_readpage_service); ptlrpc_unregister_service(mds->mds_readpage_service); @@ -1897,6 +1896,8 @@ static int mdt_cleanup(struct obd_device *obd, int flags) ptlrpc_stop_all_threads(mds->mds_service); ptlrpc_unregister_service(mds->mds_service); + lprocfs_obd_cleanup(obd); + RETURN(0); } diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 8a9a67a..f1c5e45 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -1133,6 +1133,9 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf) if (rc < 0) RETURN(rc); + lprocfs_init_vars(ost, &lvars); + lprocfs_obd_setup(obd, lvars.obd_vars); + ost->ost_service = ptlrpc_init_svc(OST_NBUFS, OST_BUFSIZE, OST_MAXREQSIZE, OST_REQUEST_PORTAL, OSC_REPLY_PORTAL, @@ -1140,13 +1143,13 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf) obd->obd_proc_entry); if (ost->ost_service == NULL) { CERROR("failed to start service\n"); - RETURN(-ENOMEM); + GOTO(out_lprocfs, rc = -ENOMEM); } rc = ptlrpc_start_n_threads(obd, ost->ost_service, OST_NUM_THREADS, "ll_ost"); if (rc) - GOTO(out, rc = -EINVAL); + GOTO(out_service, rc = -EINVAL); ost->ost_create_service = ptlrpc_init_svc(OST_NBUFS, OST_BUFSIZE, OST_MAXREQSIZE, @@ -1155,7 +1158,7 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf) obd->obd_proc_entry); if (ost->ost_create_service == NULL) { CERROR("failed to start OST create service\n"); - GOTO(out, rc = -ENOMEM); + GOTO(out_service, rc = -ENOMEM); } rc = ptlrpc_start_n_threads(obd, ost->ost_create_service, 1, @@ -1163,15 +1166,14 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf) if (rc) GOTO(out_create, rc = -EINVAL); - lprocfs_init_vars(ost, &lvars); - lprocfs_obd_setup(obd, lvars.obd_vars); - RETURN(0); out_create: ptlrpc_unregister_service(ost->ost_create_service); -out: +out_service: ptlrpc_unregister_service(ost->ost_service); +out_lprocfs: + lprocfs_obd_cleanup(obd); RETURN(rc); } @@ -1181,8 +1183,6 @@ static int ost_cleanup(struct obd_device *obd, int flags) int err = 0; ENTRY; - lprocfs_obd_cleanup(obd); - spin_lock_bh(&obd->obd_processing_task_lock); if (obd->obd_recovering) { target_cancel_recovery_timer(obd); @@ -1196,6 +1196,8 @@ static int ost_cleanup(struct obd_device *obd, int flags) ptlrpc_stop_all_threads(ost->ost_create_service); ptlrpc_unregister_service(ost->ost_create_service); + lprocfs_obd_cleanup(obd); + RETURN(err); } diff --git a/lustre/ptlbd/server.c b/lustre/ptlbd/server.c index 7c94db7..daa0b3c 100644 --- a/lustre/ptlbd/server.c +++ b/lustre/ptlbd/server.c @@ -49,6 +49,9 @@ static int ptlbd_sv_setup(struct obd_device *obd, obd_count len, void *buf) if ( IS_ERR(ptlbd->filp) ) RETURN(PTR_ERR(ptlbd->filp)); + lprocfs_init_vars(ptlbd_sv, &lvars); + lprocfs_obd_setup(obd, lvars.obd_vars); + ptlbd->ptlbd_service = ptlrpc_init_svc(PTLBD_NBUFS, PTLBD_BUFSIZE, PTLBD_MAXREQSIZE, PTLBD_REQUEST_PORTAL, PTLBD_REPLY_PORTAL, @@ -64,15 +67,13 @@ static int ptlbd_sv_setup(struct obd_device *obd, obd_count len, void *buf) ptlbd_sv_already_setup = 1; - lprocfs_init_vars(ptlbd_sv, &lvars); - lprocfs_obd_setup(obd, lvars.obd_vars); - RETURN(0); out_thread: ptlrpc_unregister_service(ptlbd->ptlbd_service); out_filp: filp_close(ptlbd->filp, NULL); + lprocfs_obd_cleanup(obd); RETURN(rc); } @@ -84,14 +85,15 @@ static int ptlbd_sv_cleanup(struct obd_device *obd, int flags) /* XXX check for state */ - lprocfs_obd_cleanup(obd); - ptlrpc_stop_all_threads(ptlbd->ptlbd_service); ptlrpc_unregister_service(ptlbd->ptlbd_service); if ( ! IS_ERR(ptlbd->filp) ) filp_close(ptlbd->filp, NULL); ptlbd_sv_already_setup = 0; + + lprocfs_obd_cleanup(obd); + RETURN(0); } diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 2307d20..939e9dd 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -838,6 +838,8 @@ int ptlrpc_unregister_service(struct ptlrpc_service *service) list_del_init (&service->srv_list); spin_unlock (&ptlrpc_all_services_lock); + ptlrpc_lprocfs_unregister_service(service); + for (i = 0; i < ptlrpc_ninterfaces; i++) { srv_ni = &service->srv_interfaces[i]; CDEBUG(D_NET, "%s: tearing down interface %s\n", @@ -939,8 +941,6 @@ int ptlrpc_unregister_service(struct ptlrpc_service *service) CWARN("Unexpectedly long timeout %p\n", service); } - ptlrpc_lprocfs_unregister_service(service); - OBD_FREE(service, offsetof(struct ptlrpc_service, srv_interfaces[ptlrpc_ninterfaces]));