Whamcloud - gitweb
b=23645 warning at lookup_one_len() durning mount
[fs/lustre-release.git] / lustre / mds / handler.c
index a3e34df..ad0947b 100644 (file)
@@ -26,7 +26,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -46,7 +46,6 @@
 #include <lustre_mds.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/random.h>
 #include <linux/fs.h>
 #include <linux/jbd.h>
 #include <linux/smp_lock.h>
@@ -118,7 +117,7 @@ struct dentry *mds_fid2dentry(struct mds_obd *mds, struct ll_fid *fid,
         }
 
         if (mnt) {
-                *mnt = mds->mds_vfsmnt;
+                *mnt = mds->mds_obt.obt_vfsmnt;
                 mntget(*mnt);
         }
 
@@ -149,7 +148,7 @@ static int mds_lov_presetup (struct mds_obd *mds, struct lustre_cfg *lcfg)
 static int mds_lov_clean(struct obd_device *obd)
 {
         struct mds_obd *mds = &obd->u.mds;
-        struct obd_device *osc = mds->mds_osc_obd;
+        struct obd_device *osc = mds->mds_lov_obd;
         ENTRY;
 
         if (mds->mds_profile) {
@@ -171,7 +170,7 @@ static int mds_lov_clean(struct obd_device *obd)
         osc->obd_fail = obd->obd_fail;
 
         /* Cleanup the lov */
-        obd_disconnect(mds->mds_osc_exp);
+        obd_disconnect(mds->mds_lov_exp);
         class_manual_cleanup(osc);
 
         RETURN(0);
@@ -194,6 +193,8 @@ static int mds_postsetup(struct obd_device *obd)
         if (rc)
                 GOTO(err_llog, rc);
 
+        mds_changelog_llog_init(obd, obd);
+
         if (mds->mds_profile) {
                 struct lustre_profile *lprof;
                 /* The profile defines which osc and mdc to connect to, for a
@@ -245,7 +246,7 @@ int mds_postrecov(struct obd_device *obd)
         /* Notify the LOV, which will in turn call mds_notify for each tgt */
         /* This means that we have to hack obd_notify to think we're obd_set_up
            during mds_lov_connect. */
-        obd_notify(obd->u.mds.mds_osc_obd, NULL,
+        obd_notify(obd->u.mds.mds_lov_obd, NULL,
                    obd->obd_async_recov ? OBD_NOTIFY_SYNC_NONBLOCK :
                    OBD_NOTIFY_SYNC, NULL);
 
@@ -256,7 +257,7 @@ int mds_postrecov(struct obd_device *obd)
 static int mds_lov_early_clean(struct obd_device *obd)
 {
         struct mds_obd *mds = &obd->u.mds;
-        struct obd_device *osc = mds->mds_osc_obd;
+        struct obd_device *osc = mds->mds_lov_obd;
 
         if (!osc || (!obd->obd_force && !obd->obd_fail))
                 return(0);
@@ -267,8 +268,9 @@ static int mds_lov_early_clean(struct obd_device *obd)
 
 static int mds_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
 {
-        int rc = 0;
         struct mds_obd *mds = &obd->u.mds;
+        struct llog_ctxt *ctxt;
+        int rc = 0;
         ENTRY;
 
         switch (stage) {
@@ -276,14 +278,18 @@ static int mds_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
                 break;
         case OBD_CLEANUP_EXPORTS:
                 mds_lov_early_clean(obd);
-                down_write(&mds->mds_notify_lock);
+                cfs_down_write(&mds->mds_notify_lock);
                 mds_lov_disconnect(obd);
                 mds_lov_clean(obd);
-                llog_cleanup(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT));
-                llog_cleanup(llog_get_context(obd, LLOG_LOVEA_ORIG_CTXT));
+                ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
+                if (ctxt)
+                        llog_cleanup(ctxt);
+                ctxt = llog_get_context(obd, LLOG_LOVEA_ORIG_CTXT);
+                if (ctxt)
+                        llog_cleanup(ctxt);
                 rc = obd_llog_finish(obd, 0);
-                mds->mds_osc_exp = NULL;
-                up_write(&mds->mds_notify_lock);
+                mds->mds_lov_exp = NULL;
+                cfs_up_write(&mds->mds_notify_lock);
                 break;
         }
         RETURN(rc);
@@ -308,10 +314,10 @@ static void mds_init_ctxt(struct obd_device *obd, struct vfsmount *mnt)
 {
         struct mds_obd *mds = &obd->u.mds;
 
-        mds->mds_vfsmnt = mnt;
+        mds->mds_obt.obt_vfsmnt = mnt;
         /* why not mnt->mnt_sb instead of mnt->mnt_root->d_inode->i_sb? */
         obd->u.obt.obt_sb = mnt->mnt_root->d_inode->i_sb;
-
+        obd->u.obt.obt_magic = OBT_MAGIC;
         fsfilt_setup(obd, obd->u.obt.obt_sb);
 
         OBD_SET_CTXT_MAGIC(&obd->obd_lvfs_ctxt);
@@ -353,9 +359,9 @@ static int mds_cmd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
          * we need only lmi here but not get mount
          * OSD did mount already, so put mount back
          */
-        atomic_dec(&lsi->lsi_mounts);
+        cfs_atomic_dec(&lsi->lsi_mounts);
         mntput(mnt);
-        init_rwsem(&mds->mds_notify_lock);
+        cfs_init_rwsem(&mds->mds_notify_lock);
 
         obd->obd_fsops = fsfilt_get_ops(MT_STR(lsi->lsi_ldd));
         mds_init_ctxt(obd, mnt);
@@ -369,7 +375,7 @@ static int mds_cmd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
         }
         mds->mds_objects_dir = dentry;
 
-        dentry = lookup_one_len("__iopen__", current->fs->pwd,
+        dentry = ll_lookup_one_len("__iopen__", current->fs->pwd,
                                 strlen("__iopen__"));
         if (IS_ERR(dentry)) {
                 rc = PTR_ERR(dentry);
@@ -404,9 +410,6 @@ static int mds_cmd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
         if (rc)
                 GOTO(err_objects, rc);
 
-        mds->mds_max_mdsize = sizeof(struct lov_mds_md_v3);
-        mds->mds_max_cookiesize = sizeof(struct llog_cookie);
-
 err_pop:
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         RETURN(rc);
@@ -426,7 +429,7 @@ static int mds_cmd_cleanup(struct obd_device *obd)
         int rc = 0;
         ENTRY;
 
-        mds->mds_osc_exp = NULL;
+        mds->mds_lov_exp = NULL;
 
         if (obd->obd_fail)
                 LCONSOLE_WARN("%s: shutting down for failover; client state "
@@ -444,9 +447,9 @@ static int mds_cmd_cleanup(struct obd_device *obd)
                 mds->mds_objects_dir = NULL;
         }
 
-        shrink_dcache_parent(mds->mds_fid_de);
         dput(mds->mds_fid_de);
         LL_DQUOT_OFF(obd->u.obt.obt_sb);
+        shrink_dcache_sb(mds->mds_obt.obt_sb);
         fsfilt_put_ops(obd->obd_fsops);
 
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
@@ -481,7 +484,7 @@ static int __init mds_cmd_init(void)
         struct lprocfs_static_vars lvars;
         int rc;
 
-        request_module("lquota");
+        cfs_request_module("%s", "lquota");
         mds_quota_interface_ref = PORTAL_SYMBOL_GET(mds_quota_interface);
         rc = lquota_init(mds_quota_interface_ref);
         if (rc) {