From ccd999e50713bf8311a1b0c9608661971bf4c1a1 Mon Sep 17 00:00:00 2001 From: lincent Date: Mon, 15 Aug 2005 18:24:26 +0000 Subject: [PATCH] mgs operations --- lustre/Makefile.in | 3 +- lustre/autoMakefile.am | 5 +- lustre/include/linux/lustre_net.h | 7 + lustre/include/linux/obd.h | 2 +- lustre/include/linux/obd_support.h | 8 + lustre/mds/mds_log.c | 2 +- lustre/mgc/mgc_request.c | 35 +- lustre/mgs/Makefile.in | 2 +- lustre/mgs/mgs_fs.c | 7 +- lustre/mgs/mgs_hander.c | 633 ------------------------------------- lustre/mgs/mgs_internal.h | 16 +- lustre/obdclass/obd_mount.c | 1 - lustre/utils/lwizard | 2 +- 13 files changed, 55 insertions(+), 668 deletions(-) delete mode 100644 lustre/mgs/mgs_hander.c diff --git a/lustre/Makefile.in b/lustre/Makefile.in index 672d36e..78f976c 100644 --- a/lustre/Makefile.in +++ b/lustre/Makefile.in @@ -8,8 +8,7 @@ subdir-m += osc subdir-m += obdecho subdir-m += mgc -@SERVER_TRUE@subdir-m += mds obdfilter ost -#add to above line when directory exists: mgs +@SERVER_TRUE@subdir-m += mds obdfilter ost mgs @CLIENT_TRUE@subdir-m += mdc llite @INCLUDE_RULES@ diff --git a/lustre/autoMakefile.am b/lustre/autoMakefile.am index a9c0c86..91ca0e1 100644 --- a/lustre/autoMakefile.am +++ b/lustre/autoMakefile.am @@ -6,10 +6,9 @@ AUTOMAKE_OPTIONS = foreign ALWAYS_SUBDIRS := include lvfs obdclass ldlm ptlrpc osc lov obdecho \ - mgc doc utils tests conf scripts autoconf + mgc mgs doc utils tests conf scripts autoconf -SERVER_SUBDIRS := ldiskfs obdfilter ost mds -# mgs +SERVER_SUBDIRS := ldiskfs obdfilter ost mds mgs CLIENT_SUBDIRS := mdc llite diff --git a/lustre/include/linux/lustre_net.h b/lustre/include/linux/lustre_net.h index 5003d73..1191f1a 100644 --- a/lustre/include/linux/lustre_net.h +++ b/lustre/include/linux/lustre_net.h @@ -113,6 +113,13 @@ #define LDLM_BUFSIZE (8 * 1024) #define LDLM_MAXREQSIZE (5 * 1024) +#define MGT_MAX_THREADS 8UL +#define MGT_NUM_THREADS max(min_t(unsigned long, num_physpages / 8192, \ + MGT_MAX_THREADS), 2UL) +#define MGS_NBUFS (64 * smp_num_cpus) +#define MGS_BUFSIZE (8 * 1024) +#define MGS_MAXREQSIZE (5 * 1024) + #define MDT_MAX_THREADS 32UL #define MDT_NUM_THREADS max(min_t(unsigned long, num_physpages / 8192, \ MDT_MAX_THREADS), 2UL) diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index 8e29291..820633b 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -319,7 +319,7 @@ struct mgs_obd { struct vfsmount *mgs_vfsmnt; struct super_block *mgs_sb; struct dentry *mgs_configs_dir; - struct list_head mgs_open_logs; + struct list_head mgs_open_llogs; struct llog_handle *mgs_cfg_llh; }; diff --git a/lustre/include/linux/obd_support.h b/lustre/include/linux/obd_support.h index 757dba2..e65cdd7 100644 --- a/lustre/include/linux/obd_support.h +++ b/lustre/include/linux/obd_support.h @@ -162,6 +162,13 @@ extern wait_queue_head_t obd_race_waitq; #define OBD_FAIL_MDC_REVALIDATE_PAUSE 0x800 + +#define OBD_FAIL_MGS 0x900 +#define OBD_FAIL_MGS_CONNECT_NET 0x117 +#define OBD_FAIL_MGS_DISCONNECT_NET 0x11a +#define OBD_FAIL_MGS_ALL_REPLY_NET 0x122 +#define OBD_FAIL_MGS_ALL_REQUEST_NET 0x123 + /* preparation for a more advanced failure testbed (not functional yet) */ #define OBD_FAIL_MASK_SYS 0x0000FF00 #define OBD_FAIL_MASK_LOC (0x000000FF | OBD_FAIL_MASK_SYS) @@ -169,6 +176,7 @@ extern wait_queue_head_t obd_race_waitq; #define OBD_FAILED 0x40000000 #define OBD_FAIL_MDS_ALL_NET 0x01000000 #define OBD_FAIL_OST_ALL_NET 0x02000000 +#define OBD_FAIL_MGS_ALL_NET 0x01000000 #define OBD_FAIL_CHECK(id) (((obd_fail_loc & OBD_FAIL_MASK_LOC) == \ ((id) & OBD_FAIL_MASK_LOC)) && \ diff --git a/lustre/mds/mds_log.c b/lustre/mds/mds_log.c index b73b7d2..cb1a91c 100644 --- a/lustre/mds/mds_log.c +++ b/lustre/mds/mds_log.c @@ -104,7 +104,7 @@ static int mds_llog_repl_cancel(struct llog_ctxt *ctxt, struct lov_stripe_md *ls ENTRY; lctxt = llog_get_context(lov_obd, ctxt->loc_idx); - rc = llog_cancel(lctxt, lsm, count, cookies,flags); + rc = llog_cancel(lctxt, lsm, count, cookies, flags); RETURN(rc); } diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index fdc5845..77d95a1 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -167,15 +167,7 @@ static int mgc_setup(struct obd_device *obd, obd_count len, void *buf) ptlrpcd_addref(); - //mgc_obd_setup(obd, len, buf); - //lprocfs_init_vars(mgc, &lvars); - //lprocfs_obd_setup(obd, lvars.obd_vars); - - rc = llog_setup(obd, LLOG_CONFIG_ORIG_CTXT, obd, 0, NULL, - &llog_lvfs_ops); - //need ORIG and REPL rc = llog_setup(obd, LLOG_CONFIG_REPL_CTXT, tgt, 0, NULL, - // &llog_client_ops); - //rc = obd_llog_init(obd, obd, 0, NULL); + rc = obd_llog_init(obd, obd, 0, NULL); if (rc) { CERROR("failed to setup llogging subsystems\n"); GOTO(err_rpc_lock, rc); @@ -194,6 +186,9 @@ static int mgc_setup(struct obd_device *obd, obd_count len, void *buf) } } else { CERROR("mgc does not have local disk (client only)\n"); + rc = mgc_obd_setup(obd, len, buf); + if (rc) + GOTO(err_rpc_lock, rc); } RETURN(rc); @@ -269,6 +264,7 @@ static int mgc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, rc = class_config_parse_llog(ctxt, conf_prof, NULL); if (rc < 0) CERROR("Unable to process log: %s\n", conf_prof); + pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); OBD_FREE(conf_prof, len); @@ -324,9 +320,14 @@ static int mgc_llog_init(struct obd_device *obd, struct obd_device *tgt, int rc; ENTRY; + rc = llog_setup(obd, LLOG_CONFIG_ORIG_CTXT, tgt, 0, NULL, + &llog_lvfs_ops); + if (rc) + RETURN(rc); + rc = llog_setup(obd, LLOG_CONFIG_REPL_CTXT, tgt, 0, NULL, &llog_client_ops); - if (rc == 0) { + if (!rc) { ctxt = llog_get_context(obd, LLOG_CONFIG_REPL_CTXT); ctxt->loc_imp = obd->u.mgc.mgc_import; } @@ -355,15 +356,11 @@ int mgc_obd_setup(struct obd_device *obddev, obd_count len, void *buf) int rc; ENTRY; - if (strcmp(name, LUSTRE_MGC_NAME) == 0) { - rq_portal = MGS_REQUEST_PORTAL; - rp_portal = MGC_REPLY_PORTAL; - connect_op = MGS_CONNECT; - } else { - CERROR("wrong client OBD type \"%s\", can't setup\n", - name); - RETURN(-EINVAL); - } + LASSERT(!strcmp(name, LUSTRE_MGC_NAME)); + + rq_portal = MGS_REQUEST_PORTAL; + rp_portal = MGC_REPLY_PORTAL; + connect_op = MGS_CONNECT; if (LUSTRE_CFG_BUFLEN(lcfg, 1) < 1) { CERROR("requires a TARGET UUID\n"); diff --git a/lustre/mgs/Makefile.in b/lustre/mgs/Makefile.in index 6d78f9e..5424c07 100644 --- a/lustre/mgs/Makefile.in +++ b/lustre/mgs/Makefile.in @@ -1,4 +1,4 @@ MODULES := mgs -mgs-objs := mgs_handle.o mgs_fs.o +mgs-objs := mgs_handler.o mgs_fs.o @INCLUDE_RULES@ diff --git a/lustre/mgs/mgs_fs.c b/lustre/mgs/mgs_fs.c index b401ef4..ad60989 100644 --- a/lustre/mgs/mgs_fs.c +++ b/lustre/mgs/mgs_fs.c @@ -39,10 +39,11 @@ #include #include #include +#include #include #include +#include #include - #include "mgs_internal.h" int mgs_fs_setup(struct obd_device *obd, struct vfsmount *mnt) @@ -72,7 +73,7 @@ int mgs_fs_setup(struct obd_device *obd, struct vfsmount *mnt) push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); dentry = simple_mkdir(current->fs->pwd, MOUNT_CONFIGS_DIR, 0777, 1); - if (IS_ERR(dentry)) + if (IS_ERR(dentry)) { rc = PTR_ERR(dentry); CERROR("cannot create %s directory: rc = %d\n", MOUNT_CONFIGS_DIR, rc); @@ -81,7 +82,7 @@ int mgs_fs_setup(struct obd_device *obd, struct vfsmount *mnt) mgs->mgs_configs_dir = dentry; - INIT_LIST_HEAD(&mgs->mgs_opens_logs); + INIT_LIST_HEAD(&mgs->mgs_open_llogs); err_pop: pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); diff --git a/lustre/mgs/mgs_hander.c b/lustre/mgs/mgs_hander.c deleted file mode 100644 index 0a6b6dd..0000000 --- a/lustre/mgs/mgs_hander.c +++ /dev/null @@ -1,633 +0,0 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * - * lustre/mgs/mgs_handler.c - * Lustre Management Server (mgs) request handler - * - * Copyright (C) 2001-2005 Cluster File Systems, Inc. - * Author Nathan - * Author LinSongTao - * - * This file is part of Lustre, http://www.lustre.org. - * - * Lustre is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * Lustre is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Lustre; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef EXPORT_SYMTAB -# define EXPORT_SYMTAB -#endif -#define DEBUG_SUBSYSTEM S_MGS - -#ifdef __KERNEL__ -# include -# include -# include -# include -#else -# include -#endif - -#include -#include -#include -#include "mgs_internal.h" - -/* Establish a connection to the MGS.*/ -static int mgs_connect(struct lustre_handle *conn, struct obd_device *obd, - struct obd_uuid *cluuid, struct obd_connect_data *data) -{ - struct obd_export *exp; - struct mgs_export_data *med; - struct mgs_client_data *mcd; - int rc, abort_recovery; - ENTRY; - - if (!conn || !obd || !cluuid) - RETURN(-EINVAL); - - /* Check for aborted recovery. */ - spin_lock_bh(&obd->obd_processing_task_lock); - abort_recovery = obd->obd_abort_recovery; - spin_unlock_bh(&obd->obd_processing_task_lock); - if (abort_recovery) - target_abort_recovery(obd); - - rc = class_connect(conn, obd, cluuid); - if (rc) - RETURN(rc); - exp = class_conn2export(conn); - LASSERT(exp); - med = &exp->exp_mgs_data; - - if (data != NULL) { - data->ocd_connect_flags &= MGS_CONNECT_SUPPORTED; - exp->exp_connect_flags = data->ocd_connect_flags; - } - - OBD_ALLOC(mcd, sizeof(*mcd)); - if (!mcd) { - CERROR("mgs: out of memory for client data\n"); - GOTO(out, rc = -ENOMEM); - } - - memcpy(mcd->mcd_uuid, cluuid, sizeof(mcd->mcd_uuid)); - med->med_mcd = mcd; - -out: - if (rc) { - if (mcd) { - OBD_FREE(mcd, sizeof(*mcd)); - med->med_mcd = NULL; - } - class_disconnect(exp); - } else { - class_export_put(exp); - } - - RETURN(rc); -} - -static int mgs_init_export(struct obd_export *exp) -{ - struct mgs_export_data *med = &exp->exp_mgs_data; - - INIT_LIST_HEAD(&med->med_open_head); - spin_lock_init(&med->med_open_lock); - RETURN(0); -} - -static int mgs_disconnect(struct obd_export *exp) -{ - unsigned long irqflags; - int rc; - ENTRY; - - LASSERT(exp); - class_export_get(exp); - - /* Disconnect early so that clients can't keep using export */ - rc = class_disconnect(exp); - - /* complete all outstanding replies */ - spin_lock_irqsave(&exp->exp_lock, irqflags); - while (!list_empty(&exp->exp_outstanding_replies)) { - struct ptlrpc_reply_state *rs = - list_entry(exp->exp_outstanding_replies.next, - struct ptlrpc_reply_state, rs_exp_list); - struct ptlrpc_service *svc = rs->rs_service; - - spin_lock(&svc->srv_lock); - list_del_init(&rs->rs_exp_list); - ptlrpc_schedule_difficult_reply(rs); - spin_unlock(&svc->srv_lock); - } - spin_unlock_irqrestore(&exp->exp_lock, irqflags); - - class_export_put(exp); - RETURN(rc); -} - -/* mount the file system (secretly) */ -static int mgs_setup(struct obd_device *obd, obd_count len, void *buf) -{ - struct lprocfs_static_vars lvars; - struct lustre_cfg* lcfg = buf; - char *options = NULL; - struct mgs_obd *mgs = &obd->u.mgs; - struct vfsmount *mnt; - unsigned long page; - int rc = 0; - ENTRY; - - /* setup 1:/dev/loop/0 2:ext3 3:mgs 4:errors=remount-ro,iopen_nopriv*/ - - if (lcfg->lcfg_bufcount < 3) - RETURN(rc = -EINVAL) - - if (LUSTRE_CFG_BUFLEN(lcfg, 1) == 0 || LUSTRE_CFG_BUFLEN(lcfg, 2) == 0) - RETURN(rc = -EINVAL); - - obd->obd_fsops = fsfilt_get_ops(lustre_cfg_string(lcfg, 2)); - if (IS_ERR(obd->obd_fsops)) - RETURN(rc = PTR_ERR(obd->obd_fsops)); - - page = __get_free_page(GFP_KERNEL); - if (!page) - RETURN(-ENOMEM); - - options = (char *)page; - memset(options, 0, PAGE_SIZE); - - if (LUSTRE_CFG_BUFLEN(lcfg, 4) > 0 && lustre_cfg_buf(lcfg, 4)) - sprintf(options , ",%s", lustre_cfg_string(lcfg, 4)); - - //FIXME mount was already done in lustre_fill_super, - //we just need to access it - mnt = do_kern_mount(lustre_cfg_string(lcfg, 2), 0, - lustre_cfg_string(lcfg, 1), (void *)options); - free_page(page); - if (IS_ERR(mnt)) { - rc = PTR_ERR(mnt); - CERROR("do_kern_mount failed: rc = %d\n", rc); - GOTO(err_ops, rc); - } - - CDEBUG(D_SUPER, "%s: mnt = %p\n", lustre_cfg_string(lcfg, 1), mnt); - - LASSERT(!lvfs_check_rdonly(lvfs_sbdev(mnt->mnt_sb))); - - rc = mgs_fs_setup(obd, mnt); - if (rc) { - CERROR("%s: MGS filesystem method init failed: rc = %d\n", - obd->obd_name, rc); - GOTO(err_ns, rc); - } - - rc = llog_start_commit_thread(); - if (rc < 0) - GOTO(err_fs, rc); -#if 0 - //FIXME: no LDLM support for llog now - ptlrpc_init_client(LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL, - "mgs_ldlm_client", &obd->obd_ldlm_client); -#endif - obd->obd_replayable = 1; - - rc = mgs_postsetup(obd); - if (rc) - GOTO(err_fs, rc); - - lprocfs_init_vars(mgs, &lvars); - lprocfs_obd_setup(obd, lvars.obd_vars); - - if (obd->obd_recovering) { - LCONSOLE_WARN("MGT %s now serving %s, but will be in recovery " - "until %d %s reconnect, or if no clients " - "reconnect for %d:%.02d; during that time new " - "clients will not be allowed to connect. " - "Recovery progress can be monitored by watching " - "/proc/fs/lustre/mgs/%s/recovery_status.\n", - obd->obd_name, - lustre_cfg_string(lcfg, 1), - obd->obd_recoverable_clients, - (obd->obd_recoverable_clients == 1) - ? "client" : "clients", - (int)(OBD_RECOVERY_TIMEOUT / HZ) / 60, - (int)(OBD_RECOVERY_TIMEOUT / HZ) % 60, - obd->obd_name); - } else { - LCONSOLE_INFO("MGT %s now serving %s with recovery %s.\n", - obd->obd_name, - lustre_cfg_string(lcfg, 1), - obd->obd_replayable ? "enabled" : "disabled"); - } -//FIXME: no ldlm support now - ldlm_timeout = 6; - ping_evictor_start(); - - RETURN(0); - -err_fs: - /* No extra cleanup needed for llog_init_commit_thread() */ - mgs_fs_cleanup(obd); -err_put: - unlock_kernel(); - mntput(mgs->mgs_vfsmnt); - mgs->mgs_sb = 0; - lock_kernel(); -err_ops: - fsfilt_put_ops(obd->obd_fsops); - return rc; -} - - -static int mgs_postsetup(struct obd_device *obd) -{ - struct mgs_obd *mgs = &obd->u.mgs; - int rc = 0; - ENTRY; - - rc = llog_setup(obd, LLOG_CONFIG_ORIG_CTXT, obd, 0, NULL, - &llog_lvfs_ops); - RETURN(rc); -} - -static int mgs_precleanup(struct obd_device *obd, int stage) -{ - int rc = 0; - ENTRY; - - llog_cleanup(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT)); - rc = obd_llog_finish(obd, 0); - RETURN(rc); -} - -static int mgs_cleanup(struct obd_device *obd) -{ - struct mgs_obd *mgs = &obd->u.mgs; - lvfs_sbdev_type save_dev; - int must_relock = 0; - ENTRY; - - ping_evictor_stop(); - - if (mgs->mgs_sb == NULL) - RETURN(0); - save_dev = lvfs_sbdev(mgs->mgs_sb); - - lprocfs_obd_cleanup(obd); - - mgs_update_server_data(obd, 1); - - mgs_fs_cleanup(obd); - - if (atomic_read(&obd->u.mgs.mgs_vfsmnt->mnt_count) > 2) - CERROR("%s: mount busy, mnt_count %d != 2\n", obd->obd_name, - atomic_read(&obd->u.mgs.mgs_vfsmnt->mnt_count)); - - /* We can only unlock kernel if we are in the context of sys_ioctl, - otherwise we never called lock_kernel */ - if (kernel_locked()) { - unlock_kernel(); - must_relock++; - } - - mntput(mgs->mgs_vfsmnt); - mgs->mgs_sb = NULL; - - spin_lock_bh(&obd->obd_processing_task_lock); - if (obd->obd_recovering) { - target_cancel_recovery_timer(obd); - obd->obd_recovering = 0; - } - spin_unlock_bh(&obd->obd_processing_task_lock); - - lvfs_clear_rdonly(save_dev); - - if (must_relock) - lock_kernel(); - - fsfilt_put_ops(obd->obd_fsops); - - LCONSOLE_INFO("MDT %s has stopped.\n", obd->obd_name); - - RETURN(0); -} - -/* Look up an entry by inode number. */ -/* this function ONLY returns valid dget'd dentries with an initialized inode - or errors */ -struct dentry *mgs_fid2dentry(struct mgs_obd *mgs, struct ll_fid *fid, - struct vfsmount **mnt) -{ - char fid_name[32]; - unsigned long ino = fid->id; - __u32 generation = fid->generation; - struct inode *inode; - struct dentry *result; - - if (ino == 0) - RETURN(ERR_PTR(-ESTALE)); - - snprintf(fid_name, sizeof(fid_name), "0x%lx", ino); - - CDEBUG(D_DENTRY, "--> mgs_fid2dentry: ino/gen %lu/%u, sb %p\n", - ino, generation, mgs->mgs_sb); - - /* under ext3 this is neither supposed to return bad inodes - nor NULL inodes. */ - result = ll_lookup_one_len(fid_name, mgs->mgs_fid_de, strlen(fid_name)); - if (IS_ERR(result)) - RETURN(result); - - inode = result->d_inode; - if (!inode) - RETURN(ERR_PTR(-ENOENT)); - - if (generation && inode->i_generation != generation) { - /* we didn't find the right inode.. */ - CERROR("bad inode %lu, link: %lu ct: %d or generation %u/%u\n", - inode->i_ino, (unsigned long)inode->i_nlink, - atomic_read(&inode->i_count), inode->i_generation, - generation); - dput(result); - RETURN(ERR_PTR(-ENOENT)); - } - - if (mnt) { - *mnt = mgs->mgs_vfsmnt; - mntget(*mnt); - } - - RETURN(result); -} - -static struct dentry *mgs_lvfs_fid2dentry(__u64 id, __u32 gen, __u64 gr, - void *data) -{ - struct obd_device *obd = data; - struct ll_fid fid; - fid.id = id; - fid.generation = gen; - return mgs_fid2dentry(&obd->u.mgs, &fid, NULL); -} - -struct lvfs_callback_ops mgs_lvfs_ops = { - l_fid2dentry: mgs_lvfs_fid2dentry, -}; - - -int mgs_iocontrol(unsigned int cmd, struct obd_export *exp, int len, - void *karg, void *uarg) -{ - static struct obd_uuid cfg_uuid = { .uuid = "config_uuid" }; - struct obd_device *obd = exp->exp_obd; - struct mgs_obd *mgs = &obd->u.mgs; - struct obd_ioctl_data *data = karg; - struct lvfs_run_ctxt saved; - int rc = 0; - - ENTRY; - CDEBUG(D_IOCTL, "handling ioctl cmd %#x\n", cmd); - - switch (cmd) { - case OBD_IOC_RECORD: { - char *name = data->ioc_inlbuf1; - if (mgs->mgs_cfg_llh) - RETURN(-EBUSY); - - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = llog_create(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT), - &mds->mds_cfg_llh, NULL, name); - if (rc == 0) - llog_init_handle(mds->mds_cfg_llh, LLOG_F_IS_PLAIN, - &cfg_uuid); - else - mds->mds_cfg_llh = NULL; - pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - - RETURN(rc); - } - - case OBD_IOC_ENDRECORD: { - if (!mds->mds_cfg_llh) - RETURN(-EBADF); - - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = llog_close(mds->mds_cfg_llh); - pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - - mds->mds_cfg_llh = NULL; - RETURN(rc); - } - - case OBD_IOC_CLEAR_LOG: { - char *name = data->ioc_inlbuf1; - if (mds->mds_cfg_llh) - RETURN(-EBUSY); - - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = llog_create(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT), - &mds->mds_cfg_llh, NULL, name); - if (rc == 0) { - llog_init_handle(mds->mds_cfg_llh, LLOG_F_IS_PLAIN, - NULL); - - rc = llog_destroy(mds->mds_cfg_llh); - llog_free_handle(mds->mds_cfg_llh); - } - pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - - mds->mds_cfg_llh = NULL; - RETURN(rc); - } - - case OBD_IOC_DORECORD: { - char *cfg_buf; - struct llog_rec_hdr rec; - if (!mds->mds_cfg_llh) - RETURN(-EBADF); - - rec.lrh_len = llog_data_len(data->ioc_plen1); - - if (data->ioc_type == LUSTRE_CFG_TYPE) { - rec.lrh_type = OBD_CFG_REC; - } else { - CERROR("unknown cfg record type:%d \n", data->ioc_type); - RETURN(-EINVAL); - } - - OBD_ALLOC(cfg_buf, data->ioc_plen1); - if (cfg_buf == NULL) - RETURN(-EINVAL); - rc = copy_from_user(cfg_buf, data->ioc_pbuf1, data->ioc_plen1); - if (rc) { - OBD_FREE(cfg_buf, data->ioc_plen1); - RETURN(rc); - } - - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = llog_write_rec(mds->mds_cfg_llh, &rec, NULL, 0, - cfg_buf, -1); - pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - - OBD_FREE(cfg_buf, data->ioc_plen1); - RETURN(rc); - } - - case OBD_IOC_PARSE: { - struct llog_ctxt *ctxt = - llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT); - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = class_config_parse_llog(ctxt, data->ioc_inlbuf1, NULL); - pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - if (rc) - RETURN(rc); - - RETURN(rc); - } - - case OBD_IOC_DUMP_LOG: { - struct llog_ctxt *ctxt = - llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT); - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = class_config_dump_llog(ctxt, data->ioc_inlbuf1, NULL); - pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - if (rc) - RETURN(rc); - - RETURN(rc); - } - - case OBD_IOC_SYNC: { - CDEBUG(D_HA, "syncing mds %s\n", obd->obd_name); - rc = fsfilt_sync(obd, obd->u.mds.mds_sb); - RETURN(rc); - } - - case OBD_IOC_SET_READONLY: { - void *handle; - struct inode *inode = obd->u.mds.mds_sb->s_root->d_inode; - BDEVNAME_DECLARE_STORAGE(tmp); - CERROR("*** setting device %s read-only ***\n", - ll_bdevname(obd->u.mds.mds_sb, tmp)); - - handle = fsfilt_start(obd, inode, FSFILT_OP_MKNOD, NULL); - if (!IS_ERR(handle)) - rc = fsfilt_commit(obd, inode, handle, 1); - - CDEBUG(D_HA, "syncing mds %s\n", obd->obd_name); - rc = fsfilt_sync(obd, obd->u.mds.mds_sb); - - lvfs_set_rdonly(lvfs_sbdev(obd->u.mds.mds_sb)); - RETURN(0); - } - - case OBD_IOC_CATLOGLIST: { - int count = mds->mds_lov_desc.ld_tgt_count; - rc = llog_catalog_list(obd, count, data); - RETURN(rc); - - } - case OBD_IOC_LLOG_CHECK: - case OBD_IOC_LLOG_CANCEL: - case OBD_IOC_LLOG_REMOVE: { - struct llog_ctxt *ctxt = - llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT); - int rc2; - - obd_llog_finish(obd, mds->mds_lov_desc.ld_tgt_count); - push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL); - rc = llog_ioctl(ctxt, cmd, data); - pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL); - llog_cat_initialize(obd, mds->mds_lov_desc.ld_tgt_count); - rc2 = obd_set_info(mds->mds_osc_exp, strlen("mds_conn"), - "mds_conn", 0, NULL); - if (!rc) - rc = rc2; - RETURN(rc); - } - case OBD_IOC_LLOG_INFO: - case OBD_IOC_LLOG_PRINT: { - struct llog_ctxt *ctxt = - llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT); - - push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL); - rc = llog_ioctl(ctxt, cmd, data); - pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL); - - RETURN(rc); - } - - case OBD_IOC_ABORT_RECOVERY: - CERROR("aborting recovery for device %s\n", obd->obd_name); - target_abort_recovery(obd); - RETURN(0); - - default: - CDEBUG(D_INFO, "unknown command %x\n", cmd); - RETURN(-EINVAL); - } - RETURN(0); - -} -/* use obd ops to offer management infrastructure */ -static struct obd_ops mgs_obd_ops = { - .o_owner = THIS_MODULE, - .o_connect = mgs_connect, - .o_init_export = mgs_init_export, - .o_destroy_export = mgs_destroy_export, - .o_disconnect = mgs_disconnect, - .o_setup = mgs_setup, - .o_precleanup = mgs_precleanup, - .o_cleanup = mgs_cleanup, - .o_iocontrol = mgs_iocontrol, - .o_create = mgs_obd_create, - .o_destroy = mgs_obd_destroy, - .o_llog_init = mgs_llog_init, - .o_llog_finish = mgs_llog_finish, - .o_notify = mgs_notify, -}; - -static struct obd_ops mdt_obd_ops = { - .o_owner = THIS_MODULE, - .o_setup = mgt_setup, - .o_cleanup = mgt_cleanup, -}; - -static int __init mgs_init(void) -{ - int rc; - struct lprocfs_static_vars lvars; - - lprocfs_init_vars(mgs, &lvars); - class_register_type(&mgs_obd_ops, lvars.module_vars, LUSTRE_MGS_NAME); - lprocfs_init_vars(mgt, &lvars); - class_register_type(&mgt_obd_ops, lvars.module_vars, LUSTRE_MGT_NAME); - - return 0; -} - -static void /*__exit*/ mgs_exit(void) -{ - class_unregister_type(LUSTRE_MGS_NAME); - class_unregister_type(LUSTRE_MGT_NAME); -} - -MODULE_AUTHOR("Cluster File Systems, Inc. "); -MODULE_DESCRIPTION("Lustre Management Server (MGS)"); -MODULE_LICENSE("GPL"); - -module_init(mgs_init); -module_exit(mgs_exit); diff --git a/lustre/mgs/mgs_internal.h b/lustre/mgs/mgs_internal.h index 986aa34..5aafc7b 100644 --- a/lustre/mgs/mgs_internal.h +++ b/lustre/mgs/mgs_internal.h @@ -5,9 +5,19 @@ #ifndef _MGS_INTERNAL_H #define _MGS_INTERNAL_H -struct mgs_open_logs { - struct list_head mol_list; - struct llog_id; +#define MGS_SERVICE_WATCHDOG_TIMEOUT (obd_timeout * 1000) + +static inline struct mgs_obd *mgs_req2mgs(struct ptlrpc_request *req) +{ + return &req->rq_export->exp_obd->u.mgs; +} + +struct mgs_open_llogs { + struct list_head mol_list; + struct dentry *mol_dentry; + __u64 mod_id; }; +extern struct lvfs_callback_ops mgs_lvfs_ops; + #endif /* _MGS_INTERNAL_H */ diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index b8b0bd6..6162123 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -451,7 +451,6 @@ int lustre_process_logs(struct super_block *sb, list_del(&dirent->lld_list); logname = dirent->lld_name; - CERROR("file: %s\n", logname); /* mgcobd start adds "-conf" */ len = strlen(logname) - 5; if ((len < 1) || (strcmp(logname + len, "-conf") != 0)) { diff --git a/lustre/utils/lwizard b/lustre/utils/lwizard index 649b285..9ede78c 100755 --- a/lustre/utils/lwizard +++ b/lustre/utils/lwizard @@ -472,7 +472,7 @@ maybe_clean() get_option "$@" # some default definitions -LMC=${LMC:-"/usr/sbin/lmc"} +LMC=${LMC:-"./lmc"} CONFIG_FILE=${CONFIG_FILE:-"lwizard.xml"} -- 1.8.3.1