4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, 2012, Whamcloud, Inc.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/obdclass/obd_mount.c
38 * Client/server mount routines
40 * Author: Nathan Rutman <nathan@clusterfs.com>
44 #define DEBUG_SUBSYSTEM S_CLASS
45 #define D_MOUNT D_SUPER|D_CONFIG /*|D_WARNING */
46 #define PRINT_CMD CDEBUG
47 #define PRINT_MASK D_SUPER|D_CONFIG
51 #include <lustre_fsfilt.h>
52 #include <obd_class.h>
53 #include <lustre/lustre_user.h>
54 #include <linux/version.h>
55 #include <lustre_log.h>
56 #include <lustre_disk.h>
57 #include <lustre_param.h>
58 #ifdef HAVE_KERNEL_LOCKED
59 #include <linux/smp_lock.h>
62 static int (*client_fill_super)(struct super_block *sb,
63 struct vfsmount *mnt) = NULL;
64 static void (*kill_super_cb)(struct super_block *sb) = NULL;
66 /*********** mount lookup *********/
68 CFS_DEFINE_MUTEX(lustre_mount_info_lock);
69 static CFS_LIST_HEAD(server_mount_info_list);
71 static struct lustre_mount_info *server_find_mount(const char *name)
74 struct lustre_mount_info *lmi;
77 cfs_list_for_each(tmp, &server_mount_info_list) {
78 lmi = cfs_list_entry(tmp, struct lustre_mount_info,
80 if (strcmp(name, lmi->lmi_name) == 0)
86 /* we must register an obd for a mount before we call the setup routine.
87 *_setup will call lustre_get_mount to get the mnt struct
88 by obd_name, since we can't pass the pointer to setup. */
89 static int server_register_mount(const char *name, struct super_block *sb,
92 struct lustre_mount_info *lmi;
98 OBD_ALLOC(lmi, sizeof(*lmi));
101 OBD_ALLOC(name_cp, strlen(name) + 1);
103 OBD_FREE(lmi, sizeof(*lmi));
106 strcpy(name_cp, name);
108 cfs_mutex_lock(&lustre_mount_info_lock);
110 if (server_find_mount(name)) {
111 cfs_mutex_unlock(&lustre_mount_info_lock);
112 OBD_FREE(lmi, sizeof(*lmi));
113 OBD_FREE(name_cp, strlen(name) + 1);
114 CERROR("Already registered %s\n", name);
117 lmi->lmi_name = name_cp;
120 cfs_list_add(&lmi->lmi_list_chain, &server_mount_info_list);
122 cfs_mutex_unlock(&lustre_mount_info_lock);
124 CDEBUG(D_MOUNT, "reg_mnt %p from %s\n", lmi->lmi_mnt, name);
129 /* when an obd no longer needs a mount */
130 static int server_deregister_mount(const char *name)
132 struct lustre_mount_info *lmi;
135 cfs_mutex_lock(&lustre_mount_info_lock);
136 lmi = server_find_mount(name);
138 cfs_mutex_unlock(&lustre_mount_info_lock);
139 CERROR("%s not registered\n", name);
143 CDEBUG(D_MOUNT, "dereg_mnt %p from %s\n", lmi->lmi_mnt, name);
145 OBD_FREE(lmi->lmi_name, strlen(lmi->lmi_name) + 1);
146 cfs_list_del(&lmi->lmi_list_chain);
147 OBD_FREE(lmi, sizeof(*lmi));
148 cfs_mutex_unlock(&lustre_mount_info_lock);
153 /* obd's look up a registered mount using their obdname. This is just
154 for initial obd setup to find the mount struct. It should not be
155 called every time you want to mntget. */
156 struct lustre_mount_info *server_get_mount(const char *name)
158 struct lustre_mount_info *lmi;
159 struct lustre_sb_info *lsi;
162 cfs_mutex_lock(&lustre_mount_info_lock);
163 lmi = server_find_mount(name);
164 cfs_mutex_unlock(&lustre_mount_info_lock);
166 CERROR("Can't find mount for %s\n", name);
169 lsi = s2lsi(lmi->lmi_sb);
171 cfs_atomic_inc(&lsi->lsi_mounts);
173 CDEBUG(D_MOUNT, "get_mnt %p from %s, refs=%d\n", lmi->lmi_mnt,
174 name, cfs_atomic_read(&lsi->lsi_mounts));
178 EXPORT_SYMBOL(server_get_mount);
181 * Used by mdt to get mount_info from obdname.
182 * There are no blocking when using the mount_info.
183 * Do not use server_get_mount for this purpose.
185 struct lustre_mount_info *server_get_mount_2(const char *name)
187 struct lustre_mount_info *lmi;
190 cfs_mutex_lock(&lustre_mount_info_lock);
191 lmi = server_find_mount(name);
192 cfs_mutex_unlock(&lustre_mount_info_lock);
194 CERROR("Can't find mount for %s\n", name);
198 EXPORT_SYMBOL(server_get_mount_2);
200 static int lustre_put_lsi(struct super_block *sb);
202 /* to be called from obd_cleanup methods */
203 int server_put_mount(const char *name, struct vfsmount *mnt)
205 struct lustre_mount_info *lmi;
206 struct lustre_sb_info *lsi;
209 cfs_mutex_lock(&lustre_mount_info_lock);
210 lmi = server_find_mount(name);
211 cfs_mutex_unlock(&lustre_mount_info_lock);
213 CERROR("Can't find mount for %s\n", name);
216 lsi = s2lsi(lmi->lmi_sb);
218 CDEBUG(D_MOUNT, "put_mnt %p from %s, refs=%d\n",
219 lmi->lmi_mnt, name, cfs_atomic_read(&lsi->lsi_mounts));
221 if (lustre_put_lsi(lmi->lmi_sb))
222 CDEBUG(D_MOUNT, "Last put of mnt %p from %s\n",
225 /* this obd should never need the mount again */
226 server_deregister_mount(name);
230 EXPORT_SYMBOL(server_put_mount);
232 /* Corresponding to server_get_mount_2 */
233 int server_put_mount_2(const char *name, struct vfsmount *mnt)
238 EXPORT_SYMBOL(server_put_mount_2);
240 /**************** config llog ********************/
242 /** Get a config log from the MGS and process it.
243 * This func is called for both clients and servers.
244 * Continue to process new statements appended to the logs
245 * (whenever the config lock is revoked) until lustre_end_log
247 * @param sb The superblock is used by the MGC to write to the local copy of
249 * @param logname The name of the llog to replicate from the MGS
250 * @param cfg Since the same mgc may be used to follow multiple config logs
251 * (e.g. ost1, ost2, client), the config_llog_instance keeps the state for
252 * this log, and is added to the mgc's list of logs to follow.
254 int lustre_process_log(struct super_block *sb, char *logname,
255 struct config_llog_instance *cfg)
257 struct lustre_cfg *lcfg;
258 struct lustre_cfg_bufs *bufs;
259 struct lustre_sb_info *lsi = s2lsi(sb);
260 struct obd_device *mgc = lsi->lsi_mgc;
271 /* mgc_process_config */
272 lustre_cfg_bufs_reset(bufs, mgc->obd_name);
273 lustre_cfg_bufs_set_string(bufs, 1, logname);
274 lustre_cfg_bufs_set(bufs, 2, cfg, sizeof(*cfg));
275 lustre_cfg_bufs_set(bufs, 3, &sb, sizeof(sb));
276 lcfg = lustre_cfg_new(LCFG_LOG_START, bufs);
277 rc = obd_process_config(mgc, sizeof(*lcfg), lcfg);
278 lustre_cfg_free(lcfg);
283 LCONSOLE_ERROR_MSG(0x15b, "%s: The configuration from log '%s'"
284 "failed from the MGS (%d). Make sure this "
285 "client and the MGS are running compatible "
286 "versions of Lustre.\n",
287 mgc->obd_name, logname, rc);
290 LCONSOLE_ERROR_MSG(0x15c, "%s: The configuration from log '%s' "
291 "failed (%d). This may be the result of "
292 "communication errors between this node and "
293 "the MGS, a bad configuration, or other "
294 "errors. See the syslog for more "
295 "information.\n", mgc->obd_name, logname,
298 /* class_obd_list(); */
301 EXPORT_SYMBOL(lustre_process_log);
303 /* Stop watching this config log for updates */
304 int lustre_end_log(struct super_block *sb, char *logname,
305 struct config_llog_instance *cfg)
307 struct lustre_cfg *lcfg;
308 struct lustre_cfg_bufs bufs;
309 struct lustre_sb_info *lsi = s2lsi(sb);
310 struct obd_device *mgc = lsi->lsi_mgc;
317 /* mgc_process_config */
318 lustre_cfg_bufs_reset(&bufs, mgc->obd_name);
319 lustre_cfg_bufs_set_string(&bufs, 1, logname);
321 lustre_cfg_bufs_set(&bufs, 2, cfg, sizeof(*cfg));
322 lcfg = lustre_cfg_new(LCFG_LOG_END, &bufs);
323 rc = obd_process_config(mgc, sizeof(*lcfg), lcfg);
324 lustre_cfg_free(lcfg);
327 EXPORT_SYMBOL(lustre_end_log);
329 /**************** obd start *******************/
331 /** lustre_cfg_bufs are a holdover from 1.4; we can still set these up from
332 * lctl (and do for echo cli/srv.
334 int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
335 char *s1, char *s2, char *s3, char *s4)
337 struct lustre_cfg_bufs bufs;
338 struct lustre_cfg * lcfg = NULL;
341 CDEBUG(D_TRACE, "lcfg %s %#x %s %s %s %s\n", cfgname,
342 cmd, s1, s2, s3, s4);
344 lustre_cfg_bufs_reset(&bufs, cfgname);
346 lustre_cfg_bufs_set_string(&bufs, 1, s1);
348 lustre_cfg_bufs_set_string(&bufs, 2, s2);
350 lustre_cfg_bufs_set_string(&bufs, 3, s3);
352 lustre_cfg_bufs_set_string(&bufs, 4, s4);
354 lcfg = lustre_cfg_new(cmd, &bufs);
355 lcfg->lcfg_nid = nid;
356 rc = class_process_config(lcfg);
357 lustre_cfg_free(lcfg);
360 EXPORT_SYMBOL(do_lcfg);
362 /** Call class_attach and class_setup. These methods in turn call
363 * obd type-specific methods.
365 static int lustre_start_simple(char *obdname, char *type, char *uuid,
366 char *s1, char *s2, char *s3, char *s4)
369 CDEBUG(D_MOUNT, "Starting obd %s (typ=%s)\n", obdname, type);
371 rc = do_lcfg(obdname, 0, LCFG_ATTACH, type, uuid, 0, 0);
373 CERROR("%s attach error %d\n", obdname, rc);
376 rc = do_lcfg(obdname, 0, LCFG_SETUP, s1, s2, s3, s4);
378 CERROR("%s setup error %d\n", obdname, rc);
379 do_lcfg(obdname, 0, LCFG_DETACH, 0, 0, 0, 0);
384 /* Set up a MGS to serve startup logs */
385 static int server_start_mgs(struct super_block *sb)
387 struct lustre_sb_info *lsi = s2lsi(sb);
388 struct vfsmount *mnt = lsi->lsi_srv_mnt;
389 struct lustre_mount_info *lmi;
394 /* It is impossible to have more than 1 MGS per node, since
395 MGC wouldn't know which to connect to */
396 lmi = server_find_mount(LUSTRE_MGS_OBDNAME);
398 lsi = s2lsi(lmi->lmi_sb);
399 LCONSOLE_ERROR_MSG(0x15d, "The MGS service was already started"
404 CDEBUG(D_CONFIG, "Start MGS service %s\n", LUSTRE_MGS_OBDNAME);
406 rc = server_register_mount(LUSTRE_MGS_OBDNAME, sb, mnt);
409 rc = lustre_start_simple(LUSTRE_MGS_OBDNAME, LUSTRE_MGS_NAME,
410 LUSTRE_MGS_OBDNAME, 0, 0,
411 lsi->lsi_osd_obdname, 0);
412 /* Do NOT call server_deregister_mount() here. This leads to
413 * inability cleanup cleanly and free lsi and other stuff when
414 * mgs calls server_put_mount() in error handling case. -umka */
418 LCONSOLE_ERROR_MSG(0x15e, "Failed to start MGS '%s' (%d). "
419 "Is the 'mgs' module loaded?\n",
420 LUSTRE_MGS_OBDNAME, rc);
424 static int server_stop_mgs(struct super_block *sb)
426 struct obd_device *obd;
430 CDEBUG(D_MOUNT, "Stop MGS service %s\n", LUSTRE_MGS_OBDNAME);
432 /* There better be only one MGS */
433 obd = class_name2obd(LUSTRE_MGS_OBDNAME);
435 CDEBUG(D_CONFIG, "mgs %s not running\n", LUSTRE_MGS_OBDNAME);
439 /* The MGS should always stop when we say so */
441 rc = class_manual_cleanup(obd);
445 CFS_DEFINE_MUTEX(mgc_start_lock);
447 /** Set up a mgc obd to process startup logs
449 * \param sb [in] super block of the mgc obd
451 * \retval 0 success, otherwise error code
453 static int lustre_start_mgc(struct super_block *sb)
455 struct obd_connect_data *data = NULL;
456 struct lustre_sb_info *lsi = s2lsi(sb);
457 struct obd_device *obd;
458 struct obd_export *exp;
459 struct obd_uuid *uuid;
462 char *mgcname = NULL, *niduuid = NULL, *mgssec = NULL;
465 int rc = 0, i = 0, j, len;
468 LASSERT(lsi->lsi_lmd);
470 /* Find the first non-lo MGS nid for our MGC name */
471 if (IS_SERVER(lsi)) {
472 /* mount -o mgsnode=nid */
473 ptr = lsi->lsi_lmd->lmd_mgs;
474 if (lsi->lsi_lmd->lmd_mgs &&
475 (class_parse_nid(lsi->lsi_lmd->lmd_mgs, &nid, &ptr) == 0)) {
477 } else if (IS_MGS(lsi)) {
478 lnet_process_id_t id;
479 while ((rc = LNetGetId(i++, &id)) != -ENOENT) {
480 if (LNET_NETTYP(LNET_NIDNET(id.nid)) == LOLND)
487 } else { /* client */
488 /* Use nids from mount line: uml1,1@elan:uml2,2@elan:/lustre */
489 ptr = lsi->lsi_lmd->lmd_dev;
490 if (class_parse_nid(ptr, &nid, &ptr) == 0)
494 CERROR("No valid MGS nids found.\n");
498 cfs_mutex_lock(&mgc_start_lock);
500 len = strlen(LUSTRE_MGC_OBDNAME) + strlen(libcfs_nid2str(nid)) + 1;
501 OBD_ALLOC(mgcname, len);
502 OBD_ALLOC(niduuid, len + 2);
503 if (!mgcname || !niduuid)
504 GOTO(out_free, rc = -ENOMEM);
505 sprintf(mgcname, "%s%s", LUSTRE_MGC_OBDNAME, libcfs_nid2str(nid));
507 mgssec = lsi->lsi_lmd->lmd_mgssec ? lsi->lsi_lmd->lmd_mgssec : "";
511 GOTO(out_free, rc = -ENOMEM);
513 obd = class_name2obd(mgcname);
514 if (obd && !obd->obd_stopping) {
515 rc = obd_set_info_async(NULL, obd->obd_self_export,
516 strlen(KEY_MGSSEC), KEY_MGSSEC,
517 strlen(mgssec), mgssec, NULL);
521 /* Re-using an existing MGC */
522 cfs_atomic_inc(&obd->u.cli.cl_mgc_refcount);
524 /* IR compatibility check, only for clients */
525 if (lmd_is_client(lsi->lsi_lmd)) {
527 int vallen = sizeof(*data);
528 __u32 *flags = &lsi->lsi_lmd->lmd_flags;
530 rc = obd_get_info(NULL, obd->obd_self_export,
531 strlen(KEY_CONN_DATA), KEY_CONN_DATA,
532 &vallen, data, NULL);
534 has_ir = OCD_HAS_FLAG(data, IMP_RECOV);
535 if (has_ir ^ !(*flags & LMD_FLG_NOIR)) {
536 /* LMD_FLG_NOIR is for test purpose only */
538 "Trying to mount a client with IR setting "
539 "not compatible with current mgc. "
540 "Force to use current mgc setting that is "
542 has_ir ? "enabled" : "disabled");
544 *flags &= ~LMD_FLG_NOIR;
546 *flags |= LMD_FLG_NOIR;
551 /* If we are restarting the MGS, don't try to keep the MGC's
552 old connection, or registration will fail. */
554 CDEBUG(D_MOUNT, "New MGS with live MGC\n");
558 /* Try all connections, but only once (again).
559 We don't want to block another target from starting
560 (using its local copy of the log), but we do want to connect
561 if at all possible. */
563 CDEBUG(D_MOUNT, "%s: Set MGC reconnect %d\n", mgcname,recov_bk);
564 rc = obd_set_info_async(NULL, obd->obd_self_export,
565 sizeof(KEY_INIT_RECOV_BACKUP),
566 KEY_INIT_RECOV_BACKUP,
567 sizeof(recov_bk), &recov_bk, NULL);
571 CDEBUG(D_MOUNT, "Start MGC '%s'\n", mgcname);
573 /* Add the primary nids for the MGS */
575 sprintf(niduuid, "%s_%x", mgcname, i);
576 if (IS_SERVER(lsi)) {
577 ptr = lsi->lsi_lmd->lmd_mgs;
579 /* Use local nids (including LO) */
580 lnet_process_id_t id;
581 while ((rc = LNetGetId(i++, &id)) != -ENOENT) {
582 rc = do_lcfg(mgcname, id.nid,
583 LCFG_ADD_UUID, niduuid, 0,0,0);
586 /* Use mgsnode= nids */
587 /* mount -o mgsnode=nid */
588 if (lsi->lsi_lmd->lmd_mgs) {
589 ptr = lsi->lsi_lmd->lmd_mgs;
590 } else if (class_find_param(ptr, PARAM_MGSNODE,
592 CERROR("No MGS nids given.\n");
593 GOTO(out_free, rc = -EINVAL);
595 while (class_parse_nid(ptr, &nid, &ptr) == 0) {
596 rc = do_lcfg(mgcname, nid,
597 LCFG_ADD_UUID, niduuid, 0,0,0);
601 } else { /* client */
602 /* Use nids from mount line: uml1,1@elan:uml2,2@elan:/lustre */
603 ptr = lsi->lsi_lmd->lmd_dev;
604 while (class_parse_nid(ptr, &nid, &ptr) == 0) {
605 rc = do_lcfg(mgcname, nid,
606 LCFG_ADD_UUID, niduuid, 0,0,0);
608 /* Stop at the first failover nid */
614 CERROR("No valid MGS nids found.\n");
615 GOTO(out_free, rc = -EINVAL);
617 lsi->lsi_lmd->lmd_mgs_failnodes = 1;
619 /* Random uuid for MGC allows easier reconnects */
621 ll_generate_random_uuid(uuidc);
622 class_uuid_unparse(uuidc, uuid);
625 rc = lustre_start_simple(mgcname, LUSTRE_MGC_NAME,
626 (char *)uuid->uuid, LUSTRE_MGS_OBDNAME,
632 /* Add any failover MGS nids */
634 while (ptr && ((*ptr == ':' ||
635 class_find_param(ptr, PARAM_MGSNODE, &ptr) == 0))) {
636 /* New failover node */
637 sprintf(niduuid, "%s_%x", mgcname, i);
639 while (class_parse_nid_quiet(ptr, &nid, &ptr) == 0) {
641 rc = do_lcfg(mgcname, nid,
642 LCFG_ADD_UUID, niduuid, 0,0,0);
647 rc = do_lcfg(mgcname, 0, LCFG_ADD_CONN,
655 lsi->lsi_lmd->lmd_mgs_failnodes = i;
657 obd = class_name2obd(mgcname);
659 CERROR("Can't find mgcobd %s\n", mgcname);
660 GOTO(out_free, rc = -ENOTCONN);
663 rc = obd_set_info_async(NULL, obd->obd_self_export,
664 strlen(KEY_MGSSEC), KEY_MGSSEC,
665 strlen(mgssec), mgssec, NULL);
669 /* Keep a refcount of servers/clients who started with "mount",
670 so we know when we can get rid of the mgc. */
671 cfs_atomic_set(&obd->u.cli.cl_mgc_refcount, 1);
673 /* Try all connections, but only once. */
675 rc = obd_set_info_async(NULL, obd->obd_self_export,
676 sizeof(KEY_INIT_RECOV_BACKUP),
677 KEY_INIT_RECOV_BACKUP,
678 sizeof(recov_bk), &recov_bk, NULL);
681 CWARN("can't set %s %d\n", KEY_INIT_RECOV_BACKUP, rc);
683 /* We connect to the MGS at setup, and don't disconnect until cleanup */
684 data->ocd_connect_flags = OBD_CONNECT_VERSION | OBD_CONNECT_AT |
685 OBD_CONNECT_FULL20 | OBD_CONNECT_IMP_RECOV;
687 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 2, 50, 0)
688 data->ocd_connect_flags |= OBD_CONNECT_MNE_SWAB;
690 #warning "LU-1644: Remove old OBD_CONNECT_MNE_SWAB fixup and imp_need_mne_swab"
693 if (lmd_is_client(lsi->lsi_lmd) &&
694 lsi->lsi_lmd->lmd_flags & LMD_FLG_NOIR)
695 data->ocd_connect_flags &= ~OBD_CONNECT_IMP_RECOV;
696 data->ocd_version = LUSTRE_VERSION_CODE;
697 rc = obd_connect(NULL, &exp, obd, &(obd->obd_uuid), data, NULL);
699 CERROR("connect failed %d\n", rc);
703 obd->u.cli.cl_mgc_mgsexp = exp;
706 /* Keep the mgc info in the sb. Note that many lsi's can point
710 cfs_mutex_unlock(&mgc_start_lock);
715 OBD_FREE(mgcname, len);
717 OBD_FREE(niduuid, len + 2);
721 static int lustre_stop_mgc(struct super_block *sb)
723 struct lustre_sb_info *lsi = s2lsi(sb);
724 struct obd_device *obd;
725 char *niduuid = 0, *ptr = 0;
726 int i, rc = 0, len = 0;
736 cfs_mutex_lock(&mgc_start_lock);
737 LASSERT(cfs_atomic_read(&obd->u.cli.cl_mgc_refcount) > 0);
738 if (!cfs_atomic_dec_and_test(&obd->u.cli.cl_mgc_refcount)) {
739 /* This is not fatal, every client that stops
740 will call in here. */
741 CDEBUG(D_MOUNT, "mgc still has %d references.\n",
742 cfs_atomic_read(&obd->u.cli.cl_mgc_refcount));
743 GOTO(out, rc = -EBUSY);
746 /* The MGC has no recoverable data in any case.
747 * force shotdown set in umount_begin */
748 obd->obd_no_recov = 1;
750 if (obd->u.cli.cl_mgc_mgsexp) {
751 /* An error is not fatal, if we are unable to send the
752 disconnect mgs ping evictor cleans up the export */
753 rc = obd_disconnect(obd->u.cli.cl_mgc_mgsexp);
755 CDEBUG(D_MOUNT, "disconnect failed %d\n", rc);
758 /* Save the obdname for cleaning the nid uuids, which are
760 len = strlen(obd->obd_name) + 6;
761 OBD_ALLOC(niduuid, len);
763 strcpy(niduuid, obd->obd_name);
764 ptr = niduuid + strlen(niduuid);
767 rc = class_manual_cleanup(obd);
771 /* Clean the nid uuids */
773 GOTO(out, rc = -ENOMEM);
775 for (i = 0; i < lsi->lsi_lmd->lmd_mgs_failnodes; i++) {
776 sprintf(ptr, "_%x", i);
777 rc = do_lcfg(LUSTRE_MGC_OBDNAME, 0, LCFG_DEL_UUID,
780 CERROR("del MDC UUID %s failed: rc = %d\n",
785 OBD_FREE(niduuid, len);
787 /* class_import_put will get rid of the additional connections */
788 cfs_mutex_unlock(&mgc_start_lock);
792 /* Since there's only one mgc per node, we have to change it's fs to get
793 access to the right disk. */
794 static int server_mgc_set_fs(struct obd_device *mgc, struct super_block *sb)
796 struct lustre_sb_info *lsi = s2lsi(sb);
800 CDEBUG(D_MOUNT, "Set mgc disk for %s\n", lsi->lsi_lmd->lmd_dev);
802 /* cl_mgc_sem in mgc insures we sleep if the mgc_fs is busy */
803 rc = obd_set_info_async(NULL, mgc->obd_self_export,
804 sizeof(KEY_SET_FS), KEY_SET_FS,
805 sizeof(*sb), sb, NULL);
807 CERROR("can't set_fs %d\n", rc);
813 static int server_mgc_clear_fs(struct obd_device *mgc)
818 CDEBUG(D_MOUNT, "Unassign mgc disk\n");
820 rc = obd_set_info_async(NULL, mgc->obd_self_export,
821 sizeof(KEY_CLEAR_FS), KEY_CLEAR_FS,
826 CFS_DEFINE_MUTEX(server_start_lock);
828 /* Stop MDS/OSS if nobody is using them */
829 static int server_stop_servers(int lsiflags)
831 struct obd_device *obd = NULL;
832 struct obd_type *type = NULL;
836 cfs_mutex_lock(&server_start_lock);
838 /* Either an MDT or an OST or neither */
839 /* if this was an MDT, and there are no more MDT's, clean up the MDS */
840 if ((lsiflags & LDD_F_SV_TYPE_MDT) &&
841 (obd = class_name2obd(LUSTRE_MDS_OBDNAME))) {
842 /*FIXME pre-rename, should eventually be LUSTRE_MDT_NAME*/
843 type = class_search_type(LUSTRE_MDS_NAME);
845 /* if this was an OST, and there are no more OST's, clean up the OSS */
846 if ((lsiflags & LDD_F_SV_TYPE_OST) &&
847 (obd = class_name2obd(LUSTRE_OSS_OBDNAME))) {
848 type = class_search_type(LUSTRE_OST_NAME);
851 if (obd && (!type || !type->typ_refcnt)) {
854 /* obd_fail doesn't mean much on a server obd */
855 err = class_manual_cleanup(obd);
860 cfs_mutex_unlock(&server_start_lock);
865 int server_mti_print(char *title, struct mgs_target_info *mti)
867 PRINT_CMD(PRINT_MASK, "mti %s\n", title);
868 PRINT_CMD(PRINT_MASK, "server: %s\n", mti->mti_svname);
869 PRINT_CMD(PRINT_MASK, "fs: %s\n", mti->mti_fsname);
870 PRINT_CMD(PRINT_MASK, "uuid: %s\n", mti->mti_uuid);
871 PRINT_CMD(PRINT_MASK, "ver: %d flags: %#x\n",
872 mti->mti_config_ver, mti->mti_flags);
876 /** Get the fsname ("lustre") from the server name ("lustre-OST003F").
877 * @param [in] svname server name including type and index
878 * @param [out] fsname Buffer to copy filesystem name prefix into.
879 * Must have at least 'strlen(fsname) + 1' chars.
880 * @param [out] endptr if endptr isn't NULL it is set to end of fsname
883 static int server_name2fsname(char *svname, char *fsname, char **endptr)
887 p = strstr(svname, "-OST");
889 p = strstr(svname, "-MDT");
894 strncpy(fsname, svname, p - svname);
895 fsname[p - svname] = '\0';
905 * Get service name (svname) from string
907 * if endptr isn't NULL it is set to end of fsname *
909 int server_name2svname(char *label, char *svname, char **endptr)
914 /* We use server_name2fsname() just for parsing */
915 rc = server_name2fsname(label, NULL, &dash);
922 strncpy(svname, dash + 1, MTI_NAME_MAXLEN);
926 EXPORT_SYMBOL(server_name2svname);
929 /* Get the index from the obd name.
932 if endptr isn't NULL it is set to end of name */
933 int server_name2index(char *svname, __u32 *idx, char **endptr)
939 /* We use server_name2fsname() just for parsing */
940 rc = server_name2fsname(svname, NULL, &dash);
949 if (strncmp(dash, "MDT", 3) == 0)
950 rc = LDD_F_SV_TYPE_MDT;
951 else if (strncmp(dash, "OST", 3) == 0)
952 rc = LDD_F_SV_TYPE_OST;
958 if (strcmp(dash, "all") == 0)
959 return rc | LDD_F_SV_ALL;
961 index = simple_strtoul(dash, endptr, 16);
966 EXPORT_SYMBOL(server_name2index);
968 /* Generate data for registration */
969 static int server_lsi2mti(struct lustre_sb_info *lsi,
970 struct mgs_target_info *mti)
972 lnet_process_id_t id;
979 strncpy(mti->mti_svname, lsi->lsi_svname, sizeof(mti->mti_svname));
981 mti->mti_nid_count = 0;
982 while (LNetGetId(i++, &id) != -ENOENT) {
983 if (LNET_NETTYP(LNET_NIDNET(id.nid)) == LOLND)
986 /* server use --servicenode param, only allow specified
987 * nids be registered */
988 if ((lsi->lsi_lmd->lmd_flags & LMD_FLG_NO_PRIMNODE) != 0 &&
989 class_match_nid(lsi->lsi_lmd->lmd_params,
990 PARAM_FAILNODE, id.nid) < 1)
993 /* match specified network */
994 if (!class_match_net(lsi->lsi_lmd->lmd_params,
995 PARAM_NETWORK, LNET_NIDNET(id.nid)))
998 mti->mti_nids[mti->mti_nid_count] = id.nid;
999 mti->mti_nid_count++;
1000 if (mti->mti_nid_count >= MTI_NIDS_MAX) {
1001 CWARN("Only using first %d nids for %s\n",
1002 mti->mti_nid_count, mti->mti_svname);
1007 mti->mti_lustre_ver = LUSTRE_VERSION_CODE;
1008 mti->mti_config_ver = 0;
1010 rc = server_name2fsname(lsi->lsi_svname, mti->mti_fsname, NULL);
1014 rc = server_name2index(lsi->lsi_svname, &mti->mti_stripe_index, NULL);
1017 /* Orion requires index to be set */
1018 LASSERT(!(rc & LDD_F_NEED_INDEX));
1019 /* keep only LDD flags */
1020 mti->mti_flags = lsi->lsi_flags & LDD_F_MASK;
1021 mti->mti_flags |= LDD_F_UPDATE;
1022 strncpy(mti->mti_params, lsi->lsi_lmd->lmd_params,
1023 sizeof(mti->mti_params));
1027 /* Register an old or new target with the MGS. If needed MGS will construct
1028 startup logs and assign index */
1029 static int server_register_target(struct lustre_sb_info *lsi)
1031 struct obd_device *mgc = lsi->lsi_mgc;
1032 struct mgs_target_info *mti = NULL;
1039 if (!IS_SERVER(lsi))
1046 rc = server_lsi2mti(lsi, mti);
1050 CDEBUG(D_MOUNT, "Registration %s, fs=%s, %s, index=%04x, flags=%#x\n",
1051 mti->mti_svname, mti->mti_fsname,
1052 libcfs_nid2str(mti->mti_nids[0]), mti->mti_stripe_index,
1055 /* if write_conf is true, the registration must succeed */
1056 writeconf = !!(lsi->lsi_flags & (LDD_F_NEED_INDEX | LDD_F_UPDATE));
1057 mti->mti_flags |= LDD_F_OPC_REG;
1059 /* Register the target */
1060 /* FIXME use mgc_process_config instead */
1061 rc = obd_set_info_async(NULL, mgc->u.cli.cl_mgc_mgsexp,
1062 sizeof(KEY_REGISTER_TARGET), KEY_REGISTER_TARGET,
1063 sizeof(*mti), mti, NULL);
1065 if (mti->mti_flags & LDD_F_ERROR) {
1066 LCONSOLE_ERROR_MSG(0x160,
1067 "The MGS is refusing to allow this "
1068 "server (%s) to start. Please see messages"
1069 " on the MGS node.\n", lsi->lsi_svname);
1070 } else if (writeconf) {
1071 LCONSOLE_ERROR_MSG(0x15f,
1072 "Communication to the MGS return error %d. "
1073 "Is the MGS running?\n", rc);
1075 CERROR("Cannot talk to the MGS: %d, not fatal\n", rc);
1076 /* reset the error code for non-fatal error. */
1089 * Notify the MGS that this target is ready.
1090 * Used by IR - if the MGS receives this message, it will notify clients.
1092 static int server_notify_target(struct super_block *sb, struct obd_device *obd)
1094 struct lustre_sb_info *lsi = s2lsi(sb);
1095 struct obd_device *mgc = lsi->lsi_mgc;
1096 struct mgs_target_info *mti = NULL;
1102 if (!(IS_SERVER(lsi)))
1108 rc = server_lsi2mti(lsi, mti);
1112 mti->mti_instance = obd->u.obt.obt_instance;
1113 mti->mti_flags |= LDD_F_OPC_READY;
1115 /* FIXME use mgc_process_config instead */
1116 rc = obd_set_info_async(NULL, mgc->u.cli.cl_mgc_mgsexp,
1117 sizeof(KEY_REGISTER_TARGET),
1118 KEY_REGISTER_TARGET,
1119 sizeof(*mti), mti, NULL);
1121 /* Imperative recovery: if the mgs informs us to use IR? */
1122 if (!rc && !(mti->mti_flags & LDD_F_ERROR) &&
1123 (mti->mti_flags & LDD_F_IR_CAPABLE))
1124 lsi->lsi_flags |= LDD_F_IR_CAPABLE;
1133 /** Start server targets: MDTs and OSTs
1135 static int server_start_targets(struct super_block *sb, struct vfsmount *mnt)
1137 struct obd_device *obd;
1138 struct lustre_sb_info *lsi = s2lsi(sb);
1139 struct config_llog_instance cfg;
1143 CDEBUG(D_MOUNT, "starting target %s\n", lsi->lsi_svname);
1146 /* If we're an MDT, make sure the global MDS is running */
1147 if (lsi->lsi_ldd->ldd_flags & LDD_F_SV_TYPE_MDT) {
1148 /* make sure the MDS is started */
1149 cfs_mutex_lock(&server_start_lock);
1150 obd = class_name2obd(LUSTRE_MDS_OBDNAME);
1152 rc = lustre_start_simple(LUSTRE_MDS_OBDNAME,
1153 /* FIXME pre-rename, should eventually be LUSTRE_MDS_NAME */
1155 LUSTRE_MDS_OBDNAME"_uuid",
1158 cfs_mutex_unlock(&server_start_lock);
1159 CERROR("failed to start MDS: %d\n", rc);
1163 cfs_mutex_unlock(&server_start_lock);
1167 /* If we're an OST, make sure the global OSS is running */
1169 /* make sure OSS is started */
1170 cfs_mutex_lock(&server_start_lock);
1171 obd = class_name2obd(LUSTRE_OSS_OBDNAME);
1173 rc = lustre_start_simple(LUSTRE_OSS_OBDNAME,
1175 LUSTRE_OSS_OBDNAME"_uuid",
1178 cfs_mutex_unlock(&server_start_lock);
1179 CERROR("failed to start OSS: %d\n", rc);
1183 cfs_mutex_unlock(&server_start_lock);
1186 /* Set the mgc fs to our server disk. This allows the MGC to
1187 * read and write configs locally, in case it can't talk to the MGS. */
1188 if (lsi->lsi_srv_mnt) {
1189 rc = server_mgc_set_fs(lsi->lsi_mgc, sb);
1194 /* Register with MGS */
1195 rc = server_register_target(lsi);
1199 /* Let the target look up the mount using the target's name
1200 (we can't pass the sb or mnt through class_process_config.) */
1201 rc = server_register_mount(lsi->lsi_svname, sb, mnt);
1205 /* Start targets using the llog named for the target */
1206 memset(&cfg, 0, sizeof(cfg));
1207 rc = lustre_process_log(sb, lsi->lsi_svname, &cfg);
1209 CERROR("failed to start server %s: %d\n",
1210 lsi->lsi_svname, rc);
1211 /* Do NOT call server_deregister_mount() here. This makes it
1212 * impossible to find mount later in cleanup time and leaves
1213 * @lsi and othder stuff leaked. -umka */
1218 /* Release the mgc fs for others to use */
1219 if (lsi->lsi_srv_mnt)
1220 server_mgc_clear_fs(lsi->lsi_mgc);
1223 obd = class_name2obd(lsi->lsi_svname);
1225 CERROR("no server named %s was started\n",
1230 if ((lsi->lsi_lmd->lmd_flags & LMD_FLG_ABORT_RECOV) &&
1231 (OBP(obd, iocontrol))) {
1232 obd_iocontrol(OBD_IOC_ABORT_RECOVERY,
1233 obd->obd_self_export, 0, NULL, NULL);
1236 server_notify_target(sb, obd);
1238 /* calculate recovery timeout, do it after lustre_process_log */
1239 server_calc_timeout(lsi, obd);
1241 /* log has been fully processed */
1242 obd_notify(obd, NULL, OBD_NOTIFY_CONFIG, (void *)CONFIG_LOG);
1248 /***************** lustre superblock **************/
1250 struct lustre_sb_info *lustre_init_lsi(struct super_block *sb)
1252 struct lustre_sb_info *lsi;
1258 OBD_ALLOC_PTR(lsi->lsi_lmd);
1259 if (!lsi->lsi_lmd) {
1264 lsi->lsi_lmd->lmd_exclude_count = 0;
1265 lsi->lsi_lmd->lmd_recovery_time_soft = 0;
1266 lsi->lsi_lmd->lmd_recovery_time_hard = 0;
1267 s2lsi_nocast(sb) = lsi;
1268 /* we take 1 extra ref for our setup */
1269 cfs_atomic_set(&lsi->lsi_mounts, 1);
1271 /* Default umount style */
1272 lsi->lsi_flags = LSI_UMOUNT_FAILOVER;
1277 static int lustre_free_lsi(struct super_block *sb)
1279 struct lustre_sb_info *lsi = s2lsi(sb);
1282 LASSERT(lsi != NULL);
1283 CDEBUG(D_MOUNT, "Freeing lsi %p\n", lsi);
1285 /* someone didn't call server_put_mount. */
1286 LASSERT(cfs_atomic_read(&lsi->lsi_mounts) == 0);
1288 if (lsi->lsi_lmd != NULL) {
1289 if (lsi->lsi_lmd->lmd_dev != NULL)
1290 OBD_FREE(lsi->lsi_lmd->lmd_dev,
1291 strlen(lsi->lsi_lmd->lmd_dev) + 1);
1292 if (lsi->lsi_lmd->lmd_profile != NULL)
1293 OBD_FREE(lsi->lsi_lmd->lmd_profile,
1294 strlen(lsi->lsi_lmd->lmd_profile) + 1);
1295 if (lsi->lsi_lmd->lmd_mgssec != NULL)
1296 OBD_FREE(lsi->lsi_lmd->lmd_mgssec,
1297 strlen(lsi->lsi_lmd->lmd_mgssec) + 1);
1298 if (lsi->lsi_lmd->lmd_opts != NULL)
1299 OBD_FREE(lsi->lsi_lmd->lmd_opts,
1300 strlen(lsi->lsi_lmd->lmd_opts) + 1);
1301 if (lsi->lsi_lmd->lmd_exclude_count)
1302 OBD_FREE(lsi->lsi_lmd->lmd_exclude,
1303 sizeof(lsi->lsi_lmd->lmd_exclude[0]) *
1304 lsi->lsi_lmd->lmd_exclude_count);
1305 if (lsi->lsi_lmd->lmd_mgs != NULL)
1306 OBD_FREE(lsi->lsi_lmd->lmd_mgs,
1307 strlen(lsi->lsi_lmd->lmd_mgs) + 1);
1308 if (lsi->lsi_lmd->lmd_osd_type != NULL)
1309 OBD_FREE(lsi->lsi_lmd->lmd_osd_type,
1310 strlen(lsi->lsi_lmd->lmd_osd_type) + 1);
1311 if (lsi->lsi_lmd->lmd_params != NULL)
1312 OBD_FREE(lsi->lsi_lmd->lmd_params, 4096);
1314 OBD_FREE(lsi->lsi_lmd, sizeof(*lsi->lsi_lmd));
1317 LASSERT(lsi->lsi_llsbi == NULL);
1318 OBD_FREE(lsi, sizeof(*lsi));
1319 s2lsi_nocast(sb) = NULL;
1324 /* The lsi has one reference for every server that is using the disk -
1325 e.g. MDT, MGS, and potentially MGC */
1326 static int lustre_put_lsi(struct super_block *sb)
1328 struct lustre_sb_info *lsi = s2lsi(sb);
1331 LASSERT(lsi != NULL);
1333 CDEBUG(D_MOUNT, "put %p %d\n", sb, cfs_atomic_read(&lsi->lsi_mounts));
1334 if (cfs_atomic_dec_and_test(&lsi->lsi_mounts)) {
1335 if (IS_SERVER(lsi) && lsi->lsi_osd_exp) {
1336 obd_disconnect(lsi->lsi_osd_exp);
1337 /* wait till OSD is gone */
1338 obd_zombie_barrier();
1340 lustre_free_lsi(sb);
1346 static int lsi_prepare(struct lustre_sb_info *lsi)
1353 LASSERT(lsi->lsi_lmd);
1355 /* The server name is given as a mount line option */
1356 if (lsi->lsi_lmd->lmd_profile == NULL) {
1357 LCONSOLE_ERROR("Can't determine server name\n");
1361 if (strlen(lsi->lsi_lmd->lmd_profile) >= sizeof(lsi->lsi_svname))
1362 RETURN(-ENAMETOOLONG);
1364 strcpy(lsi->lsi_svname, lsi->lsi_lmd->lmd_profile);
1366 /* Determine osd type */
1367 if (lsi->lsi_lmd->lmd_osd_type != NULL) {
1368 if (strlen(lsi->lsi_lmd->lmd_osd_type) >=
1369 sizeof(lsi->lsi_osd_type))
1370 RETURN(-ENAMETOOLONG);
1372 strcpy(lsi->lsi_osd_type, lsi->lsi_lmd->lmd_osd_type);
1374 strcpy(lsi->lsi_osd_type, LUSTRE_OSD_LDISKFS_NAME);
1377 /* XXX: a temp. solution for components using fsfilt
1378 * to be removed in one of the subsequent patches */
1379 if (!strcmp(lsi->lsi_lmd->lmd_osd_type, "osd-ldiskfs")) {
1380 strcpy(lsi->lsi_fstype, "ldiskfs");
1382 strcpy(lsi->lsi_fstype, lsi->lsi_lmd->lmd_osd_type);
1385 /* Determine server type */
1386 rc = server_name2index(lsi->lsi_svname, &index, NULL);
1388 if (lsi->lsi_lmd->lmd_flags & LMD_FLG_MGS) {
1389 /* Assume we're a bare MGS */
1391 lsi->lsi_lmd->lmd_flags |= LMD_FLG_NOSVC;
1393 LCONSOLE_ERROR("Can't determine server type of '%s'\n",
1398 lsi->lsi_flags |= rc;
1400 /* Add mount line flags that used to be in ldd:
1401 * writeconf, mgs, iam, anything else?
1403 lsi->lsi_flags |= (lsi->lsi_lmd->lmd_flags & LMD_FLG_WRITECONF) ?
1404 LDD_F_WRITECONF : 0;
1405 lsi->lsi_flags |= (lsi->lsi_lmd->lmd_flags & LMD_FLG_VIRGIN) ?
1407 lsi->lsi_flags |= (lsi->lsi_lmd->lmd_flags & LMD_FLG_MGS) ?
1408 LDD_F_SV_TYPE_MGS : 0;
1409 lsi->lsi_flags |= (lsi->lsi_lmd->lmd_flags & LMD_FLG_IAM) ?
1411 lsi->lsi_flags |= (lsi->lsi_lmd->lmd_flags & LMD_FLG_NO_PRIMNODE) ?
1412 LDD_F_NO_PRIMNODE : 0;
1417 /*************** server mount ******************/
1419 /** Start the shutdown of servers at umount.
1421 static void server_put_super(struct super_block *sb)
1423 struct lustre_sb_info *lsi = s2lsi(sb);
1424 struct obd_device *obd;
1425 char *tmpname, *extraname = NULL;
1427 int lsiflags = lsi->lsi_flags;
1430 LASSERT(IS_SERVER(lsi));
1432 tmpname_sz = strlen(lsi->lsi_svname) + 1;
1433 OBD_ALLOC(tmpname, tmpname_sz);
1434 memcpy(tmpname, lsi->lsi_svname, tmpname_sz);
1435 CDEBUG(D_MOUNT, "server put_super %s\n", tmpname);
1436 if (IS_MDT(lsi) && (lsi->lsi_lmd->lmd_flags & LMD_FLG_NOSVC))
1437 snprintf(tmpname, tmpname_sz, "MGS");
1439 /* Stop the target */
1440 if (!(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOSVC) &&
1441 (IS_MDT(lsi) || IS_OST(lsi))) {
1442 struct lustre_profile *lprof = NULL;
1444 /* tell the mgc to drop the config log */
1445 lustre_end_log(sb, lsi->lsi_svname, NULL);
1447 /* COMPAT_146 - profile may get deleted in mgc_cleanup.
1448 If there are any setup/cleanup errors, save the lov
1449 name for safety cleanup later. */
1450 lprof = class_get_profile(lsi->lsi_svname);
1451 if (lprof && lprof->lp_dt) {
1452 OBD_ALLOC(extraname, strlen(lprof->lp_dt) + 1);
1453 strcpy(extraname, lprof->lp_dt);
1456 obd = class_name2obd(lsi->lsi_svname);
1458 CDEBUG(D_MOUNT, "stopping %s\n", obd->obd_name);
1459 if (lsi->lsi_flags & LSI_UMOUNT_FAILOVER)
1461 /* We can't seem to give an error return code
1462 * to .put_super, so we better make sure we clean up! */
1464 class_manual_cleanup(obd);
1466 CERROR("no obd %s\n", lsi->lsi_svname);
1467 server_deregister_mount(lsi->lsi_svname);
1471 /* If they wanted the mgs to stop separately from the mdt, they
1472 should have put it on a different device. */
1474 /* if MDS start with --nomgs, don't stop MGS then */
1475 if (!(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOMGS))
1476 server_stop_mgs(sb);
1479 /* Clean the mgc and sb */
1480 lustre_common_put_super(sb);
1482 /* wait till all in-progress cleanups are done
1483 * specifically we're interested in ofd cleanup
1485 obd_zombie_barrier();
1487 /* Stop the servers (MDS, OSS) if no longer needed. We must wait
1488 until the target is really gone so that our type refcount check
1490 server_stop_servers(lsiflags);
1492 /* In case of startup or cleanup err, stop related obds */
1494 obd = class_name2obd(extraname);
1496 CWARN("Cleaning orphaned obd %s\n", extraname);
1498 class_manual_cleanup(obd);
1500 OBD_FREE(extraname, strlen(extraname) + 1);
1503 LCONSOLE_WARN("server umount %s complete\n", tmpname);
1504 OBD_FREE(tmpname, tmpname_sz);
1508 /** Called only for 'umount -f'
1510 #ifdef HAVE_UMOUNTBEGIN_VFSMOUNT
1511 static void server_umount_begin(struct vfsmount *vfsmnt, int flags)
1513 struct super_block *sb = vfsmnt->mnt_sb;
1515 static void server_umount_begin(struct super_block *sb)
1518 struct lustre_sb_info *lsi = s2lsi(sb);
1521 #ifdef HAVE_UMOUNTBEGIN_VFSMOUNT
1522 if (!(flags & MNT_FORCE)) {
1528 CDEBUG(D_MOUNT, "umount -f\n");
1529 /* umount = failover
1531 no third way to do non-force, non-failover */
1532 lsi->lsi_flags &= ~LSI_UMOUNT_FAILOVER;
1536 static int server_statfs (struct dentry *dentry, cfs_kstatfs_t *buf)
1538 struct super_block *sb = dentry->d_sb;
1539 struct lustre_sb_info *lsi = s2lsi(sb);
1540 struct obd_statfs statfs;
1544 if (lsi->lsi_dt_dev) {
1545 rc = dt_statfs(NULL, lsi->lsi_dt_dev, &statfs);
1547 statfs_unpack(buf, &statfs);
1548 buf->f_type = sb->s_magic;
1554 buf->f_type = sb->s_magic;
1555 buf->f_bsize = sb->s_blocksize;
1561 buf->f_namelen = NAME_MAX;
1565 /** The operations we support directly on the superblock:
1566 * mount, umount, and df.
1568 static struct super_operations server_ops =
1570 .put_super = server_put_super,
1571 .umount_begin = server_umount_begin, /* umount -f */
1572 .statfs = server_statfs,
1575 #define log2(n) cfs_ffz(~(n))
1576 #define LUSTRE_SUPER_MAGIC 0x0BD00BD1
1578 static int server_fill_super_common(struct super_block *sb)
1580 struct inode *root = 0;
1583 CDEBUG(D_MOUNT, "Server sb, dev=%d\n", (int)sb->s_dev);
1585 sb->s_blocksize = 4096;
1586 sb->s_blocksize_bits = log2(sb->s_blocksize);
1587 sb->s_magic = LUSTRE_SUPER_MAGIC;
1588 sb->s_maxbytes = 0; /* we don't allow file IO on server mountpoints */
1589 sb->s_flags |= MS_RDONLY;
1590 sb->s_op = &server_ops;
1592 root = new_inode(sb);
1594 CERROR("Can't make root inode\n");
1598 /* returns -EIO for every operation */
1599 /* make_bad_inode(root); -- badness - can't umount */
1600 /* apparently we need to be a directory for the mount to finish */
1601 root->i_mode = S_IFDIR;
1603 sb->s_root = d_alloc_root(root);
1605 CERROR("Can't make root dentry\n");
1613 static int osd_start(struct lustre_sb_info *lsi, unsigned long mflags)
1615 struct lustre_mount_data *lmd = lsi->lsi_lmd;
1616 struct obd_device *obd;
1617 struct dt_device_param p;
1623 "Attempting to start %s, type=%s, lsifl=%x, mountfl=%lx\n",
1624 lsi->lsi_svname, lsi->lsi_osd_type, lsi->lsi_flags, mflags);
1626 sprintf(lsi->lsi_osd_obdname, "%s-osd", lsi->lsi_svname);
1627 strcpy(lsi->lsi_osd_uuid, lsi->lsi_osd_obdname);
1628 strcat(lsi->lsi_osd_uuid, "_UUID");
1629 sprintf(flagstr, "%lu:%lu", mflags, (unsigned long) lmd->lmd_flags);
1631 obd = class_name2obd(lsi->lsi_osd_obdname);
1633 rc = lustre_start_simple(lsi->lsi_osd_obdname,
1635 lsi->lsi_osd_uuid, lmd->lmd_dev,
1636 flagstr, lsi->lsi_lmd->lmd_opts,
1640 obd = class_name2obd(lsi->lsi_osd_obdname);
1644 rc = obd_connect(NULL, &lsi->lsi_osd_exp, obd, &obd->obd_uuid, NULL, NULL);
1647 class_manual_cleanup(obd);
1648 lsi->lsi_dt_dev = NULL;
1651 /* XXX: to keep support old components relying on lsi_srv_mnt
1652 * we get this info from OSD just started */
1653 LASSERT(obd->obd_lu_dev);
1654 lsi->lsi_dt_dev = lu2dt_dev(obd->obd_lu_dev);
1655 LASSERT(lsi->lsi_dt_dev);
1657 dt_conf_get(NULL, lsi->lsi_dt_dev, &p);
1659 lsi->lsi_srv_mnt = p.ddp_mnt;
1665 /** Fill in the superblock info for a Lustre server.
1666 * Mount the device with the correct options.
1667 * Read the on-disk config file.
1668 * Start the services.
1670 static int server_fill_super(struct super_block *sb)
1672 struct lustre_sb_info *lsi = s2lsi(sb);
1676 rc = lsi_prepare(lsi);
1680 /* Start low level OSD */
1681 rc = osd_start(lsi, sb->s_flags);
1683 CERROR("Unable to start osd on %s: %d\n",
1684 lsi->lsi_lmd->lmd_dev, rc);
1689 CDEBUG(D_MOUNT, "Found service %s on device %s\n",
1690 lsi->lsi_svname, lsi->lsi_lmd->lmd_dev);
1692 if (class_name2obd(lsi->lsi_svname)) {
1693 LCONSOLE_ERROR_MSG(0x161, "The target named %s is already "
1694 "running. Double-mount may have compromised"
1695 " the disk journal.\n",
1701 /* Start MGS before MGC */
1702 if (IS_MGS(lsi) && !(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOMGS)){
1703 rc = server_start_mgs(sb);
1708 /* Start MGC before servers */
1709 rc = lustre_start_mgc(sb);
1713 /* Set up all obd devices for service */
1714 if (!(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOSVC) &&
1715 (IS_OST(lsi) || IS_MDT(lsi))) {
1716 rc = server_start_targets(sb, lsi->lsi_srv_mnt);
1718 CERROR("Unable to start targets: %d\n", rc);
1721 /* FIXME overmount client here,
1722 or can we just start a client log and client_fill_super on this sb?
1723 We need to make sure server_put_super gets called too - ll_put_super
1724 calls lustre_common_put_super; check there for LSI_SERVER flag,
1726 Probably should start client from new thread so we can return.
1727 Client will not finish until all servers are connected.
1728 Note - MGS-only server does NOT get a client, since there is no
1729 lustre fs associated - the MGS is for all lustre fs's */
1732 rc = server_fill_super_common(sb);
1738 /* We jump here in case of failure while starting targets or MGS.
1739 * In this case we can't just put @mnt and have to do real cleanup
1740 * with stoping targets, etc. */
1741 server_put_super(sb);
1746 * Calculate timeout value for a target.
1748 void server_calc_timeout(struct lustre_sb_info *lsi, struct obd_device *obd)
1750 struct lustre_mount_data *lmd;
1754 bool has_ir = !!(lsi->lsi_flags & LDD_F_IR_CAPABLE);
1755 int min = OBD_RECOVERY_TIME_MIN;
1757 LASSERT(IS_SERVER(lsi));
1761 soft = lmd->lmd_recovery_time_soft;
1762 hard = lmd->lmd_recovery_time_hard;
1763 has_ir = has_ir && !(lmd->lmd_flags & LMD_FLG_NOIR);
1764 obd->obd_no_ir = !has_ir;
1768 soft = OBD_RECOVERY_TIME_SOFT;
1770 hard = OBD_RECOVERY_TIME_HARD;
1772 /* target may have ir_factor configured. */
1773 factor = OBD_IR_FACTOR_DEFAULT;
1774 if (obd->obd_recovery_ir_factor)
1775 factor = obd->obd_recovery_ir_factor;
1778 int new_soft = soft;
1779 int new_hard = hard;
1781 /* adjust timeout value by imperative recovery */
1783 new_soft = (soft * factor) / OBD_IR_FACTOR_MAX;
1784 new_hard = (hard * factor) / OBD_IR_FACTOR_MAX;
1786 /* make sure the timeout is not too short */
1787 new_soft = max(min, new_soft);
1788 new_hard = max(new_soft, new_hard);
1790 LCONSOLE_INFO("%s: Imperative Recovery enabled, recovery "
1791 "window shrunk from %d-%d down to %d-%d\n",
1792 obd->obd_name, soft, hard, new_soft, new_hard);
1799 obd->obd_recovery_timeout = max(obd->obd_recovery_timeout, soft);
1800 obd->obd_recovery_time_hard = hard;
1801 obd->obd_recovery_ir_factor = factor;
1803 EXPORT_SYMBOL(server_calc_timeout);
1805 /*************** mount common betweeen server and client ***************/
1808 int lustre_common_put_super(struct super_block *sb)
1813 CDEBUG(D_MOUNT, "dropping sb %p\n", sb);
1815 /* Drop a ref to the MGC */
1816 rc = lustre_stop_mgc(sb);
1817 if (rc && (rc != -ENOENT)) {
1819 CERROR("Can't stop MGC: %d\n", rc);
1822 /* BUSY just means that there's some other obd that
1823 needs the mgc. Let him clean it up. */
1824 CDEBUG(D_MOUNT, "MGC still in use\n");
1826 /* Drop a ref to the mounted disk */
1831 EXPORT_SYMBOL(lustre_common_put_super);
1833 static void lmd_print(struct lustre_mount_data *lmd)
1837 PRINT_CMD(PRINT_MASK, " mount data:\n");
1838 if (lmd_is_client(lmd))
1839 PRINT_CMD(PRINT_MASK, "profile: %s\n", lmd->lmd_profile);
1840 PRINT_CMD(PRINT_MASK, "device: %s\n", lmd->lmd_dev);
1841 PRINT_CMD(PRINT_MASK, "flags: %x\n", lmd->lmd_flags);
1844 PRINT_CMD(PRINT_MASK, "options: %s\n", lmd->lmd_opts);
1846 if (lmd->lmd_recovery_time_soft)
1847 PRINT_CMD(PRINT_MASK, "recovery time soft: %d\n",
1848 lmd->lmd_recovery_time_soft);
1850 if (lmd->lmd_recovery_time_hard)
1851 PRINT_CMD(PRINT_MASK, "recovery time hard: %d\n",
1852 lmd->lmd_recovery_time_hard);
1854 for (i = 0; i < lmd->lmd_exclude_count; i++) {
1855 PRINT_CMD(PRINT_MASK, "exclude %d: OST%04x\n", i,
1856 lmd->lmd_exclude[i]);
1860 /* Is this server on the exclusion list */
1861 int lustre_check_exclusion(struct super_block *sb, char *svname)
1863 struct lustre_sb_info *lsi = s2lsi(sb);
1864 struct lustre_mount_data *lmd = lsi->lsi_lmd;
1869 rc = server_name2index(svname, &index, NULL);
1870 if (rc != LDD_F_SV_TYPE_OST)
1871 /* Only exclude OSTs */
1874 CDEBUG(D_MOUNT, "Check exclusion %s (%d) in %d of %s\n", svname,
1875 index, lmd->lmd_exclude_count, lmd->lmd_dev);
1877 for(i = 0; i < lmd->lmd_exclude_count; i++) {
1878 if (index == lmd->lmd_exclude[i]) {
1879 CWARN("Excluding %s (on exclusion list)\n", svname);
1886 /* mount -v -o exclude=lustre-OST0001:lustre-OST0002 -t lustre ... */
1887 static int lmd_make_exclusion(struct lustre_mount_data *lmd, char *ptr)
1889 char *s1 = ptr, *s2;
1890 __u32 index, *exclude_list;
1894 /* The shortest an ost name can be is 8 chars: -OST0000.
1895 We don't actually know the fsname at this time, so in fact
1896 a user could specify any fsname. */
1897 devmax = strlen(ptr) / 8 + 1;
1899 /* temp storage until we figure out how many we have */
1900 OBD_ALLOC(exclude_list, sizeof(index) * devmax);
1904 /* we enter this fn pointing at the '=' */
1905 while (*s1 && *s1 != ' ' && *s1 != ',') {
1907 rc = server_name2index(s1, &index, &s2);
1909 CERROR("Can't parse server name '%s'\n", s1);
1912 if (rc == LDD_F_SV_TYPE_OST)
1913 exclude_list[lmd->lmd_exclude_count++] = index;
1915 CDEBUG(D_MOUNT, "ignoring exclude %.7s\n", s1);
1917 /* now we are pointing at ':' (next exclude)
1918 or ',' (end of excludes) */
1919 if (lmd->lmd_exclude_count >= devmax)
1922 if (rc >= 0) /* non-err */
1925 if (lmd->lmd_exclude_count) {
1926 /* permanent, freed in lustre_free_lsi */
1927 OBD_ALLOC(lmd->lmd_exclude, sizeof(index) *
1928 lmd->lmd_exclude_count);
1929 if (lmd->lmd_exclude) {
1930 memcpy(lmd->lmd_exclude, exclude_list,
1931 sizeof(index) * lmd->lmd_exclude_count);
1934 lmd->lmd_exclude_count = 0;
1937 OBD_FREE(exclude_list, sizeof(index) * devmax);
1941 static int lmd_parse_mgssec(struct lustre_mount_data *lmd, char *ptr)
1946 if (lmd->lmd_mgssec != NULL) {
1947 OBD_FREE(lmd->lmd_mgssec, strlen(lmd->lmd_mgssec) + 1);
1948 lmd->lmd_mgssec = NULL;
1951 tail = strchr(ptr, ',');
1953 length = strlen(ptr);
1955 length = tail - ptr;
1957 OBD_ALLOC(lmd->lmd_mgssec, length + 1);
1958 if (lmd->lmd_mgssec == NULL)
1961 memcpy(lmd->lmd_mgssec, ptr, length);
1962 lmd->lmd_mgssec[length] = '\0';
1966 static int lmd_parse_string(char **handle, char *ptr)
1971 if ((handle == NULL) || (ptr == NULL))
1974 if (*handle != NULL) {
1975 OBD_FREE(*handle, strlen(*handle) + 1);
1979 tail = strchr(ptr, ',');
1981 length = strlen(ptr);
1983 length = tail - ptr;
1985 OBD_ALLOC(*handle, length + 1);
1986 if (*handle == NULL)
1989 memcpy(*handle, ptr, length);
1990 (*handle)[length] = '\0';
1995 /* Collect multiple values for mgsnid specifiers */
1996 static int lmd_parse_mgs(struct lustre_mount_data *lmd, char **ptr)
2004 /* Find end of nidlist */
2005 while (class_parse_nid_quiet(tail, &nid, &tail) == 0) {}
2006 length = tail - *ptr;
2008 LCONSOLE_ERROR_MSG(0x159, "Can't parse NID '%s'\n", *ptr);
2012 if (lmd->lmd_mgs != NULL)
2013 oldlen = strlen(lmd->lmd_mgs) + 1;
2015 OBD_ALLOC(mgsnid, oldlen + length + 1);
2019 if (lmd->lmd_mgs != NULL) {
2020 /* Multiple mgsnid= are taken to mean failover locations */
2021 memcpy(mgsnid, lmd->lmd_mgs, oldlen);
2022 mgsnid[oldlen - 1] = ':';
2023 OBD_FREE(lmd->lmd_mgs, oldlen);
2025 memcpy(mgsnid + oldlen, *ptr, length);
2026 mgsnid[oldlen + length] = '\0';
2027 lmd->lmd_mgs = mgsnid;
2033 /** Parse mount line options
2034 * e.g. mount -v -t lustre -o abort_recov uml1:uml2:/lustre-client /mnt/lustre
2035 * dev is passed as device=uml1:/lustre by mount.lustre
2037 static int lmd_parse(char *options, struct lustre_mount_data *lmd)
2039 char *s1, *s2, *devname = NULL;
2040 struct lustre_mount_data *raw = (struct lustre_mount_data *)options;
2046 LCONSOLE_ERROR_MSG(0x162, "Missing mount data: check that "
2047 "/sbin/mount.lustre is installed.\n");
2051 /* Options should be a string - try to detect old lmd data */
2052 if ((raw->lmd_magic & 0xffffff00) == (LMD_MAGIC & 0xffffff00)) {
2053 LCONSOLE_ERROR_MSG(0x163, "You're using an old version of "
2054 "/sbin/mount.lustre. Please install "
2055 "version %s\n", LUSTRE_VERSION_STRING);
2058 lmd->lmd_magic = LMD_MAGIC;
2060 OBD_ALLOC(lmd->lmd_params, 4096);
2061 if (lmd->lmd_params == NULL)
2063 lmd->lmd_params[0] = '\0';
2065 /* Set default flags here */
2070 int time_min = OBD_RECOVERY_TIME_MIN;
2072 /* Skip whitespace and extra commas */
2073 while (*s1 == ' ' || *s1 == ',')
2076 /* Client options are parsed in ll_options: eg. flock,
2079 /* Parse non-ldiskfs options here. Rather than modifying
2080 ldiskfs, we just zero these out here */
2081 if (strncmp(s1, "abort_recov", 11) == 0) {
2082 lmd->lmd_flags |= LMD_FLG_ABORT_RECOV;
2084 } else if (strncmp(s1, "recovery_time_soft=", 19) == 0) {
2085 lmd->lmd_recovery_time_soft = max_t(int,
2086 simple_strtoul(s1 + 19, NULL, 10), time_min);
2088 } else if (strncmp(s1, "recovery_time_hard=", 19) == 0) {
2089 lmd->lmd_recovery_time_hard = max_t(int,
2090 simple_strtoul(s1 + 19, NULL, 10), time_min);
2092 } else if (strncmp(s1, "noir", 4) == 0) {
2093 lmd->lmd_flags |= LMD_FLG_NOIR; /* test purpose only. */
2095 } else if (strncmp(s1, "nosvc", 5) == 0) {
2096 lmd->lmd_flags |= LMD_FLG_NOSVC;
2098 } else if (strncmp(s1, "nomgs", 5) == 0) {
2099 lmd->lmd_flags |= LMD_FLG_NOMGS;
2101 } else if (strncmp(s1, "noscrub", 7) == 0) {
2102 lmd->lmd_flags |= LMD_FLG_NOSCRUB;
2104 } else if (strncmp(s1, PARAM_MGSNODE,
2105 sizeof(PARAM_MGSNODE) - 1) == 0) {
2106 s2 = s1 + sizeof(PARAM_MGSNODE) - 1;
2107 /* Assume the next mount opt is the first
2108 invalid nid we get to. */
2109 rc = lmd_parse_mgs(lmd, &s2);
2113 } else if (strncmp(s1, "writeconf", 9) == 0) {
2114 lmd->lmd_flags |= LMD_FLG_WRITECONF;
2116 } else if (strncmp(s1, "virgin", 6) == 0) {
2117 lmd->lmd_flags |= LMD_FLG_VIRGIN;
2119 } else if (strncmp(s1, "noprimnode", 10) == 0) {
2120 lmd->lmd_flags |= LMD_FLG_NO_PRIMNODE;
2122 } else if (strncmp(s1, "mgssec=", 7) == 0) {
2123 rc = lmd_parse_mgssec(lmd, s1 + 7);
2127 /* ost exclusion list */
2128 } else if (strncmp(s1, "exclude=", 8) == 0) {
2129 rc = lmd_make_exclusion(lmd, s1 + 7);
2133 } else if (strncmp(s1, "mgs", 3) == 0) {
2135 lmd->lmd_flags |= LMD_FLG_MGS;
2137 } else if (strncmp(s1, "svname=", 7) == 0) {
2138 rc = lmd_parse_string(&lmd->lmd_profile, s1 + 7);
2142 } else if (strncmp(s1, "param=", 6) == 0) {
2144 char *tail = strchr(s1 + 6, ',');
2146 length = strlen(s1);
2150 strncat(lmd->lmd_params, s1 + 6, length);
2151 strcat(lmd->lmd_params, " ");
2153 } else if (strncmp(s1, "osd=", 4) == 0) {
2154 rc = lmd_parse_string(&lmd->lmd_osd_type, s1 + 4);
2159 /* Linux 2.4 doesn't pass the device, so we stuck it at the
2160 end of the options. */
2161 else if (strncmp(s1, "device=", 7) == 0) {
2163 /* terminate options right before device. device
2164 must be the last one. */
2170 s2 = strchr(s1, ',');
2178 memmove(s1, s2, strlen(s2) + 1);
2184 LCONSOLE_ERROR_MSG(0x164, "Can't find the device name "
2185 "(need mount option 'device=...')\n");
2189 s1 = strstr(devname, ":/");
2192 lmd->lmd_flags |= LMD_FLG_CLIENT;
2193 /* Remove leading /s from fsname */
2194 while (*++s1 == '/') ;
2195 /* Freed in lustre_free_lsi */
2196 OBD_ALLOC(lmd->lmd_profile, strlen(s1) + 8);
2197 if (!lmd->lmd_profile)
2199 sprintf(lmd->lmd_profile, "%s-client", s1);
2202 /* Freed in lustre_free_lsi */
2203 OBD_ALLOC(lmd->lmd_dev, strlen(devname) + 1);
2206 strcpy(lmd->lmd_dev, devname);
2208 /* Save mount options */
2209 s1 = options + strlen(options) - 1;
2210 while (s1 >= options && (*s1 == ',' || *s1 == ' '))
2212 if (*options != 0) {
2213 /* Freed in lustre_free_lsi */
2214 OBD_ALLOC(lmd->lmd_opts, strlen(options) + 1);
2217 strcpy(lmd->lmd_opts, options);
2221 lmd->lmd_magic = LMD_MAGIC;
2226 CERROR("Bad mount options %s\n", options);
2230 struct lustre_mount_data2 {
2232 struct vfsmount *lmd2_mnt;
2235 /** This is the entry point for the mount call into Lustre.
2236 * This is called when a server or client is mounted,
2237 * and this is where we start setting things up.
2238 * @param data Mount options (e.g. -o flock,abort_recov)
2240 int lustre_fill_super(struct super_block *sb, void *data, int silent)
2242 struct lustre_mount_data *lmd;
2243 struct lustre_mount_data2 *lmd2 = data;
2244 struct lustre_sb_info *lsi;
2248 CDEBUG(D_MOUNT|D_VFSTRACE, "VFS Op: sb %p\n", sb);
2250 lsi = lustre_init_lsi(sb);
2256 * Disable lockdep during mount, because mount locking patterns are
2262 * LU-639: the obd cleanup of last mount may not finish yet, wait here.
2264 obd_zombie_barrier();
2266 /* Figure out the lmd from the mount options */
2267 if (lmd_parse((char *)(lmd2->lmd2_data), lmd)) {
2269 GOTO(out, rc = -EINVAL);
2272 if (lmd_is_client(lmd)) {
2273 CDEBUG(D_MOUNT, "Mounting client %s\n", lmd->lmd_profile);
2274 if (!client_fill_super) {
2275 LCONSOLE_ERROR_MSG(0x165, "Nothing registered for "
2276 "client mount! Is the 'lustre' "
2277 "module loaded?\n");
2281 rc = lustre_start_mgc(sb);
2286 /* Connect and start */
2287 /* (should always be ll_fill_super) */
2288 rc = (*client_fill_super)(sb, lmd2->lmd2_mnt);
2289 /* c_f_s will call lustre_common_put_super on failure */
2292 CDEBUG(D_MOUNT, "Mounting server from %s\n", lmd->lmd_dev);
2293 rc = server_fill_super(sb);
2294 /* s_f_s calls lustre_start_mgc after the mount because we need
2295 the MGS nids which are stored on disk. Plus, we may
2296 need to start the MGS first. */
2297 /* s_f_s will call server_put_super on failure */
2300 /* If error happens in fill_super() call, @lsi will be killed there.
2301 * This is why we do not put it here. */
2305 CERROR("Unable to mount %s (%d)\n",
2306 s2lsi(sb) ? lmd->lmd_dev : "", rc);
2308 CDEBUG(D_SUPER, "Mount %s complete\n",
2316 /* We can't call ll_fill_super by name because it lives in a module that
2317 must be loaded after this one. */
2318 void lustre_register_client_fill_super(int (*cfs)(struct super_block *sb,
2319 struct vfsmount *mnt))
2321 client_fill_super = cfs;
2323 EXPORT_SYMBOL(lustre_register_client_fill_super);
2325 void lustre_register_kill_super_cb(void (*cfs)(struct super_block *sb))
2327 kill_super_cb = cfs;
2329 EXPORT_SYMBOL(lustre_register_kill_super_cb);
2331 /***************** FS registration ******************/
2332 #ifdef HAVE_FSTYPE_MOUNT
2333 struct dentry *lustre_mount(struct file_system_type *fs_type, int flags,
2334 const char *devname, void *data)
2336 struct lustre_mount_data2 lmd2 = { data, NULL };
2338 return mount_nodev(fs_type, flags, &lmd2, lustre_fill_super);
2341 int lustre_get_sb(struct file_system_type *fs_type, int flags,
2342 const char *devname, void * data, struct vfsmount *mnt)
2344 struct lustre_mount_data2 lmd2 = { data, mnt };
2346 return get_sb_nodev(fs_type, flags, &lmd2, lustre_fill_super, mnt);
2350 void lustre_kill_super(struct super_block *sb)
2352 struct lustre_sb_info *lsi = s2lsi(sb);
2354 if (kill_super_cb && lsi && !IS_SERVER(lsi))
2355 (*kill_super_cb)(sb);
2357 kill_anon_super(sb);
2360 /** Register the "lustre" fs type
2362 struct file_system_type lustre_fs_type = {
2363 .owner = THIS_MODULE,
2365 #ifdef HAVE_FSTYPE_MOUNT
2366 .mount = lustre_mount,
2368 .get_sb = lustre_get_sb,
2370 .kill_sb = lustre_kill_super,
2371 .fs_flags = FS_BINARY_MOUNTDATA | FS_REQUIRES_DEV |
2372 #ifdef FS_HAS_FIEMAP
2375 LL_RENAME_DOES_D_MOVE,
2378 int lustre_register_fs(void)
2380 return register_filesystem(&lustre_fs_type);
2383 int lustre_unregister_fs(void)
2385 return unregister_filesystem(&lustre_fs_type);
2388 EXPORT_SYMBOL(server_mti_print);