Whamcloud - gitweb
LU-4135 mdt: restore mdt_save_lock() functionality
[fs/lustre-release.git] / lustre / obdclass / obd_mount_server.c
index 9b8b144..d028c37 100644 (file)
@@ -47,7 +47,6 @@
 #define PRINT_MASK (D_SUPER | D_CONFIG)
 
 #include <obd.h>
-#include <lvfs.h>
 #include <obd_class.h>
 #include <lustre/lustre_user.h>
 #include <linux/version.h>
@@ -515,7 +514,7 @@ static int lustre_lwp_connect(struct obd_device *lwp)
        if (rc != 0)
                RETURN(rc);
 
-       lu_context_init(&session_ctx, LCT_SESSION);
+       lu_context_init(&session_ctx, LCT_SERVER_SESSION);
        session_ctx.lc_thread = NULL;
        lu_context_enter(&session_ctx);
        env.le_ses = &session_ctx;
@@ -567,7 +566,6 @@ out:
  **/
 static int lustre_lwp_setup(struct lustre_cfg *lcfg, struct lustre_sb_info *lsi)
 {
-       struct obd_connect_data *data = NULL;
        struct obd_device       *obd;
        char                    *lwpname = NULL;
        char                    *lwpuuid = NULL;
@@ -612,8 +610,6 @@ static int lustre_lwp_setup(struct lustre_cfg *lcfg, struct lustre_sb_info *lsi)
        if (rc != 0)
                CERROR("%s: connect failed: rc = %d\n", lwpname, rc);
 out:
-       if (data != NULL)
-               OBD_FREE_PTR(data);
        if (lwpname != NULL)
                OBD_FREE(lwpname, MTI_NAME_MAXLEN);
        if (lwpuuid != NULL)
@@ -985,13 +981,9 @@ static int server_stop_servers(int lsiflags)
        }
 
        if (obd != NULL && (type == NULL || type->typ_refcnt == 0)) {
-               int err;
-
                obd->obd_force = 1;
                /* obd_fail doesn't mean much on a server obd */
-               err = class_manual_cleanup(obd);
-               if (rc != 0)
-                       rc = err;
+               rc = class_manual_cleanup(obd);
        }
 
        mutex_unlock(&server_start_lock);
@@ -1298,7 +1290,7 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt)
                if (rc == 0) {
                        struct lu_context  session_ctx;
 
-                       lu_context_init(&session_ctx, LCT_SESSION);
+                       lu_context_init(&session_ctx, LCT_SERVER_SESSION);
                        session_ctx.lc_thread = NULL;
                        lu_context_enter(&session_ctx);
                        env.le_ses = &session_ctx;
@@ -1362,7 +1354,7 @@ static int lsi_prepare(struct lustre_sb_info *lsi)
                strcpy(lsi->lsi_osd_type, LUSTRE_OSD_LDISKFS_NAME);
        }
 
-       /* XXX: a temp. solution for components using fsfilt
+       /* XXX: a temp. solution for components using ldiskfs
         *      to be removed in one of the subsequent patches */
        if (!strcmp(lsi->lsi_lmd->lmd_osd_type, "osd-ldiskfs"))
                strcpy(lsi->lsi_fstype, "ldiskfs");
@@ -1663,14 +1655,18 @@ static int osd_start(struct lustre_sb_info *lsi, unsigned long mflags)
                obd->obd_force = 1;
                class_manual_cleanup(obd);
                lsi->lsi_dt_dev = NULL;
+               RETURN(rc);
        }
 
-       /* XXX: to keep support old components relying on lsi_srv_mnt
-        *      we get this info from OSD just started */
        LASSERT(obd->obd_lu_dev);
+       lu_device_get(obd->obd_lu_dev);
        lsi->lsi_dt_dev = lu2dt_dev(obd->obd_lu_dev);
        LASSERT(lsi->lsi_dt_dev);
 
+       /* set disk context for llog usage */
+       OBD_SET_CTXT_MAGIC(&obd->obd_lvfs_ctxt);
+       obd->obd_lvfs_ctxt.dt = lsi->lsi_dt_dev;
+
        dt_conf_get(NULL, lsi->lsi_dt_dev, &p);
 
        lsi->lsi_srv_mnt = p.ddp_mnt;