Whamcloud - gitweb
Branch b1_4
authoradilger <adilger>
Wed, 8 Jun 2005 18:38:16 +0000 (18:38 +0000)
committeradilger <adilger>
Wed, 8 Jun 2005 18:38:16 +0000 (18:38 +0000)
Don't try to use the -clean llog to clean up if we just had an error
trying to mount with the llog.  Instead use lustre_manual_cleanup()
as we already do with regular and force unmount.
b=6302

lustre/liblustre/super.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c

index 7554335..486b915 100644 (file)
@@ -1622,6 +1622,7 @@ llu_fsswop_mount(const char *source,
         struct lustre_md md;
         class_uuid_t uuid;
         struct config_llog_instance cfg;
+        char ll_instance[sizeof(sbi) * 2 + 1];
         struct lustre_profile *lprof;
        char *zconf_mdsnid, *zconf_mdsname, *zconf_profile;
         char *osc = NULL, *mdc = NULL;
@@ -1651,16 +1652,13 @@ llu_fsswop_mount(const char *source,
 
         /* generate a string unique to this super, let's try
          the address of the super itself.*/
-        OBD_ALLOC(sbi->ll_instance, sizeof(sbi) * 2 + 1);
-        if (sbi->ll_instance == NULL) 
-                GOTO(out_free, err = -ENOMEM);
-        sprintf(sbi->ll_instance, "%p", sbi);
+        sprintf(ll_instance, "%p", sbi);
 
         /* retrive & parse config log */
-        cfg.cfg_instance = sbi->ll_instance;
+        cfg.cfg_instance = ll_instance;
         cfg.cfg_uuid = sbi->ll_sb_uuid;
-        err = liblustre_process_log(&cfg,
-                               zconf_mdsnid, zconf_mdsname, zconf_profile, 1);
+        err = liblustre_process_log(&cfg, zconf_mdsnid, zconf_mdsname,
+                                    zconf_profile, 1);
         if (err < 0) {
                 CERROR("Unable to process log: %s\n", zconf_profile);
                 GOTO(out_free, err);
@@ -1671,17 +1669,11 @@ llu_fsswop_mount(const char *source,
                 CERROR("No profile found: %s\n", zconf_profile);
                 GOTO(out_free, err = -EINVAL);
         }
-        if (osc)
-                OBD_FREE(osc, strlen(osc) + 1);
-        OBD_ALLOC(osc, strlen(lprof->lp_osc) + 
-                  strlen(sbi->ll_instance) + 2);
-        sprintf(osc, "%s-%s", lprof->lp_osc, sbi->ll_instance);
+        OBD_ALLOC(osc, strlen(lprof->lp_osc) + strlen(ll_instance) + 2);
+        sprintf(osc, "%s-%s", lprof->lp_osc, ll_instance);
 
-        if (mdc)
-                OBD_FREE(mdc, strlen(mdc) + 1);
-        OBD_ALLOC(mdc, strlen(lprof->lp_mdc) + 
-                  strlen(sbi->ll_instance) + 2);
-        sprintf(mdc, "%s-%s", lprof->lp_mdc, sbi->ll_instance);
+        OBD_ALLOC(mdc, strlen(lprof->lp_mdc) + strlen(ll_instance) + 2);
+        sprintf(mdc, "%s-%s", lprof->lp_mdc, ll_instance);
 
         if (!osc) {
                 CERROR("no osc\n");
@@ -1800,6 +1792,10 @@ out_osc:
 out_mdc:
         obd_disconnect(sbi->ll_mdc_exp);
 out_free:
+        if (osc)
+                OBD_FREE(osc, strlen(osc) + 1);
+        if (mdc)
+                OBD_FREE(mdc, strlen(mdc) + 1);
         OBD_FREE(sbi, sizeof(*sbi));
         return err;
 }
index d2f1ff0..cc12454 100644 (file)
@@ -91,7 +91,6 @@ static inline struct ll_inode_info *ll_i2info(struct inode *inode)
 #endif
 }
 
-
 /* default to about 40meg of readahead on a given system.  That much tied
  * up in 512k readahead requests serviced at 40ms each is about 1GB/s. */
 #define SBI_DEFAULT_READAHEAD_MAX (40UL << (20 - PAGE_CACHE_SHIFT))
@@ -131,7 +130,6 @@ struct ll_sb_info {
         obd_id                    ll_rootino; /* number of root inode */
 
         struct lustre_mount_data *ll_lmd;
-        char                     *ll_instance;
 
         int                       ll_flags;
         struct list_head          ll_conn_chain; /* per-conn chain of SBs */
index 7076509..86f9506 100644 (file)
@@ -249,7 +249,8 @@ int lustre_common_fill_super(struct super_block *sb, char *mdc, char *osc)
         ptlrpc_req_finished(request);
 
         if (root == NULL || is_bad_inode(root)) {
-                /* XXX might need iput() for bad inode */
+                if (md.lsm != NULL)
+                        obd_free_memmd(sbi->ll_osc_exp, &md.lsm);
                 CERROR("lustre_lite: bad iget4 for root\n");
                 GOTO(out_root, err = -EBADF);
         }
@@ -314,11 +315,11 @@ void lustre_dump_dentry(struct dentry *dentry, int recur)
                 subdirs++;
 
         CERROR("dentry %p dump: name=%.*s parent=%.*s (%p), inode=%p, count=%u,"
-               " flags=0x%x, vfs_flags=0x%x, fsdata=%p, %d subdirs\n", dentry,
+               " flags=0x%x, fsdata=%p, %d subdirs\n", dentry,
                dentry->d_name.len, dentry->d_name.name,
                dentry->d_parent->d_name.len, dentry->d_parent->d_name.name,
                dentry->d_parent, dentry->d_inode, atomic_read(&dentry->d_count),
-               dentry->d_flags, dentry->d_flags, dentry->d_fsdata, subdirs);
+               dentry->d_flags, dentry->d_fsdata, subdirs);
         if (dentry->d_inode != NULL)
                 ll_dump_inode(dentry->d_inode);
 
@@ -708,7 +709,7 @@ int lustre_fill_super(struct super_block *sb, void *data, int silent)
         if (lmd->lmd_profile) {
                 struct lustre_profile *lprof;
                 struct config_llog_instance cfg;
-                int len;
+                char ll_instance[sizeof(sb) * 2 + 1];
 
                 if (lmd->lmd_mds[0] == '\0') {
                         CERROR("no mds name\n");
@@ -722,13 +723,9 @@ int lustre_fill_super(struct super_block *sb, void *data, int silent)
 
                 /* generate a string unique to this super, let's try
                  the address of the super itself.*/
-                len = (sizeof(sb) * 2) + 1;
-                OBD_ALLOC(sbi->ll_instance, len);
-                if (sbi->ll_instance == NULL)
-                        GOTO(out_free, err = -ENOMEM);
-                sprintf(sbi->ll_instance, "%p", sb);
+                sprintf(ll_instance, "%p", sb);
 
-                cfg.cfg_instance = sbi->ll_instance;
+                cfg.cfg_instance = ll_instance;
                 cfg.cfg_uuid = sbi->ll_sb_uuid;
                 cfg.cfg_local_nid = lmd->lmd_local_nid;
                 err = lustre_process_log(lmd, lmd->lmd_profile, &cfg, 0);
@@ -746,14 +743,14 @@ int lustre_fill_super(struct super_block *sb, void *data, int silent)
                 if (osc)
                         OBD_FREE(osc, strlen(osc) + 1);
                 OBD_ALLOC(osc, strlen(lprof->lp_osc) +
-                          strlen(sbi->ll_instance) + 2);
-                sprintf(osc, "%s-%s", lprof->lp_osc, sbi->ll_instance);
+                          strlen(ll_instance) + 2);
+                sprintf(osc, "%s-%s", lprof->lp_osc, ll_instance);
 
                 if (mdc)
                         OBD_FREE(mdc, strlen(mdc) + 1);
                 OBD_ALLOC(mdc, strlen(lprof->lp_mdc) +
-                          strlen(sbi->ll_instance) + 2);
-                sprintf(mdc, "%s-%s", lprof->lp_mdc, sbi->ll_instance);
+                          strlen(ll_instance) + 2);
+                sprintf(mdc, "%s-%s", lprof->lp_mdc, ll_instance);
         }
 
         if (!osc) {
@@ -781,27 +778,7 @@ out_dev:
 
 out_free:
         if (sbi->ll_lmd) {
-                int len = strlen(sbi->ll_lmd->lmd_profile) + sizeof("-clean")+1;
-                int err;
-
-                if (sbi->ll_instance != NULL) {
-                        char * cln_prof;
-                        struct config_llog_instance cfg;
-
-                        cfg.cfg_instance = sbi->ll_instance;
-                        cfg.cfg_uuid = sbi->ll_sb_uuid;
-
-                        OBD_ALLOC(cln_prof, len);
-                        sprintf(cln_prof, "%s-clean", sbi->ll_lmd->lmd_profile);
-
-                        err = lustre_process_log(sbi->ll_lmd, cln_prof, &cfg,0);
-                        if (err < 0) {
-                                CERROR("Unable to process log: %s\n", cln_prof);
-                                lustre_manual_cleanup(sbi);
-                        }
-                        OBD_FREE(cln_prof, len);
-                        OBD_FREE(sbi->ll_instance, strlen(sbi->ll_instance)+ 1);
-                }
+                lustre_manual_cleanup(sbi);
                 OBD_FREE(sbi->ll_lmd, sizeof(*sbi->ll_lmd));
         }
         lustre_free_sbi(sb);
@@ -825,38 +802,8 @@ void lustre_put_super(struct super_block *sb)
         lustre_common_put_super(sb);
 
         if (sbi->ll_lmd != NULL) {
-#if 0
-                char * cln_prof;
-                int len = strlen(sbi->ll_lmd->lmd_profile) + sizeof("-clean")+1;
-                int err;
-                struct config_llog_instance cfg;
-
-                if (force_umount) {
-                        CERROR("force umount, doing manual cleanup\n");
-                        lustre_manual_cleanup(sbi);
-                        GOTO(free_lmd, 0);
-                }
-
-                cfg.cfg_instance = sbi->ll_instance;
-                cfg.cfg_uuid = sbi->ll_sb_uuid;
-
-                OBD_ALLOC(cln_prof, len);
-                sprintf(cln_prof, "%s-clean", sbi->ll_lmd->lmd_profile);
-
-                err = lustre_process_log(sbi->ll_lmd, cln_prof, &cfg, 0);
-                if (err < 0) {
-                        CERROR("Unable to process log: %s, doing manual cleanup"
-                               "\n", cln_prof);
-                        lustre_manual_cleanup(sbi);
-                }
-
-                OBD_FREE(cln_prof, len);
-        free_lmd:
-#else
                 lustre_manual_cleanup(sbi);
-#endif
                 OBD_FREE(sbi->ll_lmd, sizeof(*sbi->ll_lmd));
-                OBD_FREE(sbi->ll_instance, strlen(sbi->ll_instance) + 1);
         }
 
         lustre_free_sbi(sb);