Whamcloud - gitweb
merge b_devel to b_eq: 20031112
authorericm <ericm>
Wed, 12 Nov 2003 11:03:20 +0000 (11:03 +0000)
committerericm <ericm>
Wed, 12 Nov 2003 11:03:20 +0000 (11:03 +0000)
for robert's final zeroconf code.

lustre/llite/llite_lib.c
lustre/ptlrpc/recov_thread.c

index 45c02bc..f141fee 100644 (file)
@@ -44,6 +44,179 @@ extern struct super_operations ll_super_operations;
 #define log2(n) ffz(~(n))
 #endif
 
+struct ll_sb_info *lustre_init_sbi(struct super_block *sb) 
+{
+        struct ll_sb_info *sbi = NULL;
+        class_uuid_t uuid;
+        ENTRY;
+
+        OBD_ALLOC(sbi, sizeof(*sbi));
+        if (!sbi)
+                RETURN(NULL);
+
+        INIT_LIST_HEAD(&sbi->ll_conn_chain);
+        INIT_HLIST_HEAD(&sbi->ll_orphan_dentry_list);
+        ll_s2sbi(sb) = sbi;
+
+        generate_random_uuid(uuid);
+        class_uuid_unparse(uuid, &sbi->ll_sb_uuid);
+        RETURN(sbi);
+}
+
+void lustre_free_sbi(struct super_block *sb) 
+{
+        struct ll_sb_info *sbi = ll_s2sbi(sb);
+        ENTRY;
+
+        if (sbi != NULL)
+                OBD_FREE(sbi, sizeof(*sbi));
+        ll_s2sbi(sb) = NULL;
+        EXIT;
+}
+
+int lustre_common_fill_super(struct super_block *sb, char *mdc, char *osc)
+{
+        struct inode *root = 0;
+        struct ll_sb_info *sbi = ll_s2sbi(sb);
+        struct obd_device *obd;
+        struct ll_fid rootfid;
+        struct obd_statfs osfs;
+        struct ptlrpc_request *request = NULL;
+        struct lustre_handle osc_conn = {0, };
+        struct lustre_handle mdc_conn = {0, };
+        struct lustre_md md;
+        kdev_t devno;
+        int err;
+
+        obd = class_name2obd(mdc);
+        if (!obd) {
+                CERROR("MDC %s: not setup or attached\n", mdc);
+                RETURN(-EINVAL);
+        }
+
+        if (proc_lustre_fs_root) {
+                err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb,
+                                                  osc, mdc);
+                if (err < 0)
+                        CERROR("could not register mount in /proc/lustre");
+        }
+
+        mdc_init_ea_size(obd, osc);
+
+        err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid);
+        if (err) {
+                CERROR("cannot connect to %s: rc = %d\n", mdc, err);
+                GOTO(out, err);
+        }
+        sbi->ll_mdc_exp = class_conn2export(&mdc_conn);
+
+        err = obd_statfs(obd, &osfs, jiffies - HZ);
+        if (err)
+                GOTO(out_mdc, err);
+
+        LASSERT(osfs.os_bsize);
+        sb->s_blocksize = osfs.os_bsize;
+        sb->s_blocksize_bits = log2(osfs.os_bsize);
+        sb->s_magic = LL_SUPER_MAGIC;
+        sb->s_maxbytes = PAGE_CACHE_MAXBYTES;
+        
+        devno = get_uuid2int(sbi2mdc(sbi)->cl_import->imp_target_uuid.uuid, 
+                             strlen(sbi2mdc(sbi)->cl_import->imp_target_uuid.uuid));
+        sb->s_dev = devno;
+
+        obd = class_name2obd(osc);
+        if (!obd) {
+                CERROR("OSC %s: not setup or attached\n", osc);
+                GOTO(out_mdc, err);
+        }
+
+        err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid);
+        if (err) {
+                CERROR("cannot connect to %s: rc = %d\n", osc, err);
+                GOTO(out_mdc, err);
+        }
+        sbi->ll_osc_exp = class_conn2export(&osc_conn);
+
+        err = mdc_getstatus(sbi->ll_mdc_exp, &rootfid);
+        if (err) {
+                CERROR("cannot mds_connect: rc = %d\n", err);
+                GOTO(out_osc, err);
+        }
+        CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id);
+        sbi->ll_rootino = rootfid.id;
+
+        sb->s_op = &lustre_super_operations;
+
+        /* make root inode 
+         * XXX: move this to after cbd setup? */
+        err = mdc_getattr(sbi->ll_mdc_exp, &rootfid,
+                          OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, 0, &request);
+        if (err) {
+                CERROR("mdc_getattr failed for root: rc = %d\n", err);
+                GOTO(out_osc, err);
+        }
+
+        err = mdc_req2lustre_md(request, 0, sbi->ll_osc_exp, &md);
+        if (err) {
+                CERROR("failed to understand root inode md: rc = %d\n",err);
+                ptlrpc_req_finished (request);
+                GOTO(out_osc, err);
+        }
+
+        LASSERT(sbi->ll_rootino != 0);
+        root = ll_iget(sb, sbi->ll_rootino, &md);
+
+        ptlrpc_req_finished(request);
+
+        if (root == NULL || is_bad_inode(root)) {
+                /* XXX might need iput() for bad inode */
+                CERROR("lustre_lite: bad iget4 for root\n");
+                GOTO(out_root, err = -EBADF);
+        }
+
+        sb->s_root = d_alloc_root(root);
+        RETURN(err);
+
+out_root:
+        if (root)
+                iput(root);
+out_osc:
+        obd_disconnect(sbi->ll_osc_exp, 0);
+out_mdc:
+        obd_disconnect(sbi->ll_mdc_exp, 0);
+out:
+        lprocfs_unregister_mountpoint(sbi);
+        RETURN(err);
+}
+
+void lustre_common_put_super(struct super_block *sb)
+{
+        struct ll_sb_info *sbi = ll_s2sbi(sb);
+        struct hlist_node *tmp, *next;
+        ENTRY;
+
+        list_del(&sbi->ll_conn_chain);
+        obd_disconnect(sbi->ll_osc_exp, 0);
+
+        lprocfs_unregister_mountpoint(sbi);
+        if (sbi->ll_proc_root) {
+                lprocfs_remove(sbi->ll_proc_root);
+                sbi->ll_proc_root = NULL;
+        }
+
+        obd_disconnect(sbi->ll_mdc_exp, 0);
+
+        // We do this to get rid of orphaned dentries. That is not really trw.
+        spin_lock(&dcache_lock);
+        hlist_for_each_safe(tmp, next, &sbi->ll_orphan_dentry_list) {
+                struct dentry *dentry = hlist_entry(tmp, struct dentry, d_hash);
+                shrink_dcache_parent(dentry);
+        }
+        spin_unlock(&dcache_lock);
+        EXIT;
+}
+
+
 char *ll_read_opt(const char *opt, char *data)
 {
         char *value;
@@ -79,8 +252,7 @@ int ll_set_opt(const char *opt, char *data, int fl)
                 RETURN(fl);
 }
 
-void ll_options(char *options, char **ost, char **mdc, char **profile, 
-                char **mds_uuid, char **mds_peer, int *flags)
+void ll_options(char *options, char **ost, char **mdc, int *flags)
 {
         char *this_char;
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
@@ -105,14 +277,6 @@ void ll_options(char *options, char **ost, char **mdc, char **profile,
                         continue;
                 if (!*mdc && (*mdc = ll_read_opt("mdc", this_char)))
                         continue;
-                if (!*profile && (*profile = ll_read_opt("profile", this_char)))
-                        continue;
-                if (!*mds_uuid && (*mds_uuid = ll_read_opt("mds_uuid", 
-                                                           this_char)))
-                        continue;
-                if (!*mds_peer && (*mds_peer = ll_read_opt("mds_peer", 
-                                                           this_char)))
-                        continue;
                 if (!(*flags & LL_SBI_NOLCK) &&
                     ((*flags) = (*flags) |
                                 ll_set_opt("nolock", this_char,
@@ -129,31 +293,121 @@ void ll_lli_init(struct ll_inode_info *lli)
         lli->lli_maxbytes = PAGE_CACHE_MAXBYTES;
 }
 
-int ll_process_log(char *mds, char *peer, char *config, 
-                   struct config_llog_instance *cfg)
+int ll_fill_super(struct super_block *sb, void *data, int silent)
+{
+        struct ll_sb_info *sbi;
+        char *osc = NULL;
+        char *mdc = NULL;
+        int err;
+        ENTRY;
+
+        CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
+
+        sbi = lustre_init_sbi(sb);
+        if (!sbi)
+                RETURN(-ENOMEM);
+
+        sbi->ll_flags |= LL_SBI_READAHEAD;
+        ll_options(data, &osc, &mdc, &sbi->ll_flags);
+
+        if (!osc) {
+                CERROR("no osc\n");
+                GOTO(out, err = -EINVAL);
+        }
+
+        if (!mdc) {
+                CERROR("no mdc\n");
+                GOTO(out, err = -EINVAL);
+        }
+
+        err = lustre_common_fill_super(sb, mdc, osc);
+out:
+        if (err)
+                lustre_free_sbi(sb);
+
+        if (mdc)
+                OBD_FREE(mdc, strlen(mdc) + 1);
+        if (osc)
+                OBD_FREE(osc, strlen(osc) + 1);
+
+        RETURN(err);
+} /* ll_read_super */
+
+void ll_put_super(struct super_block *sb)
+{
+        ENTRY;
+
+        CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
+
+        lustre_common_put_super(sb);
+
+        lustre_free_sbi(sb);
+
+        EXIT;
+} /* ll_put_super */
+
+int lustre_process_log(struct lustre_mount_data *lmd, char * profile,
+                       struct config_llog_instance *cfg)
 {
         struct lustre_cfg lcfg;
+        struct portals_cfg pcfg;
+        char * peer = "MDS_PEER_UUID";
         struct obd_device *obd;
         struct lustre_handle mdc_conn = {0, };
         struct obd_export *exp;
         char * name = "mdc_dev";
-        struct obd_uuid uuid = { "MDC_mount_UUID" };
+        class_uuid_t uuid;
+        struct obd_uuid mdc_uuid;
         struct llog_obd_ctxt *ctxt;
         int rc = 0;
         int err;
         ENTRY;
 
+        generate_random_uuid(uuid);
+        class_uuid_unparse(uuid, &mdc_uuid);
+
+        if (lmd->lmd_local_nid) {
+                PCFG_INIT(pcfg, NAL_CMD_REGISTER_MYNID);
+                pcfg.pcfg_nal = lmd->lmd_nal;
+                pcfg.pcfg_nid = lmd->lmd_local_nid;
+                err = kportal_nal_cmd(&pcfg);
+                if (err <0)
+                        GOTO(out, err);
+        }
+
+        if (lmd->lmd_nal == SOCKNAL) {
+                PCFG_INIT(pcfg, NAL_CMD_ADD_AUTOCONN);
+                pcfg.pcfg_nal     = lmd->lmd_nal;
+                pcfg.pcfg_nid     = lmd->lmd_server_nid;
+                pcfg.pcfg_id      = lmd->lmd_server_ipaddr;
+                pcfg.pcfg_misc    = lmd->lmd_port;
+                pcfg.pcfg_size    = 0;
+                pcfg.pcfg_flags   = 0x4; /*share*/
+                err = kportal_nal_cmd(&pcfg);
+                if (err <0)
+                        GOTO(out, err);
+        }
+
+        LCFG_INIT(lcfg, LCFG_ADD_UUID, name);
+        lcfg.lcfg_nid = lmd->lmd_server_nid;
+        lcfg.lcfg_inllen1 = strlen(peer) + 1;
+        lcfg.lcfg_inlbuf1 = peer;
+        lcfg.lcfg_nal = lmd->lmd_nal;
+        err = class_process_config(&lcfg);
+        if (err < 0)
+                GOTO(out_del_conn, err);
+
         LCFG_INIT(lcfg, LCFG_ATTACH, name);
         lcfg.lcfg_inlbuf1 = "mdc";
         lcfg.lcfg_inllen1 = strlen(lcfg.lcfg_inlbuf1) + 1;
-        lcfg.lcfg_inlbuf2 = "mdc_dev_UUID";
+        lcfg.lcfg_inlbuf2 = mdc_uuid.uuid;
         lcfg.lcfg_inllen2 = strlen(lcfg.lcfg_inlbuf2) + 1;
         err = class_process_config(&lcfg);
         if (err < 0)
-                GOTO(out, err);
+                GOTO(out_del_uuid, err);
 
         LCFG_INIT(lcfg, LCFG_SETUP, name);
-        lcfg.lcfg_inlbuf1 = mds;
+        lcfg.lcfg_inlbuf1 = lmd->lmd_mds;
         lcfg.lcfg_inllen1 = strlen(lcfg.lcfg_inlbuf1) + 1;
         lcfg.lcfg_inlbuf2 = peer;
         lcfg.lcfg_inllen2 = strlen(lcfg.lcfg_inlbuf2) + 1;
@@ -165,16 +419,16 @@ int ll_process_log(char *mds, char *peer, char *config,
         if (obd == NULL)
                 GOTO(out_cleanup, err = -EINVAL);
 
-        err = obd_connect(&mdc_conn, obd, &uuid);
+        err = obd_connect(&mdc_conn, obd, &mdc_uuid);
         if (err) {
-                CERROR("cannot connect to %s: rc = %d\n", mds, err);
+                CERROR("cannot connect to %s: rc = %d\n", lmd->lmd_mds, err);
                 GOTO(out_cleanup, err);
         }
         
         exp = class_conn2export(&mdc_conn);
         
         ctxt = exp->exp_obd->obd_llog_ctxt[LLOG_CONFIG_REPL_CTXT];
-        rc = class_config_parse_llog(ctxt, config, cfg);
+        rc = class_config_parse_llog(ctxt, profile, cfg);
         if (rc) {
                 CERROR("class_config_parse_llog failed: rc = %d\n", rc);
         }
@@ -188,11 +442,28 @@ out_cleanup:
                 GOTO(out, err);
 
 out_detach:
-
         LCFG_INIT(lcfg, LCFG_DETACH, name);
         err = class_process_config(&lcfg);
         if (err < 0)
                 GOTO(out, err);
+
+out_del_uuid:
+        LCFG_INIT(lcfg, LCFG_DEL_UUID, name);
+        lcfg.lcfg_inllen1 = strlen(peer) + 1;
+        lcfg.lcfg_inlbuf1 = peer;
+        err = class_process_config(&lcfg);
+
+out_del_conn:
+        if (lmd->lmd_nal == SOCKNAL) {
+                PCFG_INIT(pcfg, NAL_CMD_DEL_AUTOCONN);
+                pcfg.pcfg_nal     = lmd->lmd_nal;
+                pcfg.pcfg_nid     = lmd->lmd_server_nid;
+                pcfg.pcfg_id      = lmd->lmd_server_ipaddr;
+                pcfg.pcfg_flags   = 1; /*share*/
+                err = kportal_nal_cmd(&pcfg);
+                if (err <0)
+                        GOTO(out, err);
+        }
 out:
         if (rc == 0)
                 rc = err;
@@ -200,68 +471,36 @@ out:
         RETURN(rc);
 }
 
-int ll_fill_super(struct super_block *sb, void *data, int silent)
+int lustre_fill_super(struct super_block *sb, void *data, int silent)
 {
-        struct inode *root = 0;
-        struct obd_device *obd;
+        struct lustre_mount_data * lmd = data;
         struct ll_sb_info *sbi;
         char *osc = NULL;
         char *mdc = NULL;
-        char *mds_uuid = NULL;
-        char *mds_peer = NULL;
-        char *profile = NULL;
         int err;
-        struct ll_fid rootfid;
-        struct obd_statfs osfs;
-        struct ptlrpc_request *request = NULL;
-        struct lustre_handle osc_conn = {0, };
-        struct lustre_handle mdc_conn = {0, };
-        struct lustre_md md;
-        class_uuid_t uuid;
-        kdev_t devno;
-
         ENTRY;
 
         CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
-        OBD_ALLOC(sbi, sizeof(*sbi));
+        sbi = lustre_init_sbi(sb);
         if (!sbi)
                 RETURN(-ENOMEM);
 
-        INIT_LIST_HEAD(&sbi->ll_conn_chain);
-        INIT_HLIST_HEAD(&sbi->ll_orphan_dentry_list);
-        ll_s2sbi(sb) = sbi;
-
-        generate_random_uuid(uuid);
-        class_uuid_unparse(uuid, &sbi->ll_sb_uuid);
-
         sbi->ll_flags |= LL_SBI_READAHEAD;
-        ll_options(data, &osc, &mdc, &profile, &mds_uuid, &mds_peer, 
-                   &sbi->ll_flags);
 
-        if (profile) {
+        if (lmd->lmd_profile) {
                 struct lustre_profile *lprof;
                 struct config_llog_instance cfg;
                 int len;
 
-                if (!mds_uuid) {
-                        CERROR("no mds_uuid\n");
+                if (!lmd->lmd_mds) {
+                        CERROR("no mds name\n");
                         GOTO(out_free, err = -EINVAL);
                 }
 
-                if (!mds_peer) {
-                        CERROR("no mds_peer\n");
-                        GOTO(out_free, err = -EINVAL);
-                }
-                
-                /* save these so we can cleanup later */
-                obd_str2uuid(&sbi->ll_mds_uuid, mds_uuid);
-                obd_str2uuid(&sbi->ll_mds_peer_uuid, mds_peer);
-
-                len = strlen(profile) + 1;
-                OBD_ALLOC(sbi->ll_profile, len);
-                if (sbi->ll_profile == NULL) 
+                OBD_ALLOC(sbi->ll_lmd, sizeof(*sbi->ll_lmd));
+                if (sbi->ll_lmd == NULL) 
                         GOTO(out_free, err = -ENOMEM);
-                memcpy(sbi->ll_profile, profile, len);
+                memcpy(sbi->ll_lmd, lmd, sizeof(*lmd));
 
                 /* generate a string unique to this super, let's try
                  the address of the super itself.*/
@@ -273,16 +512,16 @@ int ll_fill_super(struct super_block *sb, void *data, int silent)
 
                 cfg.cfg_instance = sbi->ll_instance;
                 cfg.cfg_uuid = sbi->ll_sb_uuid;
-                err = ll_process_log(mds_uuid, mds_peer, profile, &cfg);
+                err = lustre_process_log(lmd, lmd->lmd_profile, &cfg);
                 if (err < 0) {
-                        CERROR("Unable to process log: %s\n", profile);
+                        CERROR("Unable to process log: %s\n", lmd->lmd_profile);
 
                         GOTO(out_free, err);
                 }
 
-                lprof = class_get_profile(profile);
+                lprof = class_get_profile(lmd->lmd_profile);
                 if (lprof == NULL) {
-                        CERROR("No profile found: %s\n", profile);
+                        CERROR("No profile found: %s\n", lmd->lmd_profile);
                         GOTO(out_free, err = -EINVAL);
                 }
                 if (osc)
@@ -308,118 +547,22 @@ int ll_fill_super(struct super_block *sb, void *data, int silent)
                 GOTO(out_free, err = -EINVAL);
         }
         
-
-        obd = class_name2obd(mdc);
-        if (!obd) {
-                CERROR("MDC %s: not setup or attached\n", mdc);
-                GOTO(out_free, err = -EINVAL);
-        }
-
-        if (proc_lustre_fs_root) {
-                err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb,
-                                                  osc, mdc);
-                if (err < 0)
-                        CERROR("could not register mount in /proc/lustre");
-        }
-
-        mdc_init_ea_size(obd, osc);
-
-        err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid);
-        if (err) {
-                CERROR("cannot connect to %s: rc = %d\n", mdc, err);
-                GOTO(out_free, err);
-        }
-        sbi->ll_mdc_exp = class_conn2export(&mdc_conn);
-
-        err = obd_statfs(obd, &osfs, jiffies - HZ);
-        if (err)
-                GOTO(out_mdc, err);
-
-        LASSERT(osfs.os_bsize);
-        sb->s_blocksize = osfs.os_bsize;
-        sb->s_blocksize_bits = log2(osfs.os_bsize);
-        sb->s_magic = LL_SUPER_MAGIC;
-        sb->s_maxbytes = PAGE_CACHE_MAXBYTES;
+        err = lustre_common_fill_super(sb, mdc, osc);
         
-        devno = get_uuid2int(sbi2mdc(sbi)->cl_import->imp_target_uuid.uuid, 
-                             strlen(sbi2mdc(sbi)->cl_import->imp_target_uuid.uuid));
-        sb->s_dev = devno;
-
-        obd = class_name2obd(osc);
-        if (!obd) {
-                CERROR("OSC %s: not setup or attached\n", osc);
-                GOTO(out_mdc, err);
-        }
-
-        err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid);
-        if (err) {
-                CERROR("cannot connect to %s: rc = %d\n", osc, err);
-                GOTO(out_mdc, err);
-        }
-        sbi->ll_osc_exp = class_conn2export(&osc_conn);
-
-        err = mdc_getstatus(sbi->ll_mdc_exp, &rootfid);
-        if (err) {
-                CERROR("cannot mds_connect: rc = %d\n", err);
-                GOTO(out_osc, err);
-        }
-        CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id);
-        sbi->ll_rootino = rootfid.id;
-
-        sb->s_op = &ll_super_operations;
-
-        /* make root inode 
-         * XXX: move this to after cbd setup? */
-        err = mdc_getattr(sbi->ll_mdc_exp, &rootfid,
-                          OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, 0, &request);
-        if (err) {
-                CERROR("mdc_getattr failed for root: rc = %d\n", err);
-                GOTO(out_osc, err);
-        }
-
-        err = mdc_req2lustre_md(request, 0, sbi->ll_osc_exp, &md);
-        if (err) {
-                CERROR("failed to understand root inode md: rc = %d\n",err);
-                ptlrpc_req_finished (request);
-                GOTO(out_osc, err);
-        }
-
-        LASSERT(sbi->ll_rootino != 0);
-        root = ll_iget(sb, sbi->ll_rootino, &md);
-
-        ptlrpc_req_finished(request);
-
-        if (root == NULL || is_bad_inode(root)) {
-                /* XXX might need iput() for bad inode */
-                CERROR("lustre_lite: bad iget4 for root\n");
-                GOTO(out_osc, err = -EBADF);
-        }
-
-        sb->s_root = d_alloc_root(root);
+        if (err)
+                GOTO(out_free, err);
 
 out_dev:
         if (mdc)
                 OBD_FREE(mdc, strlen(mdc) + 1);
         if (osc)
                 OBD_FREE(osc, strlen(osc) + 1);
-        if (profile)
-                OBD_FREE(profile, strlen(profile) + 1);
-        if (mds_uuid)
-                OBD_FREE(mds_uuid, strlen(mds_uuid) + 1);
-        if (mds_peer)
-                OBD_FREE(mds_peer, strlen(mds_peer) + 1);
 
         RETURN(err);
 
-        iput(root);
-out_osc:
-        obd_disconnect(sbi->ll_osc_exp, 0);
-out_mdc:
-        obd_disconnect(sbi->ll_mdc_exp, 0);
-
 out_free:
-        if (sbi->ll_profile != NULL) {
-                int len = strlen(sbi->ll_profile) + sizeof("-clean") + 1;
+        if (sbi->ll_lmd) {
+                int len = strlen(sbi->ll_lmd->lmd_profile) + sizeof("-clean")+1;
                 int err;
 
                 if (sbi->ll_instance != NULL) {
@@ -430,54 +573,33 @@ out_free:
                         cfg.cfg_uuid = sbi->ll_sb_uuid;
 
                         OBD_ALLOC(cln_prof, len);
-                        sprintf(cln_prof, "%s-clean", sbi->ll_profile);
+                        sprintf(cln_prof, "%s-clean", sbi->ll_lmd->lmd_profile);
 
-                        err = ll_process_log(sbi->ll_mds_uuid.uuid, 
-                                             sbi->ll_mds_peer_uuid.uuid, 
-                                             cln_prof, &cfg);
+                        err = lustre_process_log(sbi->ll_lmd, cln_prof, &cfg);
                         if (err < 0) 
                                 CERROR("Unable to process log: %s\n", cln_prof);
                         OBD_FREE(cln_prof, len);
                         OBD_FREE(sbi->ll_instance, strlen(sbi->ll_instance)+ 1);
                 }
-                OBD_FREE(sbi->ll_profile, strlen(sbi->ll_profile) + 1);
+                OBD_FREE(sbi->ll_lmd, sizeof(*sbi->ll_lmd));
         }
-        lprocfs_unregister_mountpoint(sbi);
-        OBD_FREE(sbi, sizeof(*sbi));
+        lustre_free_sbi(sb);
 
         goto out_dev;
-} /* ll_read_super */
+} /* lustre_fill_super */
 
-void ll_put_super(struct super_block *sb)
+void lustre_put_super(struct super_block *sb)
 {
         struct ll_sb_info *sbi = ll_s2sbi(sb);
-        struct hlist_node *tmp, *next;
         ENTRY;
 
         CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
 
-        list_del(&sbi->ll_conn_chain);
-        obd_disconnect(sbi->ll_osc_exp, 0);
-
-        lprocfs_unregister_mountpoint(sbi);
-        if (sbi->ll_proc_root) {
-                lprocfs_remove(sbi->ll_proc_root);
-                sbi->ll_proc_root = NULL;
-        }
-
-        obd_disconnect(sbi->ll_mdc_exp, 0);
+        lustre_common_put_super(sb);
 
-        // We do this to get rid of orphaned dentries. That is not really trw.
-        spin_lock(&dcache_lock);
-        hlist_for_each_safe(tmp, next, &sbi->ll_orphan_dentry_list) {
-                struct dentry *dentry = hlist_entry(tmp, struct dentry, d_hash);
-                shrink_dcache_parent(dentry);
-        }
-        spin_unlock(&dcache_lock);
-
-        if (sbi->ll_profile != NULL) {
+        if (sbi->ll_lmd != NULL) {
                 char * cln_prof;
-                int len = strlen(sbi->ll_profile) + sizeof("-clean") + 1;
+                int len = strlen(sbi->ll_lmd->lmd_profile) + sizeof("-clean")+1;
                 int err;
                 struct config_llog_instance cfg;
 
@@ -485,23 +607,21 @@ void ll_put_super(struct super_block *sb)
                 cfg.cfg_uuid = sbi->ll_sb_uuid;
 
                 OBD_ALLOC(cln_prof, len);
-                sprintf(cln_prof, "%s-clean", sbi->ll_profile);
+                sprintf(cln_prof, "%s-clean", sbi->ll_lmd->lmd_profile);
 
-                err = ll_process_log(sbi->ll_mds_uuid.uuid, 
-                                     sbi->ll_mds_peer_uuid.uuid, 
-                                     cln_prof, &cfg);
+                err = lustre_process_log(sbi->ll_lmd, cln_prof, &cfg);
                 if (err < 0)
                         CERROR("Unable to process log: %s\n", cln_prof);
 
                 OBD_FREE(cln_prof, len);
-                OBD_FREE(sbi->ll_profile, strlen(sbi->ll_profile) + 1);
+                OBD_FREE(sbi->ll_lmd, sizeof(*sbi->ll_lmd));
                 OBD_FREE(sbi->ll_instance, strlen(sbi->ll_instance) + 1);
         }
 
-        OBD_FREE(sbi, sizeof(*sbi));
+        lustre_free_sbi(sb);
 
         EXIT;
-} /* ll_put_super */
+} /* lustre_put_super */
 
 
 struct inode *ll_inode_from_lock(struct ldlm_lock *lock)
index 98d515a..2a8bfbb 100644 (file)
@@ -357,6 +357,9 @@ static int log_commit_thread(void *arg)
                         llcd_put(llcd);
         }
 
+        spin_lock(&lcm->lcm_thread_lock);
+        list_del(&lcd->lcd_lcm_list);
+        spin_unlock(&lcm->lcm_thread_lock);
         OBD_FREE(lcd, sizeof(*lcd));
 
         spin_lock(&lcm->lcm_thread_lock);