Whamcloud - gitweb
Branch b1_4_mountconf
authornathan <nathan>
Tue, 1 Nov 2005 19:00:14 +0000 (19:00 +0000)
committernathan <nathan>
Tue, 1 Nov 2005 19:00:14 +0000 (19:00 +0000)
b=8013,8010
mount using string instead of lmd

lustre/include/linux/lustre_disk.h
lustre/lov/lov_obd.c
lustre/obdclass/obd_mount.c
lustre/utils/mkfs_lustre.c
lustre/utils/mount_lustre.c

index 8c956c9..a59372c 100644 (file)
@@ -65,19 +65,15 @@ static inline char *mt_str(enum ldd_mount_type mt)
         return mount_type_string[mt];
 }
 
-struct host_desc {
-        lnet_nid_t primary; 
-        lnet_nid_t backup;
-};
+#define MAX_FAILOVER_NIDS 10
 
 struct lustre_disk_data {
-        __u32     ldd_magic;
-        __u32     ldd_flags;                 /* LDD_SV_TYPE */
-        char      ldd_fsname[64];            /* filesystem this server is part of */
-        char      ldd_svname[64];            /* this server's name (lustre-mdt0001) */
-        char      ldd_mount_opts[128];       /* target fs mount opts */
-        //fixme just make this a string
-        struct host_desc    ldd_mgmtnid;     /* mgmt nid; lmd can override */
+        __u32      ldd_magic;
+        __u32      ldd_flags;           /* LDD_SV_TYPE */
+        char       ldd_fsname[64];      /* filesystem this server is part of */
+        char       ldd_svname[64];      /* this server's name (lustre-mdt0001) */
+        char       ldd_mount_opts[128]; /* target fs mount opts */
+        lnet_nid_t ldd_mgsnid[MAX_FAILOVER_NIDS]; /* mgmt nid list; lmd can override */
         enum ldd_mount_type ldd_mount_type;  /* target fs type LDD_MT_* */
         //server failover list - must pass to mgs when we first register
 };
@@ -88,24 +84,23 @@ struct lustre_disk_data {
 #define MT_STR(data)   mt_str((data)->ldd_mount_type)
 
 /****************** mount command *********************/
-#define MAX_FAILOVER_LIST 10
 
-/* Passed by mount - no persistent info here */
+/* gleaned from the mount command - no persistent info here */
 struct lustre_mount_data {
         __u32      lmd_magic;
         __u32      lmd_flags;         /* lustre mount flags */
         __u16      lmd_mgsnid_count;  /* how many failover nids we have for the MGS */
-        lnet_nid_t lmd_mgsnid[MAX_FAILOVER_LIST];  /* who to contact at startup */
-        //struct lustre_disk_data *lmd_ldd; /* in-mem copy of ldd */
+        lnet_nid_t lmd_mgsnid[MAX_FAILOVER_NIDS];  /* who to contact at startup */
         char      *lmd_dev;           /* device or file system name */
         char      *lmd_opts;          /* lustre mount options (as opposed to 
                                          _device_ mount options) */
 };
 
-#define LMD_FLG_FLOCK   0x0001  /* Enable flock */
-#define LMD_FLG_RECOVER 0x0002  /* Allow recovery */
-#define LMD_FLG_MNTCNF  0x1000  /* MountConf compat */
-#define LMD_FLG_CLIENT  0x2000  /* Mounting a client only; no real device */
+#define LMD_FLG_FLOCK        0x0001  /* Enable flock */
+#define LMD_FLG_USER_XATTR   0x0002  /* Enable extended attributes */
+#define LMD_FLG_RECOVER      0x0004  /* Allow recovery */
+#define LMD_FLG_MNTCNF       0x1000  /* MountConf compat */
+#define LMD_FLG_CLIENT       0x2000  /* Mounting a client only; no real device */
 
 /* 2nd half is for old clients */
 #define lmd_is_client(x) \
index 4303589..6c4f89a 100644 (file)
@@ -278,7 +278,7 @@ static int lov_disconnect(struct obd_export *exp)
         for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count; i++, tgt++) {
                 if (tgt->ltd_exp) {
                         /* Disconnect and delete from list */
-                        lov_del_obd(obd, &obd->obd_uuid, i, tgt->ltd_gen);
+                        lov_del_obd(obd, &tgt->uuid, i, tgt->ltd_gen);
                         /* Cleanup the osc now - can't do it from 
                            lov_cleanup because we lose our only reference to 
                            it right now. */ 
index 9b1e5c2..114eba5 100644 (file)
@@ -992,27 +992,54 @@ static void print_lmd(struct lustre_mount_data *lmd)
                 CERROR("fsname:  %s\n", lmd->lmd_dev);
         else
                 CERROR("device:  %s\n", lmd->lmd_dev);
+        CERROR("flags:   %x\n", lmd->lmd_flags);
         CERROR("options: %s\n", lmd->lmd_opts);
 }
 
 static int parse_lmd(char *options, struct lustre_mount_data *lmd)
 {
-        char *s1, *s2, *devname;
+        char *s1, *s2, *devname = NULL;
         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 {
+        if (!options || !lmd) 
+                goto invalid;
+
+        /* default flags */
+        lmd->lmd_flags |= LMD_FLG_MNTCNF | LMD_FLG_RECOVER;
+
+        s1 == options;
+        while(*s1) {
+                while (*s1 == ' ')
+                        s1++;
+                if (strncmp(s1, "flock", 5) == 0)
+                        lmd->lmd_flags |= LMD_FLG_FLOCK;
+                if (strncmp(s1, "noflock", 7) == 0)
+                        lmd->lmd_flags &= ~LMD_FLG_FLOCK;
+                if (strncmp(s1, "user_xattr", 10) == 0)
+                        lmd->lmd_flags |= LMD_FLG_USER_XATTR;
+                if (strncmp(s1, "nouser_xattr", 12) == 0)
+                        lmd->lmd_flags &= ~LMD_FLG_USER_XATTR;
+                if (strncmp(s1, "recov", 5) == 0)
+                        lmd->lmd_flags |= LMD_FLG_RECOVER;
+                if (strncmp(s1, "norecov", 7) == 0)
+                        lmd->lmd_flags &= ~LMD_FLG_RECOVER;
+                /* Linux 2.4 doesn't pass the device, so we stuck it at the 
+                   end of the options. */
+                if (strncmp(s1, "device=", 7) == 0)
+                        devname = s1 + 7;
+                s2 = strstr(s1, ',');
+                if (s2 == NULL) 
+                        break;
+                s1 = s2 + 1;
+        }
+
+        if (!devname) {
                 LCONSOLE_ERROR("Can't find device name\n");
                 goto invalid;
         }
 
         if (strchr(devname, ',')) {
-                LCONSOLE_ERROR("No commas are allowed in the device name\n");
+                LCONSOLE_ERROR("Device name must be the final option\n");
                 goto invalid;
         }
 
@@ -1143,6 +1170,8 @@ struct super_block * lustre_get_sb(struct file_system_type *fs_type,
                                int flags, const char *devname, void * data)
 {
         /* calls back in fill super */
+        /* we could append devname= onto options (*data) here, 
+           but 2.4 doesn't get devname.  So we do it in mount_lustre.c */
         return get_sb_nodev(fs_type, flags, data, lustre_fill_super);
 }
 
index 247bd87..58dad56 100644 (file)
@@ -99,6 +99,8 @@ static void fatal(void)
         fprintf(stderr, "\n%s FATAL: ", progname);
 }
 
+/*================ utility functions =====================*/
+
 inline unsigned int 
 dev_major (unsigned long long int __dev)
 {
@@ -135,6 +137,39 @@ int get_os_version()
         return version;
 }
 
+static int load_module(char *module_name)
+{
+        char buf[256];
+        int rc;
+        
+        vprint("loading %s\n", module_name);
+        sprintf(buf, "/sbin/modprobe %s", module_name);
+        rc = system(buf);
+        if (rc) {
+                fprintf(stderr, "%s: failed to modprobe %s (%d)\n", 
+                        progname, module_name, rc);
+                fprintf(stderr, "Check /etc/modules.conf\n");
+        }
+        return rc;
+}
+
+static int load_modules(struct mkfs_opts *mop)
+{
+        int rc = 0;
+
+        //client: rc = load_module("lustre");
+        vprint("Loading modules...");
+
+        /* portals, ksocknal, fsfilt, etc. in modules.conf */
+        rc = load_module("_lustre");
+        if (rc) return rc;
+
+        /* FIXME currently use the MDT to write llogs, should be a MGS */
+        rc = load_module("mds");
+        vprint("done\n");
+        return rc;
+}
+
 //Ugly implement. FIXME 
 int run_command(char *cmd)
 {
@@ -180,6 +215,8 @@ static void run_command_out()
         }
 }
 
+/*============ disk dev functions ===================*/
+
 /* Setup a file in the first unused loop_device */
 int loop_setup(struct mkfs_opts *mop)
 {
@@ -281,92 +318,6 @@ __u64 get_device_size(char* device)
         return size;
 }
 
-void set_nid_pair(struct host_desc *nids, char *str)
-{
-        nids->primary = libcfs_str2nid(str);
-        // FIXME secondary too (,altnid)
-}
-
-/* Write the server config files */
-int write_local_files(struct mkfs_opts *mop)
-{
-        struct lr_server_data lsd;
-        char mntpt[] = "/tmp/mntXXXXXX";
-        char filepnm[128];
-        char *dev;
-        FILE *filep;
-        int ret = 0;
-
-        /* Mount this device temporarily in order to write these files */
-        vprint("mounting backing device\n");
-        if (!mkdtemp(mntpt)) {
-                fprintf(stderr, "Can't create temp mount point %s: %s\n",
-                        mntpt, strerror(errno));
-                return errno;
-        }
-
-        dev = mop->mo_device;
-        if (mop->mo_flags & MO_IS_LOOP) 
-                dev = mop->mo_loopdev;
-        
-        ret = mount(dev, mntpt, MT_STR(&mop->mo_ldd), 0, NULL);
-        if (ret) {
-                fprintf(stderr, "Unable to mount %s: %s\n", mop->mo_device,
-                        strerror(ret));
-                goto out_rmdir;
-        }
-
-        /* Set up initial directories */
-        sprintf(filepnm, "%s/%s", mntpt, MOUNT_CONFIGS_DIR);
-        ret = mkdir(filepnm, 0777);
-        if (ret) {
-                fprintf(stderr, "Can't make configs dir %s (%d)\n", 
-                        filepnm, ret);
-                goto out_umnt;
-        }
-
-        /* Save the persistent mount data into a file. Lustre must pre-read
-           this file to get the real mount options. */
-        vprint("Writing %s\n", MOUNT_DATA_FILE);
-        sprintf(filepnm, "%s/%s", mntpt, MOUNT_DATA_FILE);
-        filep = fopen(filepnm, "w");
-        if (!filep) {
-                fprintf(stderr, "Unable to create %s file\n", filepnm);
-                goto out_umnt;
-        }
-        fwrite(&mop->mo_ldd, sizeof(mop->mo_ldd), 1, filep);
-        fclose(filep);
-        
-        /* Create the inital last_rcvd file */
-        vprint("Writing %s\n", LAST_RCVD);
-        sprintf(filepnm, "%s/%s", mntpt, LAST_RCVD);
-        filep = fopen(filepnm, "w");
-        if (!filep) {
-                ret = errno;
-                fprintf(stderr,"Unable to create %s file\n", filepnm);
-                goto out_umnt;
-        }
-        memset(&lsd, 0, sizeof(lsd));
-        strncpy(lsd.lsd_uuid, mop->mo_ldd.ldd_svname, sizeof(lsd.lsd_uuid));
-        lsd.lsd_index = mop->mo_index;
-        lsd.lsd_feature_compat |= cpu_to_le32(LR_COMPAT_COMMON_LR);
-        lsd.lsd_server_size = cpu_to_le32(LR_SERVER_SIZE);
-        lsd.lsd_client_start = cpu_to_le32(LR_CLIENT_START);
-        lsd.lsd_client_size = cpu_to_le16(LR_CLIENT_SIZE);
-        if (IS_MDT(&mop->mo_ldd))
-                lsd.lsd_feature_rocompat = cpu_to_le32(MDS_ROCOMPAT_LOVOBJID);
-        
-        fwrite(&lsd, sizeof(lsd), 1, filep);
-        ret = 0;
-        fclose(filep);
-out_umnt:
-        vprint("unmounting backing device\n");
-        umount(mntpt);    
-out_rmdir:
-        rmdir(mntpt);
-        return ret;
-}
-
 int loop_format(struct mkfs_opts *mop)
 {
         int ret = 0;
@@ -476,8 +427,8 @@ int make_lustre_backfs(struct mkfs_opts *mop)
                         mop->mo_ldd.ldd_svname);
 
         } else if (mop->mo_ldd.ldd_mount_type == LDD_MT_REISERFS) {
-                long journal_sz = 0;
-                if (journal_sz > 0) { /* FIXME */
+                long journal_sz = 0; /* FIXME default journal size */
+                if (journal_sz > 0) { 
                         sprintf(buf, " --journal_size %ld", journal_sz);
                         strcat(mop->mo_mkfsopts, buf);
                 }
@@ -523,37 +474,105 @@ out:
         return ret;
 }
 
-static int load_module(char *module_name)
+/* ==================== Lustre config functions =============*/
+
+void print_ldd(struct lustre_disk_data *ldd)
 {
-        char buf[256];
-        int rc;
-        
-        vprint("loading %s\n", module_name);
-        sprintf(buf, "/sbin/modprobe %s", module_name);
-        rc = system(buf);
-        if (rc) {
-                fprintf(stderr, "%s: failed to modprobe %s (%d)\n", 
-                        progname, module_name, rc);
-                fprintf(stderr, "Check /etc/modules.conf\n");
+        int count = 0;
+        printf("Permanent disk data:\n");
+        printf("Server:     %s\n", ldd->ldd_svname);
+        printf("Lustre FS:  %s\n", ldd->ldd_fsname);
+        printf("Mount type: %s\n", MT_STR(ldd));
+        printf("Persistent mount opts: %s\n", ldd->ldd_mount_opts);
+        printf("MGS nids:");
+        while (count < MAX_FAILOVER_NIDS) {
+                if (ldd->ldd_mgsnid[count] == LNET_NID_ANY)
+                        break;
+                printf("%c %s", (count == 0) ? ' ' : ',',
+                       libcfs_nid2str(ldd->ldd_mgsnid[count]));
+                count++;
         }
-        return rc;
+        printf("\n");
 }
 
-static int load_modules(struct mkfs_opts *mop)
+/* Write the server config files */
+int write_local_files(struct mkfs_opts *mop)
 {
-        int rc = 0;
+        struct lr_server_data lsd;
+        char mntpt[] = "/tmp/mntXXXXXX";
+        char filepnm[128];
+        char *dev;
+        FILE *filep;
+        int ret = 0;
 
-        //client: rc = load_module("lustre");
-        vprint("Loading modules...");
+        /* Mount this device temporarily in order to write these files */
+        vprint("mounting backing device\n");
+        if (!mkdtemp(mntpt)) {
+                fprintf(stderr, "Can't create temp mount point %s: %s\n",
+                        mntpt, strerror(errno));
+                return errno;
+        }
 
-        /* portals, ksocknal, fsfilt, etc. in modules.conf */
-        rc = load_module("_lustre");
-        if (rc) return rc;
+        dev = mop->mo_device;
+        if (mop->mo_flags & MO_IS_LOOP) 
+                dev = mop->mo_loopdev;
+        
+        ret = mount(dev, mntpt, MT_STR(&mop->mo_ldd), 0, NULL);
+        if (ret) {
+                fprintf(stderr, "Unable to mount %s: %s\n", mop->mo_device,
+                        strerror(ret));
+                goto out_rmdir;
+        }
 
-        /* FIXME currently use the MDT to write llogs, should be a MGS */
-        rc = load_module("mds");
-        vprint("done\n");
-        return rc;
+        /* Set up initial directories */
+        sprintf(filepnm, "%s/%s", mntpt, MOUNT_CONFIGS_DIR);
+        ret = mkdir(filepnm, 0777);
+        if (ret) {
+                fprintf(stderr, "Can't make configs dir %s (%d)\n", 
+                        filepnm, ret);
+                goto out_umnt;
+        }
+
+        /* Save the persistent mount data into a file. Lustre must pre-read
+           this file to get the real mount options. */
+        vprint("Writing %s\n", MOUNT_DATA_FILE);
+        sprintf(filepnm, "%s/%s", mntpt, MOUNT_DATA_FILE);
+        filep = fopen(filepnm, "w");
+        if (!filep) {
+                fprintf(stderr, "Unable to create %s file\n", filepnm);
+                goto out_umnt;
+        }
+        fwrite(&mop->mo_ldd, sizeof(mop->mo_ldd), 1, filep);
+        fclose(filep);
+        
+        /* Create the inital last_rcvd file */
+        vprint("Writing %s\n", LAST_RCVD);
+        sprintf(filepnm, "%s/%s", mntpt, LAST_RCVD);
+        filep = fopen(filepnm, "w");
+        if (!filep) {
+                ret = errno;
+                fprintf(stderr,"Unable to create %s file\n", filepnm);
+                goto out_umnt;
+        }
+        memset(&lsd, 0, sizeof(lsd));
+        strncpy(lsd.lsd_uuid, mop->mo_ldd.ldd_svname, sizeof(lsd.lsd_uuid));
+        lsd.lsd_index = mop->mo_index;
+        lsd.lsd_feature_compat |= cpu_to_le32(LR_COMPAT_COMMON_LR);
+        lsd.lsd_server_size = cpu_to_le32(LR_SERVER_SIZE);
+        lsd.lsd_client_start = cpu_to_le32(LR_CLIENT_START);
+        lsd.lsd_client_size = cpu_to_le16(LR_CLIENT_SIZE);
+        if (IS_MDT(&mop->mo_ldd))
+                lsd.lsd_feature_rocompat = cpu_to_le32(MDS_ROCOMPAT_LOVOBJID);
+        
+        fwrite(&lsd, sizeof(lsd), 1, filep);
+        ret = 0;
+        fclose(filep);
+out_umnt:
+        vprint("unmounting backing device\n");
+        umount(mntpt);    
+out_rmdir:
+        rmdir(mntpt);
+        return ret;
 }
 
 static int jt_setup()
@@ -572,21 +591,6 @@ static int jt_setup()
         return 0; 
 }
 
-
-#if 0
-// do we need this for aything?
-/* see jt_ptl_list_nids */
-int jt_getnids(lnet_nid_t *nidarray, int maxnids)
-{
-        struct libcfs_ioctl_data data;
-        int                      count;
-        int                      rc;
-        if (count == 0)
-                printf("<no local networks>\n");
-        return count;
-}
-#endif
-
 static void jt_print(char *cmd_name, int argc, char **argv)
 {
         int i = 0;
@@ -702,12 +706,7 @@ int write_llog_files(struct mkfs_opts *mop)
         }
         
         if (IS_MDT(&mop->mo_ldd)) {
-                lnet_nid_t nidarray[128];
                 char scnt[20], ssz[20], soff[20], spat[20];
-                char cliname[sizeof(mop->mo_ldd.ldd_fsname)];
-                char mdcname[sizeof(mop->mo_ldd.ldd_fsname)];
-                lnet_nid_t nid;
-                int numnids;
 
                 /* Write mds-conf log */
                 do_jt(jt_cfg_clear_log, "clear_log", name, 0);
@@ -859,21 +858,17 @@ static void make_sv_name(struct mkfs_opts *mop)
 
 void set_defaults(struct mkfs_opts *mop)
 {
-        char hostname[128];
         mop->mo_ldd.ldd_magic = LDD_MAGIC;
         mop->mo_ldd.ldd_flags = LDD_F_NEED_INDEX;
-
+        mop->mo_ldd.ldd_mgsnid[0] = LNET_NID_ANY;
+        strcpy(mop->mo_ldd.ldd_fsname, "lustre");
         if (get_os_version() == 24) 
                 mop->mo_ldd.ldd_mount_type = LDD_MT_EXT3;
         else 
                 mop->mo_ldd.ldd_mount_type = LDD_MT_LDISKFS;
         
-        strcpy(mop->mo_ldd.ldd_fsname, "lustre");
         mop->mo_stripe_count = 1;
         mop->mo_index = -1;
-
-        gethostname(hostname, sizeof(hostname));
-        //mop->mo_hostnid.primary = libcfs_str2nid(hostname);
 }
 
 static inline void badopt(char opt, char *type)
@@ -936,7 +931,7 @@ int main(int argc , char *const argv[])
                         }
                         break;
                 }
-                case 'C':
+                case 'C': /* Configdev */
                         //FIXME
                         exit(2);
                 case 'c':
@@ -973,11 +968,25 @@ int main(int argc , char *const argv[])
                                 badopt(opt, "MDT,OST");
                         }
                         break;
-                case 'm':
+                case 'm': {
+                        int count = 0;
+                        char *s1 = optarg, *s2;
                         if (IS_MGMT(&mop.mo_ldd))
                                 badopt(opt, "non-MGMT MDT,OST");
-                        set_nid_pair(&mop.mo_ldd.ldd_mgmtnid, optarg);
+                        while ((s2 = strsep(&s1, ","))){
+                                mop.mo_ldd.ldd_mgsnid[count++] =
+                                        libcfs_str2nid(s2);
+                                if (count >= MAX_FAILOVER_NIDS) {
+                                        fprintf(stderr, "too many MGS nids, "
+                                                "ignoring %s\n", s1);
+                                        break;
+                                } else {
+                                        mop.mo_ldd.ldd_mgsnid[count] = 
+                                                LNET_NID_ANY;
+                                }
+                        }
                         break;
+                }
                 case 'M':
                         mop.mo_ldd.ldd_flags |= LDD_F_SV_TYPE_MDT;
                         break;
@@ -1037,13 +1046,24 @@ int main(int argc , char *const argv[])
         }
 
         if (IS_MDT(&mop.mo_ldd) && !IS_MGMT(&mop.mo_ldd) && 
-            mop.mo_ldd.ldd_mgmtnid.primary == LNET_NID_ANY) {
-                vprint("No MGMT specified, adding to this MDT\n");
+            mop.mo_ldd.ldd_mgsnid[0] == LNET_NID_ANY) {
+                int count;
+                __u64 *nids;
+                vprint("No MGS specified, adding to this MDT\n");
                 mop.mo_ldd.ldd_flags |= LDD_F_SV_TYPE_MGMT;
-                //FIXME mop.mo_ldd.ldd_mgmt.primary == libcfs_str2nid(localhost);
+                count = jt_ptl_get_nids(&nids);
+                if (count > 0) {
+                        vprint("Adding %d local nids for MGS\n", count);
+                        memcpy(mop.mo_ldd.ldd_mgsnid, nids,
+                               sizeof(mop.mo_ldd.ldd_mgsnid));
+                        free(nids);
+                }
+                if (count < MAX_FAILOVER_NIDS) {
+                        mop.mo_ldd.ldd_mgsnid[count] = LNET_NID_ANY;
+                }
         }
 
-        if (mop.mo_ldd.ldd_mgmtnid.primary == LNET_NID_ANY) {
+        if (mop.mo_ldd.ldd_mgsnid[0] == LNET_NID_ANY) {
                 fatal();
                 fprintf(stderr, "Must specify either --mgmt or --mgmtnode\n");
                 usage(stderr);
@@ -1060,14 +1080,19 @@ int main(int argc , char *const argv[])
         case LDD_MT_LDISKFS: {
                 sprintf(mop.mo_ldd.ldd_mount_opts, "errors=remount-ro");
                 if (IS_MDT(&mop.mo_ldd))
-                        strcat(mop.mo_ldd.ldd_mount_opts, ",iopen_nopriv");
+                        strcat(mop.mo_ldd.ldd_mount_opts,
+                               ",iopen_nopriv,user_xattr");
                 if ((get_os_version() == 24) && IS_OST(&mop.mo_ldd))
                         strcat(mop.mo_ldd.ldd_mount_opts, ",asyncdel");
-                /* When do we want extents and mballoc? 
-                if (mop.mo_ldd.ldd_mount_type == LDD_MT_LDISKFS) {
+#if 0
+                /* Files created while extents are enabled cannot be read if
+                   mounted with a kernel that doesn't include the CFS patches.*/
+                if ((get_os_version() == 26) && IS_OST(&mop.mo_ldd) && 
+                    mop.mo_ldd.ldd_mount_type == LDD_MT_LDISKFS) {
                         strcat(mop.mo_ldd.ldd_mount_opts, ",extents,mballoc");
                 }
-                */
+#endif               
                 break;
         }
         case LDD_MT_SMFS: {
@@ -1109,6 +1134,9 @@ int main(int argc , char *const argv[])
                 }
         }
 
+        if (verbose)
+                print_ldd(&(mop.mo_ldd));
+
         ret = make_lustre_backfs(&mop);
         if (ret != 0) {
                 fatal();
index 5e8c3df..32bb3d6 100644 (file)
@@ -58,7 +58,7 @@ void usage(FILE *out)
                 "\t-h|--help: print this usage message\n"
                 "\t-n|--nomtab: do not update /etc/mtab after mount\n"
                 "\t-v|--verbose: print verbose config settings\n");
-        exit(out != stdout);
+        exit((out != stdout) ? EINVAL : 0);
 }
 
 static int load_module(char *module_name)
@@ -162,6 +162,7 @@ struct opt_map {
         int mask;               /* flag mask value */
 };
 
+/* These flags are parsed by mount, not lustre */
 static const struct opt_map opt_map[] = {
   { "defaults", 0, 0, 0         },      /* default options */
   { "rw",       1, 1, MS_RDONLY },      /* read-write */
@@ -301,13 +302,13 @@ int main(int argc, char *const argv[])
         }
 
         if (!force && check_mtab_entry(source, target, "lustre"))
-                exit(32);
+                return(EEXIST);
 
         rc = parse_options(options, &flags); 
         if (rc) {
                 fprintf(stderr, "%s: can't parse options: %s\n",
                         progname, options);
-                exit(1);
+                return(EINVAL);
         }
 
         rc = access(target, F_OK);
@@ -315,7 +316,7 @@ int main(int argc, char *const argv[])
                 rc = errno;
                 fprintf(stderr, "%s: %s inaccessible: %s\n", progname, target,
                         strerror(errno));
-                return 1;
+                return rc;
         }
 
         /* FIXME remove */
@@ -336,6 +337,7 @@ int main(int argc, char *const argv[])
                    lustre_fill_super.  Lustre ignores the flags, but mount 
                    does not. */
                 rc = mount(source, target, "lustre", flags, (void *)optcopy);
+
         if (rc) {
                 fprintf(stderr, "%s: mount(%s, %s) failed: %s\n", progname, 
                         source, target, strerror(errno));