From: wangdi Date: Thu, 26 Sep 2013 02:11:47 +0000 (-0700) Subject: LU-1445 fid: Add DATA fid type in fid_request. X-Git-Tag: 2.3.59~19 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=8b5cfb9463fd97eaebf5bcf98ae445f71fa6c365 LU-1445 fid: Add DATA fid type in fid_request. 1. Add data fid type in fid request on client side. 2. When MDT request fids to the OST, if it is not ready for fid allocation yet. i.e. not being connected to MDT0 yet, it will return -EINPROGRESS, and MDT will try again. 3. Remove obsolete obd_fid_init/fini in llite. Signed-off-by: wang di Change-Id: I54d97d5c84a5b38ebeae77522bd8666206ef2701 Reviewed-on: http://review.whamcloud.com/4787 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev --- diff --git a/lustre/fid/fid_handler.c b/lustre/fid/fid_handler.c index e36935f..ecb630f 100644 --- a/lustre/fid/fid_handler.c +++ b/lustre/fid/fid_handler.c @@ -58,7 +58,56 @@ #include #include "fid_internal.h" +int client_fid_init(struct obd_export *exp, enum lu_cli_type type) +{ + struct client_obd *cli = &exp->exp_obd->u.cli; + char *prefix; + int rc; + ENTRY; + + OBD_ALLOC_PTR(cli->cl_seq); + if (cli->cl_seq == NULL) + RETURN(-ENOMEM); + + OBD_ALLOC(prefix, MAX_OBD_NAME + 5); + if (prefix == NULL) + GOTO(out_free_seq, rc = -ENOMEM); + + snprintf(prefix, MAX_OBD_NAME + 5, "cli-%s", + exp->exp_obd->obd_name); + + /* Init client side sequence-manager */ + rc = seq_client_init(cli->cl_seq, exp, type, prefix, NULL); + OBD_FREE(prefix, MAX_OBD_NAME + 5); + if (rc) + GOTO(out_free_seq, rc); + + RETURN(rc); +out_free_seq: + OBD_FREE_PTR(cli->cl_seq); + cli->cl_seq = NULL; + return rc; +} +EXPORT_SYMBOL(client_fid_init); + +int client_fid_fini(struct obd_export *exp) +{ + struct client_obd *cli = &exp->exp_obd->u.cli; + ENTRY; + + if (cli->cl_seq != NULL) { + seq_client_fini(cli->cl_seq); + OBD_FREE_PTR(cli->cl_seq); + cli->cl_seq = NULL; + } + + RETURN(0); +} +EXPORT_SYMBOL(client_fid_fini); + #ifdef __KERNEL__ +static void seq_server_proc_fini(struct lu_server_seq *seq); + /* Assigns client to sequence controller node. */ int seq_server_set_cli(struct lu_server_seq *seq, struct lu_client_seq *cli, @@ -298,6 +347,7 @@ static int seq_server_handle(struct lu_site *site, ENTRY; ss_site = lu_site2seq(site); + switch (opc) { case SEQ_ALLOC_META: if (!ss_site->ss_server_seq) { @@ -412,7 +462,6 @@ int seq_query(struct com_thread_info *info) } EXPORT_SYMBOL(seq_query); -static void seq_server_proc_fini(struct lu_server_seq *seq); #ifdef LPROCFS static int seq_server_proc_init(struct lu_server_seq *seq) @@ -510,6 +559,7 @@ int seq_server_init(struct lu_server_seq *seq, LUSTRE_SEQ_ZERO_RANGE: LUSTRE_SEQ_SPACE_RANGE; + LASSERT(ss != NULL); seq->lss_space.lsr_index = ss->ss_node_id; LCONSOLE_INFO("%s: No data found " "on store. Initialize space\n", diff --git a/lustre/fid/fid_request.c b/lustre/fid/fid_request.c index 413d0f5..95fae05 100644 --- a/lustre/fid/fid_request.c +++ b/lustre/fid/fid_request.c @@ -87,34 +87,39 @@ static int seq_client_rpc(struct lu_client_seq *seq, 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); @@ -158,7 +163,14 @@ int seq_client_alloc_super(struct lu_client_seq *seq, 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__ } @@ -180,8 +192,14 @@ static int seq_client_alloc_meta(const struct lu_env *env, 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 @@ -249,7 +267,10 @@ static void seq_fid_alloc_fini(struct lu_client_seq *seq) 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) { @@ -278,8 +299,9 @@ int seq_client_get_seq(const struct lu_env *env, 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; diff --git a/lustre/fid/lproc_fid.c b/lustre/fid/lproc_fid.c index 3bb44f2..3670ee4 100644 --- a/lustre/fid/lproc_fid.c +++ b/lustre/fid/lproc_fid.c @@ -262,6 +262,7 @@ seq_client_proc_write_width(struct file *file, const char *buffer, unsigned long count, void *data) { struct lu_client_seq *seq = (struct lu_client_seq *)data; + __u64 max; int rc, val; ENTRY; @@ -275,7 +276,12 @@ seq_client_proc_write_width(struct file *file, const char *buffer, RETURN(rc); } - if (val <= LUSTRE_METADATA_SEQ_MAX_WIDTH && val > 0) { + if (seq->lcs_type == LUSTRE_SEQ_DATA) + max = LUSTRE_DATA_SEQ_MAX_WIDTH; + else + max = LUSTRE_METADATA_SEQ_MAX_WIDTH; + + if (val <= max && val > 0) { seq->lcs_width = val; if (rc == 0) { diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 3c2e9cb..6dc2a5b 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -455,15 +455,9 @@ static inline int fid_seq_is_mdt0(obd_seq seq) return (seq == FID_SEQ_OST_MDT0); } -static inline int fid_seq_is_cmd(const __u64 seq) -{ - return (seq >= FID_SEQ_OST_MDT1 && seq <= FID_SEQ_OST_MAX); -}; - static inline int fid_seq_is_mdt(const __u64 seq) { - return seq == FID_SEQ_OST_MDT0 || - (seq >= FID_SEQ_OST_MDT1 && seq <= FID_SEQ_OST_MAX); + return seq == FID_SEQ_OST_MDT0 || seq >= FID_SEQ_NORMAL; }; static inline int fid_seq_is_echo(obd_seq seq) diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h index bd045cb..99d38da 100644 --- a/lustre/include/lustre_fid.h +++ b/lustre/include/lustre_fid.h @@ -156,6 +156,7 @@ #include #include #include +#include struct lu_site; @@ -285,11 +286,6 @@ enum lu_mgr_type { LUSTRE_SEQ_CONTROLLER }; -enum lu_cli_type { - LUSTRE_SEQ_METADATA, - LUSTRE_SEQ_DATA -}; - struct lu_server_seq; /* Client sequence manager interface. */ @@ -437,6 +433,9 @@ int seq_site_fini(const struct lu_env *env, struct seq_server_site *ss); int fid_is_local(const struct lu_env *env, struct lu_site *site, const struct lu_fid *fid); +int client_fid_init(struct obd_export *exp, enum lu_cli_type type); +int client_fid_fini(struct obd_export *exp); + /* fid locking */ struct ldlm_namespace; diff --git a/lustre/include/obd.h b/lustre/include/obd.h index ccc34b6..ae3043c 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -1272,6 +1272,12 @@ typedef int (* md_enqueue_cb_t)(struct ptlrpc_request *req, struct md_enqueue_info *minfo, int rc); +/* seq client type */ +enum lu_cli_type { + LUSTRE_SEQ_METADATA = 1, + LUSTRE_SEQ_DATA +}; + struct md_enqueue_info { struct md_op_data mi_data; struct lookup_intent mi_it; @@ -1321,7 +1327,7 @@ struct obd_ops { int (*o_disconnect)(struct obd_export *exp); /* Initialize/finalize fids infrastructure. */ - int (*o_fid_init)(struct obd_export *exp); + int (*o_fid_init)(struct obd_export *exp, enum lu_cli_type type); int (*o_fid_fini)(struct obd_export *exp); /* Allocate new fid according to passed @hint. */ diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 00897af..224f594b0 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -1039,7 +1039,7 @@ static inline int obd_disconnect(struct obd_export *exp) RETURN(rc); } -static inline int obd_fid_init(struct obd_export *exp) +static inline int obd_fid_init(struct obd_export *exp, enum lu_cli_type type) { int rc; ENTRY; @@ -1047,8 +1047,8 @@ static inline int obd_fid_init(struct obd_export *exp) OBD_CHECK_DT_OP(exp->exp_obd, fid_init, 0); EXP_COUNTER_INCREMENT(exp, fid_init); - rc = OBP(exp->exp_obd, fid_init)(exp); - RETURN(rc); + rc = OBP(exp->exp_obd, fid_init)(exp, type); + RETURN(rc); } static inline int obd_fid_fini(struct obd_export *exp) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index cf7c2c2..fe87c92 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -282,49 +282,43 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, 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; @@ -390,11 +384,11 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, 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 | @@ -439,80 +433,79 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, 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); @@ -561,7 +554,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, 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 @@ -592,15 +585,11 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, 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; @@ -688,7 +677,6 @@ void client_common_put_super(struct super_block *sb) 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. @@ -697,7 +685,6 @@ void client_common_put_super(struct super_block *sb) lprocfs_unregister_mountpoint(sbi); - obd_fid_fini(sbi->ll_md_exp); obd_disconnect(sbi->ll_md_exp); sbi->ll_md_exp = NULL; diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index e5b4846..e8044f9 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -413,7 +413,7 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) /* * Init fid sequence client for this mdc and add new fld target. */ - rc = obd_fid_init(mdc_exp); + rc = obd_fid_init(mdc_exp, LUSTRE_SEQ_METADATA); if (rc) RETURN(rc); diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 6ee52fc..54a8434 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -1987,53 +1987,6 @@ static int mdc_import_event(struct obd_device *obd, struct obd_import *imp, RETURN(rc); } -static int mdc_fid_init(struct obd_export *exp) -{ - struct client_obd *cli = &exp->exp_obd->u.cli; - char *prefix; - int rc; - ENTRY; - - OBD_ALLOC_PTR(cli->cl_seq); - if (cli->cl_seq == NULL) - RETURN(-ENOMEM); - - OBD_ALLOC(prefix, MAX_OBD_NAME + 5); - if (prefix == NULL) - GOTO(out_free_seq, rc = -ENOMEM); - - snprintf(prefix, MAX_OBD_NAME + 5, "srv-%s", - exp->exp_obd->obd_name); - - /* Init client side sequence-manager */ - rc = seq_client_init(cli->cl_seq, exp, - LUSTRE_SEQ_METADATA, - prefix, NULL); - OBD_FREE(prefix, MAX_OBD_NAME + 5); - if (rc) - GOTO(out_free_seq, rc); - - RETURN(rc); -out_free_seq: - OBD_FREE_PTR(cli->cl_seq); - cli->cl_seq = NULL; - return rc; -} - -static int mdc_fid_fini(struct obd_export *exp) -{ - struct client_obd *cli = &exp->exp_obd->u.cli; - ENTRY; - - if (cli->cl_seq != NULL) { - seq_client_fini(cli->cl_seq); - OBD_FREE_PTR(cli->cl_seq); - cli->cl_seq = NULL; - } - - RETURN(0); -} - int mdc_fid_alloc(struct obd_export *exp, struct lu_fid *fid, struct md_op_data *op_data) { @@ -2356,8 +2309,8 @@ struct obd_ops mdc_obd_ops = { .o_statfs = mdc_statfs, .o_pin = mdc_pin, .o_unpin = mdc_unpin, - .o_fid_init = mdc_fid_init, - .o_fid_fini = mdc_fid_fini, + .o_fid_init = client_fid_init, + .o_fid_fini = client_fid_fini, .o_fid_alloc = mdc_fid_alloc, .o_import_event = mdc_import_event, .o_llog_init = mdc_llog_init,