X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fmdt%2Fmdt_mds.c;h=6201431cf1b00ae87d56d60e8f53b842395d687d;hb=9ff3b408aee72b97ebff9dc04becb14f1e6887b2;hp=424ddf5f3d79deeae5d9a15d58fce6be02aa165d;hpb=90636ff53d8d2d714a7591c4bb9a75a7c69f997f;p=fs%2Flustre-release.git diff --git a/lustre/mdt/mdt_mds.c b/lustre/mdt/mdt_mds.c index 424ddf5..6201431 100644 --- a/lustre/mdt/mdt_mds.c +++ b/lustre/mdt/mdt_mds.c @@ -23,7 +23,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2013, Intel Corporation. + * Copyright (c) 2013, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -56,53 +56,55 @@ struct mds_device { /* super-class */ - struct md_device mds_md_dev; - struct ptlrpc_service *mds_regular_service; - struct ptlrpc_service *mds_readpage_service; - struct ptlrpc_service *mds_out_service; - struct ptlrpc_service *mds_setattr_service; - struct ptlrpc_service *mds_mdsc_service; - struct ptlrpc_service *mds_mdss_service; - struct ptlrpc_service *mds_fld_service; + struct md_device mds_md_dev; + struct ptlrpc_service *mds_regular_service; + struct ptlrpc_service *mds_readpage_service; + struct ptlrpc_service *mds_out_service; + struct ptlrpc_service *mds_setattr_service; + struct ptlrpc_service *mds_mdsc_service; + struct ptlrpc_service *mds_mdss_service; + struct ptlrpc_service *mds_fld_service; + struct mutex mds_health_mutex; }; /* * * Initialized in mdt_mod_init(). * */ static unsigned long mdt_num_threads; -CFS_MODULE_PARM(mdt_num_threads, "ul", ulong, 0444, - "number of MDS service threads to start " - "(deprecated in favor of mds_num_threads)"); +module_param(mdt_num_threads, ulong, 0444); +MODULE_PARM_DESC(mdt_num_threads, "number of MDS service threads to start (deprecated in favor of mds_num_threads)"); static unsigned long mds_num_threads; -CFS_MODULE_PARM(mds_num_threads, "ul", ulong, 0444, - "number of MDS service threads to start"); +module_param(mds_num_threads, ulong, 0444); +MODULE_PARM_DESC(mds_num_threads, "number of MDS service threads to start"); static char *mds_num_cpts; -CFS_MODULE_PARM(mds_num_cpts, "c", charp, 0444, - "CPU partitions MDS threads should run on"); +module_param(mds_num_cpts, charp, 0444); +MODULE_PARM_DESC(mds_num_cpts, "CPU partitions MDS threads should run on"); static unsigned long mds_rdpg_num_threads; -CFS_MODULE_PARM(mds_rdpg_num_threads, "ul", ulong, 0444, - "number of MDS readpage service threads to start"); +module_param(mds_rdpg_num_threads, ulong, 0444); +MODULE_PARM_DESC(mds_rdpg_num_threads, "number of MDS readpage service threads to start"); static char *mds_rdpg_num_cpts; -CFS_MODULE_PARM(mds_rdpg_num_cpts, "c", charp, 0444, - "CPU partitions MDS readpage threads should run on"); +module_param(mds_rdpg_num_cpts, charp, 0444); +MODULE_PARM_DESC(mds_rdpg_num_cpts, "CPU partitions MDS readpage threads should run on"); /* NB: these two should be removed along with setattr service in the future */ static unsigned long mds_attr_num_threads; -CFS_MODULE_PARM(mds_attr_num_threads, "ul", ulong, 0444, - "number of MDS setattr service threads to start"); +module_param(mds_attr_num_threads, ulong, 0444); +MODULE_PARM_DESC(mds_attr_num_threads, "number of MDS setattr service threads to start"); static char *mds_attr_num_cpts; -CFS_MODULE_PARM(mds_attr_num_cpts, "c", charp, 0444, - "CPU partitions MDS setattr threads should run on"); +module_param(mds_attr_num_cpts, charp, 0444); +MODULE_PARM_DESC(mds_attr_num_cpts, "CPU partitions MDS setattr threads should run on"); /* device init/fini methods */ static void mds_stop_ptlrpc_service(struct mds_device *m) { ENTRY; + + mutex_lock(&m->mds_health_mutex); if (m->mds_regular_service != NULL) { ptlrpc_unregister_service(m->mds_regular_service); m->mds_regular_service = NULL; @@ -131,6 +133,8 @@ static void mds_stop_ptlrpc_service(struct mds_device *m) ptlrpc_unregister_service(m->mds_fld_service); m->mds_fld_service = NULL; } + mutex_unlock(&m->mds_health_mutex); + EXIT; } @@ -138,7 +142,7 @@ static int mds_start_ptlrpc_service(struct mds_device *m) { static struct ptlrpc_service_conf conf; struct obd_device *obd = m->mds_md_dev.md_lu_dev.ld_obd; - cfs_proc_dir_entry_t *procfs_entry; + struct proc_dir_entry *procfs_entry; int rc = 0; ENTRY; @@ -466,9 +470,14 @@ static struct lu_device *mds_device_free(const struct lu_env *env, LPROC_SEQ_FOPS_RO_TYPE(mds, uuid); -static struct lprocfs_seq_vars lprocfs_mds_obd_vars[] = { - { "uuid", &mds_uuid_fops }, - { 0 } +static struct lprocfs_vars lprocfs_mds_obd_vars[] = { + { + .name = "uuid", + .fops = &mds_uuid_fops + }, + { + .name = NULL + } }; static struct lu_device *mds_device_alloc(const struct lu_env *env, @@ -495,13 +504,15 @@ static struct lu_device *mds_device_alloc(const struct lu_env *env, obd->obd_lu_dev = l; obd->obd_vars = lprocfs_mds_obd_vars; - rc = lprocfs_seq_obd_setup(obd); + rc = lprocfs_obd_setup(obd); if (rc != 0) { mds_device_free(env, l); l = ERR_PTR(rc); return l; } + mutex_init(&m->mds_health_mutex); + rc = mds_start_ptlrpc_service(m); if (rc != 0) { @@ -534,8 +545,28 @@ static struct lu_device_type mds_device_type = { .ldt_ctx_tags = LCT_MD_THREAD }; +static int mds_health_check(const struct lu_env *env, struct obd_device *obd) +{ + struct mds_device *mds = mds_dev(obd->obd_lu_dev); + int rc = 0; + + + mutex_lock(&mds->mds_health_mutex); + rc |= ptlrpc_service_health_check(mds->mds_regular_service); + rc |= ptlrpc_service_health_check(mds->mds_readpage_service); + rc |= ptlrpc_service_health_check(mds->mds_out_service); + rc |= ptlrpc_service_health_check(mds->mds_setattr_service); + rc |= ptlrpc_service_health_check(mds->mds_mdsc_service); + rc |= ptlrpc_service_health_check(mds->mds_mdss_service); + rc |= ptlrpc_service_health_check(mds->mds_fld_service); + mutex_unlock(&mds->mds_health_mutex); + + return rc != 0 ? 1 : 0; +} + static struct obd_ops mds_obd_device_ops = { .o_owner = THIS_MODULE, + .o_health_check = mds_health_check, }; int mds_mod_init(void) @@ -548,9 +579,6 @@ int mds_mod_init(void) } return class_register_type(&mds_obd_device_ops, NULL, true, NULL, -#ifndef HAVE_ONLY_PROCFS_SEQ - NULL, -#endif LUSTRE_MDS_NAME, &mds_device_type); }