struct mgc_obd *mgc = &obd->u.mgc;
int rc;
- rc = llog_cleanup(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT));
-
- // FIXME REPL rc = obd_llog_finish(obd, 0);
- if (rc != 0)
- CERROR("failed to cleanup llogging subsystems\n");
//lprocfs_obd_cleanup(obd);
- //rc = mgc_obd_cleanup(obd);
+ rc = mgc_obd_cleanup(obd);
if (mgc->mgc_vfsmnt) {
/* if we're a server, eg. something's mounted */
CERROR("mount_put failed %d\n", rc);
}
+ rc = obd_llog_finish(obd, 0);
+ if (rc != 0)
+ CERROR("failed to cleanup llogging subsystems\n");
+
ptlrpcd_decref();
OBD_FREE(mgc->mgc_rpc_lock, sizeof (*mgc->mgc_rpc_lock));
+
return(rc);
}
CERROR("fs setup failed %d\n", rc);
mgc_cleanup(obd);
RETURN(-ENOENT);
- GOTO(err_rpc_lock, rc);
}
} 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);
+ if (rc) {
+ mgc_cleanup(obd);
+ RETURN(-ENOENT);
+ }
}
RETURN(rc);
ENTRY;
rc = llog_cleanup(llog_get_context(obd, LLOG_CONFIG_REPL_CTXT));
+ rc = llog_cleanup(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT));
+
RETURN(rc);
}
-/*mgc_obd_setup for mount-conf*/
+/* create a mgs client */
int mgc_obd_setup(struct obd_device *obddev, obd_count len, void *buf)
{
struct lustre_cfg* lcfg = buf;
OBD_ALLOC(sbi, sizeof(*sbi));
if (!sbi)
- RETURN(NULL);
+ return(NULL);
+ OBD_ALLOC(sbi->lsi_lmd, sizeof(*sbi->lsi_lmd));
+ if (!sbi->lsi_lmd) {
+ OBD_FREE(sbi, sizeof(*sbi));
+ return(NULL);
+ }
s2sbi_nocast(sb) = sbi;
atomic_set(&sbi->lsi_mounts, 0);
if (sbi != NULL) {
if (sbi->lsi_ldd != NULL)
OBD_FREE(sbi->lsi_ldd, sizeof(*sbi->lsi_ldd));
- if (sbi->lsi_lmd != NULL)
+ if (sbi->lsi_lmd != NULL) {
+ if (sbi->lsi_lmd->lmd_dev != NULL)
+ OBD_FREE(sbi->lsi_lmd->lmd_dev,
+ strlen(sbi->lsi_lmd->lmd_dev) + 1);
+ if (sbi->lsi_lmd->lmd_opts != NULL)
+ OBD_FREE(sbi->lsi_lmd->lmd_opts,
+ strlen(sbi->lsi_lmd->lmd_opts) + 1);
OBD_FREE(sbi->lsi_lmd, sizeof(*sbi->lsi_lmd));
+ }
LASSERT(sbi->lsi_llsbi == NULL);
OBD_FREE(sbi, sizeof(*sbi));
s2sbi_nocast(sb) = NULL;
int i;
for (i = 0; i < lmd->lmd_mgsnid_count; i++)
- CERROR("nid %d: %s\n", i, libcfs_nid2str(lmd->lmd_mgsnid[i]));
- CERROR("fsname: %s\n", lmd->lmd_dev);
- CERROR("options: %s\n", lmd->lmd_opts);
-
+ CERROR("nid %d: %s\n", i, libcfs_nid2str(lmd->lmd_mgsnid[i]));
+ if (lmd_is_client(lmd))
+ CERROR("fsname: %s\n", lmd->lmd_dev);
+ else
+ CERROR("device: %s\n", lmd->lmd_dev);
+ CERROR("options: %s\n", lmd->lmd_opts);
}
-static int parse_lmd(char *devname, char *options,
- struct lustre_mount_data *lmd)
+static int parse_lmd(char *options, struct lustre_mount_data *lmd)
{
- char *s1, *s2;
+ char *s1, *s2, *devname;
+ ENTRY;
+
+ /* Linux 2.4 doesn't pass the device, so we stuck it at the end of
+ the options. */
+ s1 = strstr(options, ",device=");
+ if (s1) {
+ devname = s1 + 8; /* strlen(",device=") */
+ *s1 = 0; /* cut it out of the options */
+ } else {
+ LCONSOLE_ERROR("Can't find device name\n");
+ goto invalid;
+ }
+
if (strchr(devname, ',')) {
LCONSOLE_ERROR("No commas are allowed in the device name\n");
goto invalid;
}
+
s1 = devname;
+ /* Get MGS nids if client mount */
while ((s2 = strchr(s1, ':'))) {
lnet_nid_t nid;
*s2 = 0;
s1 = s2 + 1;
}
- while (*++s1 == '/')
- ;
-
- if (strlen(s1) > sizeof(lmd->lmd_dev)) {
- LCONSOLE_ERROR("Filesystem name too long: '%s'\n", s1);
+ if (lmd_is_client(lmd)) {
+ /* Remove leading /s from fsname */
+ while (*++s1 == '/')
+ ;
+ }
+
+ if (!strlen(s1)) {
+ LCONSOLE_ERROR("No filesytem specified\n");
goto invalid;
}
+
+ /* freed in lustre_free_sbi */
+ OBD_ALLOC(lmd->lmd_dev, strlen(s1) + 1);
+ if (!lmd->lmd_dev)
+ RETURN(-ENOMEM);
strcpy(lmd->lmd_dev, s1);
- if (strlen(options) > sizeof(lmd->lmd_opts)) {
- LCONSOLE_ERROR("Options string too long: '%s'\n", options);
- goto invalid;
+ if (strlen(options)) {
+ /* freed in lustre_free_sbi */
+ OBD_ALLOC(lmd->lmd_opts, strlen(options) + 1);
+ if (!lmd->lmd_opts)
+ RETURN(-ENOMEM);
+ strcpy(lmd->lmd_opts, options);
}
- strcpy(lmd->lmd_opts, options);
lmd->lmd_magic = LMD_MAGIC;
print_lmd(lmd);
- return 0;
+ RETURN(0);
invalid:
- return -EINVAL;
+ RETURN(-EINVAL);
}
/* Common mount */
int lustre_fill_super(struct super_block *sb, void *data, int silent)
{
- struct lustre_mount_data * lmd = data;
+ struct lustre_mount_data *lmd;
struct lustre_sb_info *sbi;
int err;
ENTRY;
CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
- if (lmd_bad_magic(lmd))
- RETURN(-EINVAL);
-
+
sbi = lustre_init_sbi(sb);
- if (!sbi)
+ if (!sbi)
RETURN(-ENOMEM);
+ lmd = sbi->lsi_lmd;
- /* save mount data */
- OBD_ALLOC(sbi->lsi_lmd, sizeof(*sbi->lsi_lmd));
- if (sbi->lsi_lmd == NULL) {
+ /* Figure out the lmd from the mount options */
+ if (parse_lmd((char *)data, lmd)) {
lustre_free_sbi(sb);
- RETURN(-ENOMEM);
+ RETURN(-EINVAL);
+ }
+ if (lmd_bad_magic(lmd)) {
+ lustre_free_sbi(sb);
+ RETURN(-EINVAL);
}
- memcpy(sbi->lsi_lmd, lmd, sizeof(*lmd));
-
if (lmd_is_client(lmd)) {
if (!client_fill_super) {
CERROR("Nothing registered for client_fill_super!\n"
} else {
CERROR("Mounting server\n");
err = server_fill_super(sb);
+ /* calls lustre_start_mgc */
}
if (err){
struct super_block * lustre_get_sb(struct file_system_type *fs_type,
int flags, const char *devname, void * data)
{
- struct lustre_mount_data lmd;
-
- if (((struct lustre_mount_data *)data)->lmd_magic == LMD_MAGIC ) {
- /* mount.lustre is sending lmd */
- CERROR("Using mount.lustre's lmd\n");
- return get_sb_nodev(fs_type, flags, data, lustre_fill_super);
- }
-
- /* Figure out the lmd from the mount line */
- if (parse_lmd((char *)devname, (char *)data, &lmd))
- return ERR_PTR(-EINVAL);
-
/* calls back in fill super */
- return get_sb_nodev(fs_type, flags, (void *)&lmd, lustre_fill_super);
+ return get_sb_nodev(fs_type, flags, data, lustre_fill_super);
}
struct file_system_type lustre_fs_type = {
static struct super_block *lustre_read_super(struct super_block *sb,
void *data, int silent)
{
- //FIXME need the device for the lmd!!
int err;
ENTRY;
+
err = lustre_fill_super(sb, data, silent);
if (err)
RETURN(NULL);
mkdir -p $MDIR
-cp ../../portals/libcfs/libcfs.$EXT $MDIR
-cp ../../portals/portals/portals.$EXT $MDIR
-cp ../../portals/knals/socknal/ksocknal.$EXT $MDIR
+cp ../../lnet/libcfs/libcfs.$EXT $MDIR
+cp ../../lnet/lnet/lnet.$EXT $MDIR
+cp ../../lnet/klnds/socklnd/ksocklnd.$EXT $MDIR
cp ../lvfs/lvfs.$EXT $MDIR
cp ../obdclass/obdclass.$EXT $MDIR
cp ../ptlrpc/ptlrpc.$EXT $MDIR
MPI="$MP --ignore-install"
[ -e $MODFILE ] || touch $MODFILE
-if [ `grep -c lustre $MODFILE` -eq 0 ]; then
+if [ `egrep -c "lustre|lnet" $MODFILE` -eq 0 ]; then
echo Modifying $MODFILE
echo "# Lustre modules added by $0" >> $MODFILE
+ echo "# Networking options, see /sys/module/lnet/parameters" >> $MODFILE
+ echo "options lnet networks=tcp" >> $MODFILE
+ echo "# for zeroconf clients" >> $MODFILE
if [ $KVER -eq 24 ]; then
- echo alias _lustre ksocknal >> $MODFILE
- echo add above _lustre mgc $FSFLT portals >> $MODFILE
- echo add below mds _lustre osc lov >> $MODFILE
- echo add below ost _lustre >> $MODFILE
- echo add below llite _lustre osc mdc lov >> $MODFILE
- echo alias lustre llite >> $MODFILE
+ echo "add below llite lov osc" >> $MODFILE
else
- echo "install kptlrouter $MP portals && $MPI kptlrouter" >> $MODFILE
- echo "install _lustre $MP portals && $MP lvfs && $MP obdclass && $MP ptlrpc && $MP mgc" >> $MODFILE
- echo "install obdfilter $MP _lustre && $MP ost && $MP ldiskfs && $MP $FSFLT && $MPI obdfilter" >> $MODFILE
- echo "install ost $MP _lustre && $MPI ost" >> $MODFILE
- echo "install mds $MP _lustre && $MP osc && $MP lov && $MPI mds" >> $MODFILE
- echo "install llite $MP _lustre && $MP osc && $MP mdc && $MP lov && $MPI llite" >> $MODFILE
- echo "alias lustre llite" >> $MODFILE
+ echo "install llite $MP lov; $MP osc; $MPI llite" >> $MODFILE
fi
+ echo "alias lustre llite" >> $MODFILE
echo "# end Lustre modules" >> $MODFILE
fi
-
int main(int argc, char *const argv[])
{
- char *source, *target, *options = "";
- int i, nargs = 3, opt, rc, flags;
- struct lustre_mount_data lmd;
+ char *source, *target, *options = "", *optcopy;
+ int i, nargs = 3, opt, rc, flags, optlen;
static struct option long_opt[] = {
{"fake", 0, 0, 'f'},
{"force", 0, 0, 1},
return rc;
}
+ /* In Linux 2.4, the target device doesn't get passed to any of our
+ functions. So we'll stick it on the end of the options. */
+ optlen = strlen(options) + strlen(",device=") + strlen(target);
+ optcopy = malloc(optlen);
+ strcpy(optcopy, options);
+ strcat(optcopy, ",device=");
+ strcat(optcopy, source);
+
if (!fake)
/* flags and target get to lustre_get_sb, but not
lustre_fill_super. Lustre ignores the flags, but mount
does not. */
- rc = mount(source, target, "lustre", flags, (void *)options);
+ rc = mount(source, target, "lustre", flags, (void *)optcopy);
if (rc) {
fprintf(stderr, "%s: mount(%s, %s) failed: %s\n", progname,
source, target, strerror(errno));
rc = update_mtab_entry(source, target, "lustre", options,0,0,0);
}
+ free(optcopy);
return rc;
}