From 6d59df8db7ab97218965a6fd96c8f3c9c0653d03 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 2 Aug 2004 22:18:37 +0000 Subject: [PATCH] b=4030 r=adilger - new obd method ->o_connect_post() is called when reverse import gets initialized - method ->o_llog_connect() gets obd_export, not obd_device - MDS passes mdsnum in connect_flags slot - OST saves last known group in LAST_GROUP file - OST initializes all known groups upon startup, not on demand - filter_connect_post() initializes context for given group upon connection from MDS - filter_connect() initializes group from connect_flags - osc_set_info() doesn't forward "mds_conn": no need to do this any more --- lustre/include/linux/obd.h | 5 +- lustre/include/linux/obd_class.h | 28 ++-- lustre/ldlm/ldlm_lib.c | 2 + lustre/lov/lov_obd.c | 8 +- lustre/mds/mds_lov.c | 3 +- lustre/obdclass/lprocfs_status.c | 1 + lustre/obdfilter/filter.c | 292 ++++++++++++++++++++++++++------------- lustre/obdfilter/filter_log.c | 10 +- lustre/osc/osc_request.c | 14 +- lustre/ost/ost_handler.c | 3 +- 10 files changed, 234 insertions(+), 132 deletions(-) diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index e88a9cc..94616f8 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -176,6 +176,7 @@ struct filter_group_llog { struct list_head list; int group; struct obd_llogs *llogs; + struct obd_export *exp; }; struct filter_obd { @@ -190,6 +191,7 @@ struct filter_obd { __u64 *fo_last_objids; /* per-group last created objid */ struct file **fo_last_objid_files; struct semaphore fo_init_lock; /* group initialization lock */ + int fo_committed_group; spinlock_t fo_objidlock; /* protect fo_lastobjid increment */ spinlock_t fo_translock; /* protect fsd_last_rcvd increment */ @@ -642,6 +644,7 @@ struct obd_ops { int (*o_postrecov)(struct obd_device *dev); int (*o_connect)(struct lustre_handle *conn, struct obd_device *src, struct obd_uuid *cluuid, unsigned long connect_flags); + int (*o_connect_post)(struct obd_export *exp); int (*o_disconnect)(struct obd_export *exp, int flags); int (*o_statfs)(struct obd_device *obd, struct obd_statfs *osfs, @@ -753,7 +756,7 @@ struct obd_ops { int (*o_llog_init)(struct obd_device *, struct obd_llogs *, struct obd_device *, int, struct llog_catid *); int (*o_llog_finish)(struct obd_device *, struct obd_llogs *, int); - int (*o_llog_connect)(struct obd_device *, struct llogd_conn_body *); + int (*o_llog_connect)(struct obd_export *, struct llogd_conn_body *); /* metadata-only methods */ diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index 9816db8..bb85d8c 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -637,6 +637,19 @@ static inline int obd_connect(struct lustre_handle *conn, RETURN(rc); } +static inline int obd_connect_post(struct obd_export *exp) +{ + int rc; + ENTRY; + + OBD_CHECK_DEV_ACTIVE(exp->exp_obd); + if (!OBT(exp->exp_obd) || !OBP((exp->exp_obd), connect_post)) + RETURN(0); + OBD_COUNTER_INCREMENT(exp->exp_obd, connect_post); + rc = OBP(exp->exp_obd, connect_post)(exp); + RETURN(rc); +} + static inline int obd_disconnect(struct obd_export *exp, int flags) { int rc; @@ -1095,21 +1108,12 @@ static inline void obd_import_event(struct obd_device *obd, } } -static inline int obd_llog_connect(struct obd_device *obd, +static inline int obd_llog_connect(struct obd_export *exp, struct llogd_conn_body *body) { ENTRY; - if (!obd->obd_set_up) { - CERROR("obd %s not set up\n", obd->obd_name); - return -EINVAL; - } - - if (!OBP(obd, llog_connect)) { - CERROR("obd %s has no llog_connect handler\n", obd->obd_name); - return -ENOSYS; - } - - return OBP(obd, llog_connect)(obd, body); + EXP_CHECK_OP(exp, llog_connect); + return OBP(exp->exp_obd, llog_connect)(exp, body); } static inline int obd_notify(struct obd_device *obd, diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 9a9721e..c75f9d3 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -583,6 +583,8 @@ int target_handle_connect(struct ptlrpc_request *req) revimp->imp_dlm_fake = 1; revimp->imp_state = LUSTRE_IMP_FULL; class_import_put(revimp); + + rc = obd_connect_post(export); out: if (rc) req->rq_status = rc; diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 3b1e561..a025ea2 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -116,7 +116,7 @@ static void lov_llh_destroy(struct lov_lock_handles *llh) /* obd methods */ #define MAX_STRING_SIZE 128 static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt, - int activate) + int activate, unsigned long connect_flags) { struct lov_obd *lov = &obd->u.lov; struct obd_uuid *tgt_uuid = &tgt->uuid; @@ -157,7 +157,7 @@ static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt, RETURN(0); } - rc = obd_connect(&conn, tgt_obd, &lov_osc_uuid, 0); + rc = obd_connect(&conn, tgt_obd, &lov_osc_uuid, connect_flags); if (rc) { CERROR("Target %s connect error %d\n", tgt_uuid->uuid, rc); RETURN(rc); @@ -230,7 +230,7 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd, for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count; i++, tgt++) { if (obd_uuid_empty(&tgt->uuid)) continue; - rc = lov_connect_obd(obd, tgt, 0); + rc = lov_connect_obd(obd, tgt, 0, connect_flags); if (rc) GOTO(out_disc, rc); } @@ -591,7 +591,7 @@ lov_add_obd(struct obd_device *obd, struct obd_uuid *uuidp, int index, int gen) osc_obd->obd_no_recov = 0; } - rc = lov_connect_obd(obd, tgt, 1); + rc = lov_connect_obd(obd, tgt, 1, 0); if (rc || !obd->obd_observer) RETURN(rc); diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index 5b80aa0..0668691 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -219,7 +219,8 @@ int mds_lov_connect(struct obd_device *obd, char * lov_name) CDEBUG(D_HA, "obd: %s osc: %s lov_name: %s\n", obd->obd_name, mds->mds_osc_obd->obd_name, lov_name); - rc = obd_connect(&conn, mds->mds_osc_obd, &obd->obd_uuid, 0); + rc = obd_connect(&conn, mds->mds_osc_obd, &obd->obd_uuid, + mds->mds_num + FILTER_GROUP_FIRST_MDS); if (rc) { CERROR("MDS cannot connect to LOV %s (%d)\n", lov_name, rc); diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 6614c53..810e904 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -614,6 +614,7 @@ int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned num_private_stats) LPROCFS_OBD_OP_INIT(num_private_stats, stats, process_config); LPROCFS_OBD_OP_INIT(num_private_stats, stats, postrecov); LPROCFS_OBD_OP_INIT(num_private_stats, stats, connect); + LPROCFS_OBD_OP_INIT(num_private_stats, stats, connect_post); LPROCFS_OBD_OP_INIT(num_private_stats, stats, disconnect); LPROCFS_OBD_OP_INIT(num_private_stats, stats, statfs); LPROCFS_OBD_OP_INIT(num_private_stats, stats, packmd); diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 78e0eb1..a50516f 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -59,10 +59,15 @@ #include #include "filter_internal.h" +/* Group 0 is no longer a legal group, to catch uninitialized IDs */ +#define FILTER_MIN_GROUPS 3 + static struct lvfs_callback_ops filter_lvfs_ops; static int filter_destroy(struct obd_export *exp, struct obdo *oa, struct lov_stripe_md *ea, struct obd_trans_info *); +static struct obd_llogs *filter_grab_llog_for_group(struct obd_device *, + int, struct obd_export *); static void filter_commit_cb(struct obd_device *obd, __u64 transno, void *cb_data, int error) @@ -574,6 +579,50 @@ static int filter_cleanup_groups(struct obd_device *obd) RETURN(0); } +static int filter_update_last_group(struct obd_device *obd, int group) +{ + struct filter_obd *filter = &obd->u.filter; + struct file *filp = NULL; + int last_group = 0, rc; + loff_t off = 0; + ENTRY; + + if (group <= filter->fo_committed_group) + RETURN(0); + + filp = filp_open("LAST_GROUP", O_RDWR, 0700); + if (IS_ERR(filp)) { + rc = PTR_ERR(filp); + filp = NULL; + CERROR("cannot open LAST_GROUP: rc = %d\n", rc); + GOTO(cleanup, rc); + } + + rc = fsfilt_read_record(obd, filp, &last_group, sizeof(__u32), &off); + if (rc) { + CDEBUG(D_INODE, "error reading LAST_GROUP: rc %d\n",rc); + GOTO(cleanup, rc); + } + LASSERT(off == 0 || last_group >= FILTER_MIN_GROUPS); + CDEBUG(D_INODE, "%s: previous %d, new %d\n", + obd->obd_name, last_group, group); + + off = 0; + last_group = group; + /* must be sync: bXXXX */ + rc = fsfilt_write_record(obd, filp, &last_group, sizeof(__u32), &off, 1); + if (rc) { + CDEBUG(D_INODE, "error updating LAST_GROUP: rc %d\n", rc); + GOTO(cleanup, rc); + } + + filter->fo_committed_group = group; +cleanup: + if (filp) + filp_close(filp, 0); + RETURN(rc); +} + static int filter_read_group_internal(struct obd_device *obd, int group, int create) { @@ -693,6 +742,8 @@ static int filter_read_group_internal(struct obd_device *obd, int group, OBD_FREE(tmp_subdirs, sizeof(*tmp_subdirs)); } + filter_update_last_group(obd, group); + if (filp->f_dentry->d_inode->i_size == 0) { filter->fo_last_objids[group] = FILTER_INIT_OBJID; RETURN(0); @@ -754,6 +805,9 @@ static int filter_prep_groups(struct obd_device *obd) struct filter_obd *filter = &obd->u.filter; struct dentry *dentry, *O_dentry; int rc = 0, cleanup_phase = 0; + struct file *filp = NULL; + int last_group; + loff_t off = 0; ENTRY; O_dentry = simple_mkdir(current->fs->pwd, "O", 0700, 1); @@ -816,16 +870,40 @@ static int filter_prep_groups(struct obd_device *obd) cleanup_phase = 2; /* groups */ - /* Group 0 is no longer a legal group, to catch uninitialized IDs */ -#define FILTER_MIN_GROUPS 3 - rc = filter_read_groups(obd, FILTER_MIN_GROUPS, 1); - if (rc) + /* we have to initialize all groups before first connections from + * clients because they may send create/destroy for any group -bzzz */ + filp = filp_open("LAST_GROUP", O_CREAT | O_RDWR, 0700); + if (IS_ERR(filp)) { + CERROR("cannot create LAST_GROUP: rc = %ld\n", PTR_ERR(filp)); + GOTO(cleanup, rc = PTR_ERR(filp)); + } + cleanup_phase = 3; /* filp */ + + rc = fsfilt_read_record(obd, filp, &last_group, sizeof(__u32), &off); + if (rc) { + CDEBUG(D_INODE, "error reading LAST_GROUP: rc %d\n", rc); GOTO(cleanup, rc); + } + if (off == 0) { + last_group = FILTER_MIN_GROUPS; + } else { + LASSERT(last_group >= FILTER_MIN_GROUPS); + } + CWARN("%s: initialize groups [%d,%d]\n", obd->obd_name, + FILTER_MIN_GROUPS, last_group); + filter->fo_committed_group = last_group; + rc = filter_read_groups(obd, last_group, 1); + if (rc) + GOTO(cleanup, rc); + + filp_close(filp, 0); RETURN(0); cleanup: switch (cleanup_phase) { + case 3: + filp_close(filp, 0); case 2: filter_cleanup_groups(obd); case 1: @@ -1381,6 +1459,7 @@ int filter_common_setup(struct obd_device *obd, obd_count len, GOTO(err_mntput, rc); sema_init(&filter->fo_init_lock, 1); + filter->fo_committed_group = 0; rc = filter_prep(obd); if (rc) GOTO(err_mntput, rc); @@ -1523,6 +1602,37 @@ static int filter_cleanup(struct obd_device *obd, int flags) RETURN(0); } +static int filter_connect_post(struct obd_export *exp) +{ + struct obd_device *obd = exp->exp_obd; + struct filter_export_data *fed; + char str[PTL_NALFMT_SIZE]; + struct obd_llogs *llog; + struct llog_ctxt *ctxt; + int rc; + ENTRY; + + fed = &exp->exp_filter_data; + if (fed->fed_group < FILTER_MIN_GROUPS) + RETURN(0); + + /* initialize llogs for connections from MDS */ + llog = filter_grab_llog_for_group(obd, fed->fed_group, exp); + LASSERT(llog != NULL); + + ctxt = llog_get_context(llog, LLOG_UNLINK_REPL_CTXT); + LASSERT(ctxt != NULL); + + rc = llog_receptor_accept(ctxt, exp->exp_imp_reverse); + portals_nid2str(exp->exp_connection->c_peer.peer_ni->pni_number, + exp->exp_connection->c_peer.peer_nid, str); + CDEBUG(D_OTHER, "%s: init llog ctxt for export "LPX64"/%s, group %d\n", + obd->obd_name, exp->exp_connection->c_peer.peer_nid, + str, fed->fed_group); + + RETURN(rc); +} + /* nearly identical to mds_connect */ static int filter_connect(struct lustre_handle *conn, struct obd_device *obd, struct obd_uuid *cluuid, unsigned long connect_flags) @@ -1531,7 +1641,8 @@ static int filter_connect(struct lustre_handle *conn, struct obd_device *obd, struct filter_export_data *fed; struct filter_client_data *fcd = NULL; struct filter_obd *filter = &obd->u.filter; - int rc; + struct lvfs_run_ctxt saved; + int rc, group; ENTRY; if (conn == NULL || obd == NULL || cluuid == NULL) @@ -1547,19 +1658,54 @@ static int filter_connect(struct lustre_handle *conn, struct obd_device *obd, spin_lock_init(&fed->fed_lock); - if (!obd->obd_replayable) - GOTO(cleanup, rc = 0); + if (obd->obd_replayable) { + OBD_ALLOC(fcd, sizeof(*fcd)); + if (!fcd) { + CERROR("filter: out of memory for client data\n"); + GOTO(cleanup, rc = -ENOMEM); + } - OBD_ALLOC(fcd, sizeof(*fcd)); - if (!fcd) { - CERROR("filter: out of memory for client data\n"); - GOTO(cleanup, rc = -ENOMEM); + memcpy(fcd->fcd_uuid, cluuid, sizeof(fcd->fcd_uuid)); + fed->fed_fcd = fcd; + + rc = filter_client_add(obd, filter, fed, -1); + if (rc) + GOTO(cleanup, rc); } - memcpy(fcd->fcd_uuid, cluuid, sizeof(fcd->fcd_uuid)); - fed->fed_fcd = fcd; + if (connect_flags == 0) + GOTO(cleanup, rc); + + /* connection from MDS */ + group = connect_flags; + CWARN("%s: Received MDS connection ("LPX64"); group %d\n", + obd->obd_name, exp->exp_handle.h_cookie, group); + + if (fed->fed_group != 0 && fed->fed_group != group) { + char str[PTL_NALFMT_SIZE]; + portals_nid2str(exp->exp_connection->c_peer.peer_ni->pni_number, + exp->exp_connection->c_peer.peer_nid, str); + CERROR("!!! This export (nid "LPX64"/%s) used object group %d " + "earlier; now it's trying to use group %d! This could " + "be a bug in the MDS. Tell CFS.\n", + exp->exp_connection->c_peer.peer_nid, str, + fed->fed_group, group); + GOTO(cleanup, rc = -EPROTO); + } + fed->fed_group = group; - rc = filter_client_add(obd, filter, fed, -1); + push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); + rc = filter_read_groups(obd, group, 1); + pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); + if (rc != 0) { + CERROR("can't read group %u\n", group); + GOTO(cleanup, rc); + } + rc = filter_group_set_fs_flags(obd, group); + if (rc != 0) { + CERROR("can't set kml flags %u\n", group); + GOTO(cleanup, rc); + } cleanup: if (rc) { @@ -1723,13 +1869,13 @@ static int filter_destroy_export(struct obd_export *exp) RETURN(0); } -static void filter_sync_llogs(struct obd_export *dexp) +static void filter_sync_llogs(struct obd_device *obd, struct obd_export *dexp) { struct filter_group_llog *fglog, *nlog; - struct obd_device *obd = dexp->exp_obd; struct filter_obd *filter; int worked = 0, group; struct llog_ctxt *ctxt; + ENTRY; filter = &obd->u.filter; @@ -1759,11 +1905,15 @@ static void filter_sync_llogs(struct obd_export *dexp) } spin_unlock(&filter->fo_llog_list_lock); - if (fglog) { - worked = fglog->group; + if (fglog == NULL) + break; + + worked = fglog->group; + if (fglog->exp && (dexp == fglog->exp || dexp == NULL)) { ctxt = llog_get_context(fglog->llogs, - LLOG_UNLINK_REPL_CTXT); - llog_sync(ctxt, dexp); + LLOG_UNLINK_REPL_CTXT); + LASSERT(ctxt != NULL); + llog_sync(ctxt, fglog->exp); } } while (fglog != NULL); } @@ -1795,7 +1945,7 @@ static int filter_disconnect(struct obd_export *exp, int flags) fsfilt_sync(obd, obd->u.filter.fo_sb); /* flush any remaining cancel messages out to the target */ - filter_sync_llogs(exp); + filter_sync_llogs(obd, exp); class_export_put(exp); RETURN(rc); @@ -2465,7 +2615,6 @@ static int filter_sync(struct obd_export *exp, struct obdo *oa, struct lvfs_run_ctxt saved; struct filter_obd *filter; struct dentry *dentry; - struct llog_ctxt *ctxt; int rc, rc2; ENTRY; @@ -2475,8 +2624,7 @@ static int filter_sync(struct obd_export *exp, struct obdo *oa, if (!oa || !(oa->o_valid & OBD_MD_FLID)) { rc = fsfilt_sync(obd, filter->fo_sb); /* flush any remaining cancel messages out to the target */ - ctxt = llog_get_context(&obd->obd_llogs, LLOG_UNLINK_REPL_CTXT); - llog_sync(ctxt, exp); + filter_sync_llogs(obd, NULL); RETURN(rc); } @@ -2595,11 +2743,13 @@ static int filter_get_info(struct obd_export *exp, __u32 keylen, RETURN(-EINVAL); } -struct obd_llogs *filter_grab_llog_for_group(struct obd_device *obd, int group) +struct obd_llogs *filter_grab_llog_for_group(struct obd_device *obd, int group, + struct obd_export *export) { struct filter_group_llog *fglog, *nlog; char name[32] = "CATLIST"; struct filter_obd *filter; + struct llog_ctxt *ctxt; struct list_head *cur; int rc; @@ -2609,12 +2759,18 @@ struct obd_llogs *filter_grab_llog_for_group(struct obd_device *obd, int group) list_for_each(cur, &filter->fo_llog_list) { fglog = list_entry(cur, struct filter_group_llog, list); if (fglog->group == group) { + if (!(fglog->exp == NULL || fglog->exp == export || export == NULL)) + CWARN("%s: export for group %d changes: 0x%p -> 0x%p\n", + obd->obd_name, group, fglog->exp, export); spin_unlock(&filter->fo_llog_list_lock); - RETURN(fglog->llogs); + goto init; } } spin_unlock(&filter->fo_llog_list_lock); + if (export == NULL) + RETURN(NULL); + OBD_ALLOC(fglog, sizeof(*fglog)); if (fglog == NULL) RETURN(NULL); @@ -2641,75 +2797,18 @@ struct obd_llogs *filter_grab_llog_for_group(struct obd_device *obd, int group) RETURN(NULL); } - CDEBUG(D_OTHER, "%s: new llog 0x%p for group %u\n", obd->obd_name, - fglog->llogs, group); - - RETURN(fglog->llogs); -} - -static int filter_set_info(struct obd_export *exp, __u32 keylen, - void *key, __u32 vallen, void *val) -{ - struct lvfs_run_ctxt saved; - struct filter_export_data *fed = &exp->exp_filter_data; - struct obd_device *obd; - struct lustre_handle conn; - struct obd_llogs *llog; - struct llog_ctxt *ctxt; - __u32 group; - int rc = 0; - ENTRY; +init: + if (export) { + fglog->exp = export; + ctxt = llog_get_context(fglog->llogs, LLOG_UNLINK_REPL_CTXT); + LASSERT(ctxt != NULL); - conn.cookie = exp->exp_handle.h_cookie; - - obd = exp->exp_obd; - if (obd == NULL) { - CDEBUG(D_IOCTL, "invalid exp %p cookie "LPX64"\n", - exp, conn.cookie); - RETURN(-EINVAL); - } - - if (keylen < strlen("mds_conn") || - memcmp(key, "mds_conn", keylen) != 0) - RETURN(-EINVAL); - - group = *((__u32 *)val); - if (fed->fed_group != 0 && fed->fed_group != group) { - char str[PTL_NALFMT_SIZE]; - portals_nid2str(exp->exp_connection->c_peer.peer_ni->pni_number, - exp->exp_connection->c_peer.peer_nid, str); - CERROR("!!! This export (nid "LPX64"/%s) used object group %d " - "earlier; now it's trying to use group %d! This could " - "be a bug in the MDS. Tell CFS.\n", - exp->exp_connection->c_peer.peer_nid, str, - fed->fed_group, group); - RETURN(-EPROTO); + llog_receptor_accept(ctxt, export->exp_imp_reverse); } - fed->fed_group = group; - CWARN("Received MDS connection ("LPX64"); group %d\n", conn.cookie, - group); + CDEBUG(D_OTHER, "%s: new llog 0x%p for group %u\n", + obd->obd_name, fglog->llogs, group); - LASSERT(rc == 0); - - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = filter_read_groups(obd, group, 1); - pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - if (rc != 0) { - CERROR("can't read group %u\n", group); - RETURN(rc); - } - rc = filter_group_set_fs_flags(obd, group); - if (rc != 0) { - CERROR("can't set kml flags %u\n", group); - RETURN(rc); - } - llog = filter_grab_llog_for_group(obd, group); - LASSERT(llog != NULL); - - ctxt = llog_get_context(llog, LLOG_UNLINK_REPL_CTXT); - LASSERT(ctxt != NULL); - rc = llog_receptor_accept(ctxt, exp->exp_imp_reverse); - RETURN(rc); + RETURN(fglog->llogs); } int filter_iocontrol(unsigned int cmd, struct obd_export *exp, @@ -2824,9 +2923,10 @@ static int filter_llog_finish(struct obd_device *obd, RETURN(rc); } -static int filter_llog_connect(struct obd_device *obd, +static int filter_llog_connect(struct obd_export *exp, struct llogd_conn_body *body) { + struct obd_device *obd = exp->exp_obd; struct llog_ctxt *ctxt; struct obd_llogs *llog; int rc; @@ -2836,7 +2936,7 @@ static int filter_llog_connect(struct obd_device *obd, (unsigned) body->lgdc_logid.lgl_ogr, (unsigned) body->lgdc_logid.lgl_oid, (unsigned) body->lgdc_logid.lgl_ogen); - llog = filter_grab_llog_for_group(obd, body->lgdc_logid.lgl_ogr); + llog = filter_grab_llog_for_group(obd, body->lgdc_logid.lgl_ogr, exp); LASSERT(llog != NULL); ctxt = llog_get_context(llog, body->lgdc_ctxt_idx); rc = llog_connect(ctxt, 1, &body->lgdc_logid, @@ -2862,11 +2962,11 @@ static struct obd_ops filter_obd_ops = { .o_attach = filter_attach, .o_detach = filter_detach, .o_get_info = filter_get_info, - .o_set_info = filter_set_info, .o_setup = filter_setup, .o_precleanup = filter_precleanup, .o_cleanup = filter_cleanup, .o_connect = filter_connect, + .o_connect_post = filter_connect_post, .o_disconnect = filter_disconnect, .o_statfs = filter_statfs, .o_getattr = filter_getattr, @@ -2893,11 +2993,11 @@ static struct obd_ops filter_sanobd_ops = { .o_attach = filter_attach, .o_detach = filter_detach, .o_get_info = filter_get_info, - .o_set_info = filter_set_info, .o_setup = filter_san_setup, .o_precleanup = filter_precleanup, .o_cleanup = filter_cleanup, .o_connect = filter_connect, + .o_connect_post = filter_connect_post, .o_disconnect = filter_disconnect, .o_statfs = filter_statfs, .o_getattr = filter_getattr, diff --git a/lustre/obdfilter/filter_log.c b/lustre/obdfilter/filter_log.c index 8e2e188..386da62 100644 --- a/lustre/obdfilter/filter_log.c +++ b/lustre/obdfilter/filter_log.c @@ -92,7 +92,8 @@ int filter_log_sz_change(struct llog_handle *cathandle, out: RETURN(rc); } -struct obd_llogs * filter_grab_llog_for_group(struct obd_device *, int); +struct obd_llogs * filter_grab_llog_for_group(struct obd_device *, + int, struct obd_export *); /* When this (destroy) operation is committed, return the cancel cookie */ void filter_cancel_cookies_cb(struct obd_device *obd, __u64 transno, @@ -103,7 +104,7 @@ void filter_cancel_cookies_cb(struct obd_device *obd, __u64 transno, struct llog_ctxt *ctxt; /* we have to find context for right group */ - llogs = filter_grab_llog_for_group(obd, cookie->lgc_lgl.lgl_ogr); + llogs = filter_grab_llog_for_group(obd, cookie->lgc_lgl.lgl_ogr, NULL); if (llogs) { ctxt = llog_get_context(llogs, cookie->lgc_subsys + 1); @@ -112,8 +113,9 @@ void filter_cancel_cookies_cb(struct obd_device *obd, __u64 transno, } else CERROR("no valid context for group "LPU64"\n", cookie->lgc_lgl.lgl_ogr); - } else - CERROR("unknown group "LPU64"!\n", cookie->lgc_lgl.lgl_ogr); + } else { + CDEBUG(D_HA, "unknown group "LPU64"!\n", cookie->lgc_lgl.lgl_ogr); + } OBD_FREE(cb_data, sizeof(struct llog_cookie)); } diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 50fa9b3..ee27de5 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2743,12 +2743,10 @@ static int osc_get_info(struct obd_export *exp, obd_count keylen, static int osc_set_info(struct obd_export *exp, obd_count keylen, void *key, obd_count vallen, void *val) { - struct ptlrpc_request *req; struct obd_device *obd = exp->exp_obd; struct obd_import *imp = class_exp2cliimp(exp); struct llog_ctxt *ctxt; - int rc, size[2] = {keylen, vallen}; - char *bufs[2] = {key, val}; + int rc = 0; ENTRY; if (keylen == strlen("next_id") && @@ -2803,14 +2801,6 @@ static int osc_set_info(struct obd_export *exp, obd_count keylen, memcmp(key, "mds_conn", strlen("mds_conn")) != 0) RETURN(-EINVAL); - req = ptlrpc_prep_req(imp, OST_SET_INFO, 2, size, bufs); - if (req == NULL) - RETURN(-ENOMEM); - - req->rq_replen = lustre_msg_size(0, NULL); - rc = ptlrpc_queue_wait(req); - ptlrpc_req_finished(req); - ctxt = llog_get_context(&exp->exp_obd->obd_llogs, LLOG_UNLINK_ORIG_CTXT); if (ctxt) { rc = llog_initiator_connect(ctxt); @@ -2875,7 +2865,7 @@ static int osc_connect(struct lustre_handle *exph, { int rc; - rc = client_connect_import(exph, obd, cluuid, 0); + rc = client_connect_import(exph, obd, cluuid, connect_flags); return rc; } diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 958c73f..2271c6c 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -884,13 +884,12 @@ static int ost_get_info(struct obd_export *exp, struct ptlrpc_request *req) static int ost_llog_handle_connect(struct obd_export *exp, struct ptlrpc_request *req) { - struct obd_device *obd = exp->exp_obd; struct llogd_conn_body *body; int rc; ENTRY; body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*body)); - rc = obd_llog_connect(obd, body); + rc = obd_llog_connect(exp, body); RETURN(rc); } -- 1.8.3.1