From: yury Date: Thu, 4 May 2006 11:44:11 +0000 (+0000) Subject: - moving start fid init from client_connect_obd() to ptlrpc_connect_interpret() when... X-Git-Tag: v1_8_0_110~486^2~1886 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=ebd7700b36fd4f310d270ac97f24e0ef520e4350;p=fs%2Flustre-release.git - moving start fid init from client_connect_obd() to ptlrpc_connect_interpret() when actually answer form server comes and we can access connect data. --- diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index 73ac0e4..0926854 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -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) diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index babf5f6..072efe0 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -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) { diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 5c22c2a..dc9ad43 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -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); } diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index d046e78..7afd850 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -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); /*