Whamcloud - gitweb
Branch HEAD
authorvitaly <vitaly>
Tue, 16 Jun 2009 12:31:38 +0000 (12:31 +0000)
committervitaly <vitaly>
Tue, 16 Jun 2009 12:31:38 +0000 (12:31 +0000)
b=19154
i=adilger
i=tappro

propagate mount count down the mdt stack so it could be properly used in llog
to send it on the connection to ost.

17 files changed:
lustre/cmm/cmm_device.c
lustre/cmm/cmm_internal.h
lustre/cmm/cmm_split.c
lustre/cmm/mdc_device.c
lustre/include/lclient.h
lustre/include/lustre_log.h
lustre/include/md_object.h
lustre/include/obd.h
lustre/include/obd_class.h
lustre/lclient/lcommon_misc.c
lustre/mdd/mdd_lov.c
lustre/mds/mds_lov.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_recovery.c
lustre/obdclass/llog_obd.c
lustre/ptlrpc/llog_net.c
lustre/tests/replay-single.sh

index 73636ea..deda49e 100644 (file)
@@ -662,7 +662,7 @@ static const struct lu_device_operations cmm_lu_ops = {
 
 /* --- lu_device_type operations --- */
 int cmm_upcall(const struct lu_env *env, struct md_device *md,
-               enum md_upcall_event ev)
+               enum md_upcall_event ev, void *data)
 {
         int rc;
         ENTRY;
@@ -674,7 +674,7 @@ int cmm_upcall(const struct lu_env *env, struct md_device *md,
                                 CERROR("can not init md size %d\n", rc);
                         /* fall through */
                 default:
-                        rc = md_do_upcall(env, md, ev);
+                        rc = md_do_upcall(env, md, ev, data);
         }
         RETURN(rc);
 }
index 4dc359f..36e9b16 100644 (file)
@@ -196,7 +196,7 @@ static inline struct cml_object *cmm2cml_obj(struct cmm_object *co)
 }
 
 int cmm_upcall(const struct lu_env *env, struct md_device *md,
-               enum md_upcall_event ev);
+               enum md_upcall_event ev, void *data);
 
 #ifdef HAVE_SPLIT_SUPPORT
 
index 8cb4cd9..4487876 100644 (file)
@@ -674,7 +674,7 @@ int cmm_split_dir(const struct lu_env *env, struct md_object *mo)
          * Disable transacrions for split, since there will be so many trans in
          * this one ops, conflict with current recovery design.
          */
-        rc = cmm_upcall(env, &cmm->cmm_md_dev, MD_NO_TRANS);
+        rc = cmm_upcall(env, &cmm->cmm_md_dev, MD_NO_TRANS, NULL);
         if (rc) {
                 CERROR("Can't disable trans for split, rc %d\n", rc);
                 GOTO(out, rc);
index d3a7c3b..51386de 100644 (file)
@@ -64,7 +64,7 @@ static const struct md_device_operations mdc_md_ops = { 0 };
 
 static int mdc_obd_update(struct obd_device *host,
                           struct obd_device *watched,
-                          enum obd_notify_event ev, void *owner)
+                          enum obd_notify_event ev, void *owner, void *data)
 {
         struct mdc_device *mc = owner;
         int rc = 0;
index 8b86063..8c2ec3c 100644 (file)
@@ -390,7 +390,7 @@ __u16 ll_dirent_type_get(struct lu_dirent *ent);
 int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp);
 int cl_ocd_update(struct obd_device *host,
                   struct obd_device *watched,
-                  enum obd_notify_event ev, void *owner);
+                  enum obd_notify_event ev, void *owner, void *data);
 
 struct ccc_grouplock {
         struct lu_env   *cg_env;
index ad6e6ca..e5f5cad 100644 (file)
@@ -382,6 +382,7 @@ static inline void llog_gen_init(struct llog_ctxt *ctxt)
                 ctxt->loc_gen.mnt_cnt = obd->u.filter.fo_mount_count;
         else
                 ctxt->loc_gen.mnt_cnt = 0;
+        ctxt->loc_gen.conn_cnt++;
 }
 
 static inline int llog_gen_lt(struct llog_gen a, struct llog_gen b)
@@ -393,7 +394,6 @@ static inline int llog_gen_lt(struct llog_gen a, struct llog_gen b)
         return(a.conn_cnt < b.conn_cnt ? 1 : 0);
 }
 
-#define LLOG_GEN_INC(gen)  ((gen).conn_cnt ++)
 #define LLOG_PROC_BREAK 0x0001
 #define LLOG_DEL_RECORD 0x0002
 
index f69fac5..6f818b5 100644 (file)
@@ -428,7 +428,7 @@ struct md_upcall {
         struct md_device       *mu_upcall_dev;
         /** upcall function */
         int (*mu_upcall)(const struct lu_env *env, struct md_device *md,
-                         enum md_upcall_event ev);
+                         enum md_upcall_event ev, void *data);
 };
 
 struct md_device {
@@ -460,14 +460,15 @@ static inline void md_upcall_fini(struct md_device *m)
 }
 
 static inline int md_do_upcall(const struct lu_env *env, struct md_device *m,
-                               enum md_upcall_event ev)
+                               enum md_upcall_event ev, void *data)
 {
         int rc = 0;
         down_read(&m->md_upcall.mu_upcall_sem);
         if (m->md_upcall.mu_upcall_dev != NULL &&
             m->md_upcall.mu_upcall_dev->md_upcall.mu_upcall != NULL) {
                 rc = m->md_upcall.mu_upcall_dev->md_upcall.mu_upcall(env,
-                                              m->md_upcall.mu_upcall_dev, ev);
+                                              m->md_upcall.mu_upcall_dev,
+                                              ev, data);
         }
         up_read(&m->md_upcall.mu_upcall_sem);
         return rc;
index 36d8c01..e596a23 100644 (file)
@@ -945,7 +945,7 @@ enum config_flags {
  */
 struct obd_notify_upcall {
         int (*onu_upcall)(struct obd_device *host, struct obd_device *watched,
-                          enum obd_notify_event ev, void *owner);
+                          enum obd_notify_event ev, void *owner, void *data);
         /* Opaque datum supplied by upper layer listener */
         void *onu_owner;
 };
index 96b9a7d..07f783d 100644 (file)
@@ -1495,7 +1495,8 @@ static inline int obd_notify_observer(struct obd_device *observer,
          */
         onu = &observer->obd_upcall;
         if (onu->onu_upcall != NULL)
-                rc2 = onu->onu_upcall(observer, observed, ev, onu->onu_owner);
+                rc2 = onu->onu_upcall(observer, observed, ev,
+                                      onu->onu_owner, NULL);
         else
                 rc2 = 0;
 
index 62a1ca5..ce9b14d 100644 (file)
@@ -88,7 +88,7 @@ int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp)
  */
 int cl_ocd_update(struct obd_device *host,
                   struct obd_device *watched,
-                  enum obd_notify_event ev, void *owner)
+                  enum obd_notify_event ev, void *owner, void *data)
 {
         struct lustre_client_ocd *lco;
         struct client_obd        *cli;
index 4dd8dbf..eddfebc 100644 (file)
@@ -60,7 +60,7 @@
 #include "mdd_internal.h"
 
 static int mdd_notify(struct obd_device *host, struct obd_device *watched,
-                      enum obd_notify_event ev, void *owner)
+                      enum obd_notify_event ev, void *owner, void *data)
 {
         struct mdd_device *mdd = owner;
         int rc = 0;
@@ -72,14 +72,17 @@ static int mdd_notify(struct obd_device *host, struct obd_device *watched,
                 case OBD_NOTIFY_ACTIVE:
                 case OBD_NOTIFY_SYNC:
                 case OBD_NOTIFY_SYNC_NONBLOCK:
-                        rc = md_do_upcall(NULL, &mdd->mdd_md_dev, MD_LOV_SYNC);
+                        rc = md_do_upcall(NULL, &mdd->mdd_md_dev,
+                                          MD_LOV_SYNC, data);
                         break;
                 case OBD_NOTIFY_CONFIG:
-                        rc = md_do_upcall(NULL, &mdd->mdd_md_dev, MD_LOV_CONFIG);
+                        rc = md_do_upcall(NULL, &mdd->mdd_md_dev,
+                                          MD_LOV_CONFIG, data);
                         break;
 #ifdef HAVE_QUOTA_SUPPORT
                 case OBD_NOTIFY_QUOTA:
-                        rc = md_do_upcall(NULL, &mdd->mdd_md_dev, MD_LOV_QUOTA);
+                        rc = md_do_upcall(NULL, &mdd->mdd_md_dev,
+                                          MD_LOV_QUOTA, data);
                         break;
 #endif
                 default:
index c7a0f80..dd903df 100644 (file)
@@ -545,7 +545,8 @@ static int mds_lov_update_desc(struct obd_device *obd, int idx,
         if (obd->obd_upcall.onu_owner) {
                  LASSERT(obd->obd_upcall.onu_upcall != NULL);
                  rc = obd->obd_upcall.onu_upcall(obd, NULL, ev,
-                                                 obd->obd_upcall.onu_owner);
+                                                 obd->obd_upcall.onu_owner,
+                                                 &mds->mds_mount_count);
         }
 out:
         OBD_FREE(ld, sizeof(*ld));
@@ -824,7 +825,7 @@ static int __mds_lov_synchronize(void *data)
                  */
                 LASSERT(obd->obd_upcall.onu_upcall != NULL);
                 rc = obd->obd_upcall.onu_upcall(obd, NULL, OBD_NOTIFY_QUOTA,
-                                                obd->obd_upcall.onu_owner);
+                                                obd->obd_upcall.onu_owner,NULL);
         }
 #endif
         EXIT;
index d596372..39ffd89 100644 (file)
@@ -5315,7 +5315,7 @@ static void mdt_allow_cli(struct mdt_device *m, unsigned int flag)
 }
 
 static int mdt_upcall(const struct lu_env *env, struct md_device *md,
-                      enum md_upcall_event ev)
+                      enum md_upcall_event ev, void *data)
 {
         struct mdt_device *m = mdt_dev(&md->md_lu_dev);
         struct md_device  *next  = m->mdt_child;
@@ -5331,6 +5331,8 @@ static int mdt_upcall(const struct lu_env *env, struct md_device *md,
                         CDEBUG(D_INFO, "get max mdsize %d max cookiesize %d\n",
                                      m->mdt_max_mdsize, m->mdt_max_cookiesize);
                         mdt_allow_cli(m, CONFIG_SYNC);
+                        if (data)
+                                (*(__u64 *)data) = m->mdt_mount_count;
                         break;
                 case MD_NO_TRANS:
                         mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
index 8b8ae00..0d794a1 100644 (file)
@@ -482,7 +482,7 @@ static int mdt_server_data_init(const struct lu_env *env,
         obd->obd_last_committed = mdt->mdt_last_transno;
         spin_unlock(&mdt->mdt_transno_lock);
 
-        mdt->mdt_mount_count++;
+        mdt->mdt_mount_count = mount_count + 1;
         lsd->lsd_mount_count = mdt->mdt_mount_count;
 
         /* save it, so mount count and last_transno is current */
index 41fb346..4453be1 100644 (file)
@@ -353,7 +353,6 @@ int llog_obd_origin_setup(struct obd_device *obd, struct obd_llog_group *olg,
         ctxt = llog_group_get_ctxt(olg, index);
         if (!ctxt)
                 RETURN(-ENODEV);
-        llog_gen_init(ctxt);
 
         if (logid && logid->lgl_oid) {
                 rc = llog_create(ctxt, &handle, logid, NULL);
index a195f96..00bdd58 100644 (file)
@@ -82,7 +82,7 @@ int llog_origin_connect(struct llog_ctxt *ctxt,
         }
 
         /* FIXME what value for gen->conn_cnt */
-        LLOG_GEN_INC(ctxt->loc_gen);
+        llog_gen_init(ctxt);
 
         /* first add llog_gen_rec */
         OBD_ALLOC_PTR(lgr);
@@ -116,6 +116,10 @@ int llog_origin_connect(struct llog_ctxt *ctxt,
         if (req == NULL)
                 RETURN(-ENOMEM);
 
+        CDEBUG(D_OTHER, "%s mount_count %llu, connection count %llu\n",
+               ctxt->loc_exp->exp_obd->obd_type->typ_name,
+               ctxt->loc_gen.mnt_cnt, ctxt->loc_gen.conn_cnt);
+
         req_body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_CONN_BODY);
         req_body->lgdc_gen = ctxt->loc_gen;
         req_body->lgdc_logid = ctxt->loc_handle->lgh_id;
index efc2f0a..74fe997 100755 (executable)
@@ -460,12 +460,6 @@ test_20a() {       # was test_20
 run_test 20a "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
 
 test_20b() { # bug 10480
-    # XXX increase the debug level temporary 
-    DEBUG_SAVED=$PTLDEBUG
-    DEBUG_MB_SAVED=$DEBUG_SIZE
-    PTLDEBUG=0x33f1404
-    DEBUG_SIZE=150
-    do_nodes $(comma_list $(nodes_list)) "$LCTL set_param debug=$PTLDEBUG; $LCTL set_param debug_mb=$DEBUG_SIZE"
     BEFOREUSED=`df -P $DIR | tail -1 | awk '{ print $3 }'`
 
     dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 &
@@ -490,10 +484,6 @@ test_20b() { # bug 10480
     log "before $BEFOREUSED, after $AFTERUSED"
     [ $AFTERUSED -gt $((BEFOREUSED + 20)) ] && \
         error "after $AFTERUSED > before $BEFOREUSED"
-    # XXX decrease it back
-    PTLDEBUG=$DEBUG_SAVED
-    DEBUG_SIZE=$DEBUG_MB_SAVED
-    do_nodes $(comma_list $(nodes_list)) "$LCTL set_param debug=$PTLDEBUG; $LCTL set_param debug_mb=$DEBUG_SIZE"
     return 0
 }
 run_test 20b "write, unlink, eviction, replay, (test mds_cleanup_orphans)"