Whamcloud - gitweb
- moving start fid init from client_connect_obd() to ptlrpc_connect_interpret() when...
authoryury <yury>
Thu, 4 May 2006 11:44:11 +0000 (11:44 +0000)
committeryury <yury>
Thu, 4 May 2006 11:44:11 +0000 (11:44 +0000)
lustre/include/linux/obd.h
lustre/ldlm/ldlm_lib.c
lustre/mdc/mdc_request.c
lustre/ptlrpc/import.c

index 73ac0e4..0926854 100644 (file)
@@ -371,7 +371,7 @@ struct client_obd {
         int                      cl_qchk_stat; /* quotacheck stat of the peer */
 
         struct lu_fid            cl_fid;
-        spinlock_t               cl_fids_lock;
+        spinlock_t               cl_fid_lock;
 };
 #define obd2cli_tgt(obd) ((char *)(obd)->u.cli.cl_target_uuid.uuid)
 
index babf5f6..072efe0 100644 (file)
@@ -258,7 +258,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg* lcfg)
         cli->cl_w_in_flight = 0;
 
         memset(&cli->cl_fid, 0, sizeof(struct lu_fid));
-        spin_lock_init(&cli->cl_fids_lock);
+        spin_lock_init(&cli->cl_fid_lock);
 
         spin_lock_init(&cli->cl_read_rpc_hist.oh_lock);
         spin_lock_init(&cli->cl_write_rpc_hist.oh_lock);
@@ -397,16 +397,6 @@ int client_connect_import(struct lustre_handle *dlm_handle,
 
         ptlrpc_pinger_add_import(imp);
 
-        /* XXX: in principle we initialize start cl_fid by seq from MDS and
-         * start oid. But as connect is asynchronous, we should make sure that
-         * by this time server answered already with correct data (wait for
-         * connect finish). */
-        LASSERTF(ocd->ocd_seq != 0, "Asynchronous connect was not in "
-                 "time to return correct sequnece\n");
-        
-        cli->cl_fid.f_seq = ocd->ocd_seq;
-        cli->cl_fid.f_oid = LUSTRE_FID_INIT_OID;
-
         EXIT;
 
         if (rc) {
index 5c22c2a..dc9ad43 100644 (file)
@@ -1085,7 +1085,7 @@ static int mdc_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
         LASSERT(fid != NULL);
         LASSERT(hint != NULL);
 
-        spin_lock(&cli->cl_fids_lock);
+        spin_lock(&cli->cl_fid_lock);
         if (fid_oid(&cli->cl_fid) < LUSTRE_FID_SEQ_WIDTH) {
                 cli->cl_fid.f_oid += 1;
                 *fid = cli->cl_fid;
@@ -1094,7 +1094,7 @@ static int mdc_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
                        "new one is not yet implemented\n");
                 rc = -ERANGE;
         }
-        spin_unlock(&cli->cl_fids_lock);
+        spin_unlock(&cli->cl_fid_lock);
         RETURN(rc);
 }
 
index d046e78..7afd850 100644 (file)
@@ -566,6 +566,7 @@ finish:
                         RETURN(0);
                 }
         } else {
+                struct client_obd *cli = &imp->imp_obd->u.cli;
                 struct obd_connect_data *ocd;
                 struct obd_export *exp;
 
@@ -576,6 +577,13 @@ finish:
                         rc = -EPROTO;
                         GOTO(out, rc);
                 }
+
+                /* get correct start fid from connect data sent by server. */
+                spin_lock(&cli->cl_fid_lock);
+                cli->cl_fid.f_seq = ocd->ocd_seq;
+                cli->cl_fid.f_oid = LUSTRE_FID_INIT_OID;
+                spin_unlock(&cli->cl_fid_lock);
+
                 spin_lock_irqsave(&imp->imp_lock, flags);
                 
                 /*