OBD_NOTIFY_OCD,
/* Sync request */
OBD_NOTIFY_SYNC_NONBLOCK,
- OBD_NOTIFY_SYNC
+ OBD_NOTIFY_SYNC,
+ /* Configuration event */
+ OBD_NOTIFY_CONFIG
};
/*
obd_starting:1, /* started setup */
obd_force:1, /* cleanup with > 0 obd refcount */
obd_fail:1, /* cleanup with failover */
- obd_async_recov:1; /* allow asyncronous orphan cleanup */
+ obd_async_recov:1, /* allow asyncronous orphan cleanup */
+ obd_no_conn:1; /* deny new connections */
atomic_t obd_refcount;
/* uuid-export hash body */
struct lustre_class_hash_body *obd_uuid_hash_body;
RETURN(-EINVAL);
}
- if (!OBP(obd, notify)) {
- CERROR("obd %s has no notify handler\n", obd->obd_name);
+ if (!OBP(obd, notify))
RETURN(-ENOSYS);
- }
OBD_COUNTER_INCREMENT(obd, notify);
RETURN(OBP(obd, notify)(obd, watched, ev, data));
/* end COMPAT_146 */
if (!target || target->obd_stopping || !target->obd_set_up) {
- DEBUG_REQ(D_ERROR, req, "UUID '%s' is not available "
- " for connect (%s)", str,
- !target ? "no target" :
- (target->obd_stopping ? "stopping" : "not set up"));
+ LCONSOLE_ERROR("UUID '%s' is not available "
+ " for connect (%s)", str,
+ !target ? "no target" :
+ (target->obd_stopping ? "stopping" :
+ "not set up"));
GOTO(out, rc = -ENODEV);
}
+ if (target->obd_no_conn) {
+ LCONSOLE_WARN("%s: temporarily refusing client connection "
+ "from %s\n", target->obd_name,
+ libcfs_nid2str(req->rq_peer.nid));
+ GOTO(out, rc = -EAGAIN);
+ }
+
/* Make sure the target isn't cleaned up while we're here. Yes,
there's still a race between the above check and our incref here.
Really, class_uuid2obd should take the ref. */
struct lprocfs_static_vars lvars;
struct lustre_cfg* lcfg = buf;
struct mds_obd *mds = &obd->u.mds;
+ struct lustre_sb_info *lsi;
struct lustre_mount_info *lmi;
struct vfsmount *mnt;
struct obd_uuid uuid;
__u8 *uuid_ptr;
- char *options, *str, *label;
+ char *str, *label;
char ns_name[48];
- unsigned long page;
int rc = 0;
ENTRY;
offsetof(struct obd_device, u.mds.mds_obt));
if (lcfg->lcfg_bufcount < 3)
- RETURN(rc = -EINVAL);
+ RETURN(-EINVAL);
if (LUSTRE_CFG_BUFLEN(lcfg, 1) == 0 || LUSTRE_CFG_BUFLEN(lcfg, 2) == 0)
- RETURN(rc = -EINVAL);
+ RETURN(-EINVAL);
lmi = server_get_mount(obd->obd_name);
- if (lmi) {
- /* We already mounted in lustre_fill_super.
- lcfg bufs 1, 2, 4 (device, fstype, mount opts) are ignored.*/
- struct lustre_sb_info *lsi = s2lsi(lmi->lmi_sb);
- fsoptions_to_mds_flags(mds, lsi->lsi_ldd->ldd_mount_opts);
- fsoptions_to_mds_flags(mds, lsi->lsi_lmd->lmd_opts);
- mnt = lmi->lmi_mnt;
- obd->obd_fsops = fsfilt_get_ops(MT_STR(lsi->lsi_ldd));
- } else {
- /* old path - used by lctl */
- CERROR("Using old MDS mount method\n");
- page = __get_free_page(GFP_KERNEL);
- if (!page)
- RETURN(-ENOMEM);
-
- options = (char *)page;
- memset(options, 0, CFS_PAGE_SIZE);
-
- /* here we use "iopen_nopriv" hardcoded, because it affects
- * MDS utility and the rest of options are passed by mount
- * options. Probably this should be moved to somewhere else
- * like startup scripts or lconf. */
- strcpy(options, "iopen_nopriv");
-
- if (LUSTRE_CFG_BUFLEN(lcfg, 4) > 0 && lustre_cfg_buf(lcfg, 4)) {
- sprintf(options + strlen(options), ",%s",
- lustre_cfg_string(lcfg, 4));
- fsoptions_to_mds_flags(mds, options);
- }
-
- 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);
- LCONSOLE_ERROR("Can't mount disk %s (%d)\n",
- lustre_cfg_string(lcfg, 1), rc);
- RETURN(rc);
- }
-
- obd->obd_fsops = fsfilt_get_ops(lustre_cfg_string(lcfg, 2));
+ if (!lmi) {
+ CERROR("Not mounted in lustre_fill_super?\n");
+ RETURN(-EINVAL);
}
+
+ /* We mounted in lustre_fill_super.
+ lcfg bufs 1, 2, 4 (device, fstype, mount opts) are ignored.*/
+ lsi = s2lsi(lmi->lmi_sb);
+ fsoptions_to_mds_flags(mds, lsi->lsi_ldd->ldd_mount_opts);
+ fsoptions_to_mds_flags(mds, lsi->lsi_lmd->lmd_opts);
+ mnt = lmi->lmi_mnt;
+ obd->obd_fsops = fsfilt_get_ops(MT_STR(lsi->lsi_ldd));
if (IS_ERR(obd->obd_fsops))
GOTO(err_put, rc = PTR_ERR(obd->obd_fsops));
lov_name, rc);
GOTO(err_discon, rc);
}
+
+ /* Deny new client connections until we are sure we have some OSTs */
+ obd->obd_no_conn = 1;
rc = mds_lov_read_objids(obd);
if (rc) {
case OBD_NOTIFY_SYNC:
case OBD_NOTIFY_SYNC_NONBLOCK:
break;
+ case OBD_NOTIFY_CONFIG:
+ /* Open for clients */
+ obd->obd_no_conn = 0;
default:
RETURN(0);
}
obd_iocontrol(OBD_IOC_ABORT_RECOVERY,
obd->obd_self_export, 0, NULL, NULL);
}
+
+ /* log has been fully processed */
+ obd_notify(obd, NULL, OBD_NOTIFY_CONFIG, 0);
}
RETURN(rc);
$TUNEFS $TMP/$tdir/mds || error "tunefs failed"
# nids are wrong, so client wont work, but server should start
- start mds $TMP/$tdir/mds "-o loop" || return 3
+ start mds $TMP/$tdir/mds "-o loop,exclude=lustre-OST0000" || return 3
local UUID=$(cat $LPROC/mds/lustre-MDT0000/uuid)
echo MDS uuid $UUID
[ "$UUID" == "mdsA_UUID" ] || error "UUID is wrong: $UUID"
# With a new good MDT failover nid, we should be able to mount a client
# (but it cant talk to OST)
+ local OLDMOUNTOPT=$MOUNTOPT
+ MOUNTOPT="exclude=lustre-OST0000"
mount_client $MOUNT
+ MOUNTOPT=$OLDMOUNTOPT
set_and_check "cat $LPROC/mdc/*/max_rpcs_in_flight" "lustre-MDT0000.mdc.max_rpcs_in_flight" || return 11
zconf_umount `hostname` $MOUNT -f
# mount a second time to make sure we didnt leave upgrade flag on
$TUNEFS --dryrun $TMP/$tdir/mds || error "tunefs failed"
- start mds $TMP/$tdir/mds "-o loop" || return 12
+ start mds $TMP/$tdir/mds "-o loop,exclude=lustre-OST0000" || return 12
cleanup_nocli
[ -d $TMP/$tdir ] && rm -rf $TMP/$tdir