ptlrpc_request_set_replen(req);
- if (seq->lcs_type == LUSTRE_SEQ_METADATA) {
- req->rq_request_portal = SEQ_METADATA_PORTAL;
+ in->lsr_index = seq->lcs_space.lsr_index;
+ if (seq->lcs_type == LUSTRE_SEQ_METADATA)
in->lsr_flags = LU_SEQ_RANGE_MDT;
- } else {
- LASSERTF(seq->lcs_type == LUSTRE_SEQ_DATA,
- "unknown lcs_type %u\n", seq->lcs_type);
- req->rq_request_portal = SEQ_DATA_PORTAL;
+ else
in->lsr_flags = LU_SEQ_RANGE_OST;
- }
if (opc == SEQ_ALLOC_SUPER) {
- /* Update index field of *in, it is required for
- * FLD update on super sequence allocator node. */
- in->lsr_index = seq->lcs_space.lsr_index;
req->rq_request_portal = SEQ_CONTROLLER_PORTAL;
+ req->rq_reply_portal = MDC_REPLY_PORTAL;
+ /* During allocating super sequence for data object,
+ * the current thread might hold the export of MDT0(MDT0
+ * precreating objects on this OST), and it will send the
+ * request to MDT0 here, so we can not keep resending the
+ * request here, otherwise if MDT0 is failed(umounted),
+ * it can not release the export of MDT0 */
+ if (seq->lcs_type == LUSTRE_SEQ_DATA)
+ req->rq_no_delay = req->rq_no_resend = 1;
debug_mask = D_CONSOLE;
} else {
+ if (seq->lcs_type == LUSTRE_SEQ_METADATA)
+ req->rq_request_portal = SEQ_METADATA_PORTAL;
+ else
+ req->rq_request_portal = SEQ_DATA_PORTAL;
debug_mask = D_INFO;
- LASSERTF(opc == SEQ_ALLOC_META,
- "unknown opcode %u\n, opc", opc);
}
ptlrpc_at_set_req_timeout(req);
- mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
+ if (seq->lcs_type == LUSTRE_SEQ_METADATA)
+ mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
rc = ptlrpc_queue_wait(req);
- mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
-
+ if (seq->lcs_type == LUSTRE_SEQ_METADATA)
+ mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
if (rc)
GOTO(out_req, rc);
env);
} else {
#endif
- rc = seq_client_rpc(seq, &seq->lcs_space,
+ /* Check whether the connection to seq controller has been
+ * setup (lcs_exp != NULL) */
+ if (seq->lcs_exp == NULL) {
+ mutex_unlock(&seq->lcs_mutex);
+ RETURN(-EINPROGRESS);
+ }
+
+ rc = seq_client_rpc(seq, &seq->lcs_space,
SEQ_ALLOC_SUPER, "super");
#ifdef __KERNEL__
}
rc = seq_server_alloc_meta(seq->lcs_srv, &seq->lcs_space, env);
} else {
#endif
- rc = seq_client_rpc(seq, &seq->lcs_space,
- SEQ_ALLOC_META, "meta");
+ do {
+ /* If meta server return -EINPROGRESS or EAGAIN,
+ * it means meta server might not be ready to
+ * allocate super sequence from sequence controller
+ * (MDT0)yet */
+ rc = seq_client_rpc(seq, &seq->lcs_space,
+ SEQ_ALLOC_META, "meta");
+ } while (rc == -EINPROGRESS || rc == -EAGAIN);
#ifdef __KERNEL__
}
#endif
cfs_waitq_signal(&seq->lcs_waitq);
}
-/* Allocate the whole seq to the caller*/
+/**
+ * Allocate the whole seq to the caller, currently it would be
+ * only used by echo client to access MDT
+ **/
int seq_client_get_seq(const struct lu_env *env,
struct lu_client_seq *seq, seqno_t *seqnr)
{
CDEBUG(D_INFO, "%s: allocate sequence "
"[0x%16.16"LPF64"x]\n", seq->lcs_name, *seqnr);
- /*Since the caller require the whole seq,
- *so marked this seq to be used*/
+ /* Since the caller require the whole seq,
+ * so marked this seq to be used */
+ LASSERT(seq->lcs_type == LUSTRE_SEQ_METADATA);
seq->lcs_fid.f_oid = LUSTRE_METADATA_SEQ_MAX_WIDTH;
seq->lcs_fid.f_seq = *seqnr;
seq->lcs_fid.f_ver = 0;
GOTO(out, err);
}
- err = obd_fid_init(sbi->ll_md_exp);
- if (err) {
- CERROR("Can't init metadata layer FID infrastructure, "
- "rc %d\n", err);
- GOTO(out_md, err);
- }
+ err = obd_statfs(NULL, sbi->ll_md_exp, osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), 0);
+ if (err)
+ GOTO(out_md, err);
+
+ /* This needs to be after statfs to ensure connect has finished.
+ * Note that "data" does NOT contain the valid connect reply.
+ * If connecting to a 1.8 server there will be no LMV device, so
+ * we can access the MDC export directly and exp_connect_flags will
+ * be non-zero, but if accessing an upgraded 2.1 server it will
+ * have the correct flags filled in.
+ * XXX: fill in the LMV exp_connect_flags from MDC(s). */
+ valid = sbi->ll_md_exp->exp_connect_flags & CLIENT_CONNECT_MDT_REQD;
+ if (sbi->ll_md_exp->exp_connect_flags != 0 &&
+ valid != CLIENT_CONNECT_MDT_REQD) {
+ char *buf;
+
+ OBD_ALLOC_WAIT(buf, CFS_PAGE_SIZE);
+ obd_connect_flags2str(buf, CFS_PAGE_SIZE,
+ valid ^ CLIENT_CONNECT_MDT_REQD, ",");
+ LCONSOLE_ERROR_MSG(0x170, "Server %s does not support "
+ "feature(s) needed for correct operation "
+ "of this client (%s). Please upgrade "
+ "server or downgrade client.\n",
+ sbi->ll_md_exp->exp_obd->obd_name, buf);
+ OBD_FREE(buf, CFS_PAGE_SIZE);
+ GOTO(out_md, err = -EPROTO);
+ }
- err = obd_statfs(NULL, sbi->ll_md_exp, osfs,
- cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), 0);
- if (err)
- GOTO(out_md_fid, err);
-
- /* This needs to be after statfs to ensure connect has finished.
- * Note that "data" does NOT contain the valid connect reply.
- * If connecting to a 1.8 server there will be no LMV device, so
- * we can access the MDC export directly and exp_connect_flags will
- * be non-zero, but if accessing an upgraded 2.1 server it will
- * have the correct flags filled in.
- * XXX: fill in the LMV exp_connect_flags from MDC(s). */
- valid = sbi->ll_md_exp->exp_connect_flags & CLIENT_CONNECT_MDT_REQD;
- if (sbi->ll_md_exp->exp_connect_flags != 0 &&
- valid != CLIENT_CONNECT_MDT_REQD) {
- char *buf;
-
- OBD_ALLOC_WAIT(buf, CFS_PAGE_SIZE);
- obd_connect_flags2str(buf, CFS_PAGE_SIZE,
- valid ^ CLIENT_CONNECT_MDT_REQD, ",");
- LCONSOLE_ERROR_MSG(0x170, "Server %s does not support "
- "feature(s) needed for correct operation "
- "of this client (%s). Please upgrade "
- "server or downgrade client.\n",
- sbi->ll_md_exp->exp_obd->obd_name, buf);
- OBD_FREE(buf, CFS_PAGE_SIZE);
- GOTO(out_md, err = -EPROTO);
- }
-
- size = sizeof(*data);
- err = obd_get_info(NULL, sbi->ll_md_exp, sizeof(KEY_CONN_DATA),
- KEY_CONN_DATA, &size, data, NULL);
- if (err) {
- CERROR("Get connect data failed: %d \n", err);
- GOTO(out_md, err);
- }
+ size = sizeof(*data);
+ err = obd_get_info(NULL, sbi->ll_md_exp, sizeof(KEY_CONN_DATA),
+ KEY_CONN_DATA, &size, data, NULL);
+ if (err) {
+ CERROR("%s: Get connect data failed: rc = %d\n",
+ sbi->ll_md_exp->exp_obd->obd_name, err);
+ GOTO(out_md, err);
+ }
LASSERT(osfs->os_bsize);
sb->s_blocksize = osfs->os_bsize;
sbi->ll_flags |= LL_SBI_LAYOUT_LOCK;
}
- obd = class_name2obd(dt);
- if (!obd) {
- CERROR("DT %s: not setup or attached\n", dt);
- GOTO(out_md_fid, err = -ENODEV);
- }
+ obd = class_name2obd(dt);
+ if (!obd) {
+ CERROR("DT %s: not setup or attached\n", dt);
+ GOTO(out_md, err = -ENODEV);
+ }
data->ocd_connect_flags = OBD_CONNECT_GRANT | OBD_CONNECT_VERSION |
OBD_CONNECT_REQPORTAL | OBD_CONNECT_BRW_SIZE |
data->ocd_brw_size = PTLRPC_MAX_BRW_SIZE;
- err = obd_connect(NULL, &sbi->ll_dt_exp, obd, &sbi->ll_sb_uuid, data, NULL);
- if (err == -EBUSY) {
- LCONSOLE_ERROR_MSG(0x150, "An OST (dt %s) is performing "
- "recovery, of which this client is not a "
- "part. Please wait for recovery to "
- "complete, abort, or time out.\n", dt);
- GOTO(out_md_fid, err);
- } else if (err) {
- CERROR("Cannot connect to %s: rc = %d\n", dt, err);
- GOTO(out_md_fid, err);
- }
-
- err = obd_fid_init(sbi->ll_dt_exp);
- if (err) {
- CERROR("Can't init data layer FID infrastructure, "
- "rc %d\n", err);
- GOTO(out_dt, err);
- }
+ err = obd_connect(NULL, &sbi->ll_dt_exp, obd, &sbi->ll_sb_uuid, data,
+ NULL);
+ if (err == -EBUSY) {
+ LCONSOLE_ERROR_MSG(0x150, "An OST (dt %s) is performing "
+ "recovery, of which this client is not a "
+ "part. Please wait for recovery to "
+ "complete, abort, or time out.\n", dt);
+ GOTO(out_md, err);
+ } else if (err) {
+ CERROR("%s: Cannot connect to %s: rc = %d\n",
+ sbi->ll_dt_exp->exp_obd->obd_name, dt, err);
+ GOTO(out_md, err);
+ }
mutex_lock(&sbi->ll_lco.lco_lock);
- sbi->ll_lco.lco_flags = data->ocd_connect_flags;
- sbi->ll_lco.lco_md_exp = sbi->ll_md_exp;
- sbi->ll_lco.lco_dt_exp = sbi->ll_dt_exp;
+ sbi->ll_lco.lco_flags = data->ocd_connect_flags;
+ sbi->ll_lco.lco_md_exp = sbi->ll_md_exp;
+ sbi->ll_lco.lco_dt_exp = sbi->ll_dt_exp;
mutex_unlock(&sbi->ll_lco.lco_lock);
- fid_zero(&sbi->ll_root_fid);
- err = md_getstatus(sbi->ll_md_exp, &sbi->ll_root_fid, &oc);
- if (err) {
- CERROR("cannot mds_connect: rc = %d\n", err);
- GOTO(out_lock_cn_cb, err);
- }
- if (!fid_is_sane(&sbi->ll_root_fid)) {
- CERROR("Invalid root fid during mount\n");
- GOTO(out_lock_cn_cb, err = -EINVAL);
- }
- CDEBUG(D_SUPER, "rootfid "DFID"\n", PFID(&sbi->ll_root_fid));
+ fid_zero(&sbi->ll_root_fid);
+ err = md_getstatus(sbi->ll_md_exp, &sbi->ll_root_fid, &oc);
+ if (err) {
+ CERROR("cannot mds_connect: rc = %d\n", err);
+ GOTO(out_dt, err);
+ }
+ if (!fid_is_sane(&sbi->ll_root_fid)) {
+ CERROR("%s: Invalid root fid "DFID" during mount\n",
+ sbi->ll_md_exp->exp_obd->obd_name,
+ PFID(&sbi->ll_root_fid));
+ GOTO(out_dt, err = -EINVAL);
+ }
+ CDEBUG(D_SUPER, "rootfid "DFID"\n", PFID(&sbi->ll_root_fid));
- sb->s_op = &lustre_super_operations;
+ sb->s_op = &lustre_super_operations;
#if THREAD_SIZE >= 8192 /*b=17630*/
sb->s_export_op = &lustre_export_operations;
#endif
- /* make root inode
- * XXX: move this to after cbd setup? */
- valid = OBD_MD_FLGETATTR | OBD_MD_FLBLOCKS | OBD_MD_FLMDSCAPA;
- if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
- valid |= OBD_MD_FLRMTPERM;
- else if (sbi->ll_flags & LL_SBI_ACL)
- valid |= OBD_MD_FLACL;
-
- OBD_ALLOC_PTR(op_data);
- if (op_data == NULL)
- GOTO(out_lock_cn_cb, err = -ENOMEM);
-
- op_data->op_fid1 = sbi->ll_root_fid;
- op_data->op_mode = 0;
- op_data->op_capa1 = oc;
- op_data->op_valid = valid;
+ /* make root inode
+ * XXX: move this to after cbd setup? */
+ valid = OBD_MD_FLGETATTR | OBD_MD_FLBLOCKS | OBD_MD_FLMDSCAPA;
+ if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
+ valid |= OBD_MD_FLRMTPERM;
+ else if (sbi->ll_flags & LL_SBI_ACL)
+ valid |= OBD_MD_FLACL;
+
+ OBD_ALLOC_PTR(op_data);
+ if (op_data == NULL)
+ GOTO(out_dt, err = -ENOMEM);
+
+ op_data->op_fid1 = sbi->ll_root_fid;
+ op_data->op_mode = 0;
+ op_data->op_capa1 = oc;
+ op_data->op_valid = valid;
+
+ err = md_getattr(sbi->ll_md_exp, op_data, &request);
+ if (oc)
+ capa_put(oc);
+ OBD_FREE_PTR(op_data);
+ if (err) {
+ CERROR("%s: md_getattr failed for root: rc = %d\n",
+ sbi->ll_md_exp->exp_obd->obd_name, err);
+ GOTO(out_dt, err);
+ }
- err = md_getattr(sbi->ll_md_exp, op_data, &request);
- if (oc)
- capa_put(oc);
- OBD_FREE_PTR(op_data);
- if (err) {
- CERROR("md_getattr failed for root: rc = %d\n", err);
- GOTO(out_lock_cn_cb, err);
- }
- err = md_get_lustre_md(sbi->ll_md_exp, request, sbi->ll_dt_exp,
- sbi->ll_md_exp, &lmd);
- if (err) {
- CERROR("failed to understand root inode md: rc = %d\n", err);
- ptlrpc_req_finished (request);
- GOTO(out_lock_cn_cb, err);
- }
+ err = md_get_lustre_md(sbi->ll_md_exp, request, sbi->ll_dt_exp,
+ sbi->ll_md_exp, &lmd);
+ if (err) {
+ CERROR("failed to understand root inode md: rc = %d\n", err);
+ ptlrpc_req_finished(request);
+ GOTO(out_dt, err);
+ }
LASSERT(fid_is_sane(&sbi->ll_root_fid));
root = ll_iget(sb, cl_fid_build_ino(&sbi->ll_root_fid, 0), &lmd);
if (sb->s_root == NULL) {
CERROR("%s: can't make root dentry\n",
ll_get_fsname(sb, NULL, 0));
- GOTO(out_lock_cn_cb, err = -ENOMEM);
+ GOTO(out_root, err = -ENOMEM);
}
#ifdef HAVE_DCACHE_LOCK
out_root:
if (root)
iput(root);
-out_lock_cn_cb:
- obd_fid_fini(sbi->ll_dt_exp);
out_dt:
obd_disconnect(sbi->ll_dt_exp);
sbi->ll_dt_exp = NULL;
/* Make sure all OScs are gone, since cl_cache is accessing sbi. */
obd_zombie_barrier();
-out_md_fid:
- obd_fid_fini(sbi->ll_md_exp);
out_md:
obd_disconnect(sbi->ll_md_exp);
sbi->ll_md_exp = NULL;
cfs_list_del(&sbi->ll_conn_chain);
- obd_fid_fini(sbi->ll_dt_exp);
obd_disconnect(sbi->ll_dt_exp);
sbi->ll_dt_exp = NULL;
/* wait till all OSCs are gone, since cl_cache is accessing sbi.
lprocfs_unregister_mountpoint(sbi);
- obd_fid_fini(sbi->ll_md_exp);
obd_disconnect(sbi->ll_md_exp);
sbi->ll_md_exp = NULL;