From: shaver Date: Tue, 15 Oct 2002 23:25:14 +0000 (+0000) Subject: - Move recovery setup into the (network-using) connect methods, to fix X-Git-Tag: v1_7_100~4522 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=da9fe9a9db237f8996cfe0c5bab5c11b9fe8057f;p=fs%2Flustre-release.git - Move recovery setup into the (network-using) connect methods, to fix LOVs. - Updated lov.xml file. --- diff --git a/lustre/include/linux/lustre_lib.h b/lustre/include/linux/lustre_lib.h index 6defd75..0e398bd 100644 --- a/lustre/include/linux/lustre_lib.h +++ b/lustre/include/linux/lustre_lib.h @@ -49,11 +49,14 @@ struct ptlrpc_request; struct obd_device; struct recovd_data; +struct recovd_obd; +#include int target_handle_connect(struct ptlrpc_request *req); int target_handle_disconnect(struct ptlrpc_request *req); int client_obd_connect(struct lustre_handle *conn, struct obd_device *obd, - obd_uuid_t cluuid); + obd_uuid_t cluuid, struct recovd_obd *recovd, + ptlrpc_recovery_cb_t recover); int client_obd_disconnect(struct lustre_handle *conn); int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf); int client_obd_cleanup(struct obd_device * obddev); diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index 549a54d..c253ca6 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -260,7 +260,8 @@ struct obd_ops { int (*o_setup) (struct obd_device *dev, obd_count len, void *data); int (*o_cleanup)(struct obd_device *dev); int (*o_connect)(struct lustre_handle *conn, struct obd_device *src, - obd_uuid_t cluuid); + obd_uuid_t cluuid, struct recovd_obd *recovd, + ptlrpc_recovery_cb_t recover); int (*o_disconnect)(struct lustre_handle *conn); diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index d9f2610..d2a963b 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -273,14 +273,16 @@ static inline int obd_setattr(struct lustre_handle *conn, struct obdo *obdo, } static inline int obd_connect(struct lustre_handle *conn, - struct obd_device *obd, obd_uuid_t cluuid) + struct obd_device *obd, obd_uuid_t cluuid, + struct recovd_obd *recovd, + ptlrpc_recovery_cb_t recover) { int rc; OBD_CHECK_DEVSETUP(obd); OBD_CHECK_OP(obd, connect); - rc = OBP(obd, connect)(conn, obd, cluuid); + rc = OBP(obd, connect)(conn, obd, cluuid, recovd, recover); RETURN(rc); } diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 69cb485..5d03065 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -635,11 +635,18 @@ static int ldlm_cleanup(struct obd_device *obddev) RETURN(0); } +static int ldlm_connect(struct lustre_handle *conn, struct obd_device *src, + obd_uuid_t cluuid, struct recovd_obd *recovd, + ptlrpc_recovery_cb_t recover) +{ + return class_connect(conn, src, cluuid); +} + struct obd_ops ldlm_obd_ops = { o_iocontrol: ldlm_iocontrol, o_setup: ldlm_setup, o_cleanup: ldlm_cleanup, - o_connect: class_connect, + o_connect: ldlm_connect, o_disconnect: class_disconnect }; diff --git a/lustre/lib/client.c b/lustre/lib/client.c index 29f4a63..59116eb 100644 --- a/lustre/lib/client.c +++ b/lustre/lib/client.c @@ -113,7 +113,8 @@ int client_obd_cleanup(struct obd_device * obddev) } int client_obd_connect(struct lustre_handle *conn, struct obd_device *obd, - obd_uuid_t cluuid) + obd_uuid_t cluuid, struct recovd_obd *recovd, + ptlrpc_recovery_cb_t recover) { struct client_obd *cli = &obd->u.cli; struct ptlrpc_request *request; @@ -149,6 +150,7 @@ int client_obd_connect(struct lustre_handle *conn, struct obd_device *obd, request->rq_reqmsg->addr = conn->addr; request->rq_reqmsg->cookie = conn->cookie; c = class_conn2export(conn)->exp_connection = request->rq_connection; + recovd_conn_manage(c, recovd, recover); rc = ptlrpc_queue_wait(request); rc = ptlrpc_check_status(request, rc); diff --git a/lustre/lib/target.c b/lustre/lib/target.c index 6750dbd..94665e0 100644 --- a/lustre/lib/target.c +++ b/lustre/lib/target.c @@ -67,7 +67,8 @@ int target_handle_connect(struct ptlrpc_request *req) conn.addr = req->rq_reqmsg->addr; conn.cookie = req->rq_reqmsg->cookie; - rc = obd_connect(&conn, target, cluuid); + rc = obd_connect(&conn, target, cluuid, ptlrpc_recovd, + target_revoke_connection); if (rc) GOTO(out, rc); @@ -90,8 +91,6 @@ int target_handle_connect(struct ptlrpc_request *req) list_add(&export->exp_conn_chain, &export->exp_connection->c_exports); spin_unlock(&export->exp_connection->c_lock); - recovd_conn_manage(export->exp_connection, ptlrpc_recovd, - target_revoke_connection); dlmimp = &export->exp_ldlm_data.led_import; dlmimp->imp_connection = req->rq_connection; dlmimp->imp_client = &export->exp_obd->obd_ldlm_client; diff --git a/lustre/llite/super.c b/lustre/llite/super.c index 587895c..605696f 100644 --- a/lustre/llite/super.c +++ b/lustre/llite/super.c @@ -143,7 +143,8 @@ static struct super_block * ll_read_super(struct super_block *sb, GOTO(out_free, sb = NULL); } - err = obd_connect(&sbi->ll_mdc_conn, obd, sbi->ll_sb_uuid); + err = obd_connect(&sbi->ll_mdc_conn, obd, sbi->ll_sb_uuid, + ptlrpc_recovd, ll_recover); if (err) { CERROR("cannot connect to %s: rc = %d\n", mdc, err); GOTO(out_free, sb = NULL); @@ -153,8 +154,6 @@ static struct super_block * ll_read_super(struct super_block *sb, mdc_conn = sbi2mdc(sbi)->cl_import.imp_connection; mdc_conn->c_level = LUSTRE_CONN_FULL; list_add(&mdc_conn->c_sb_chain, &sbi->ll_conn_chain); - recovd_conn_manage(class_conn2export(&sbi->ll_mdc_conn)->exp_connection, - ptlrpc_recovd, ll_recover); obd = class_uuid2obd(osc); if (!obd) { @@ -162,13 +161,12 @@ static struct super_block * ll_read_super(struct super_block *sb, GOTO(out_mdc, sb = NULL); } - err = obd_connect(&sbi->ll_osc_conn, obd, sbi->ll_sb_uuid); + err = obd_connect(&sbi->ll_osc_conn, obd, sbi->ll_sb_uuid, + ptlrpc_recovd, ll_recover); if (err) { CERROR("cannot connect to %s: rc = %d\n", osc, err); GOTO(out_mdc, sb = NULL); } - recovd_conn_manage(class_conn2export(&sbi->ll_osc_conn)->exp_connection, - ptlrpc_recovd, ll_recover); /* XXX: need to store the last_* values somewhere */ err = mdc_getstatus(&sbi->ll_mdc_conn, &rootfid, &last_committed, diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index db1a2e2..946afc0 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -28,7 +28,8 @@ /* obd methods */ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd, - obd_uuid_t cluuid) + obd_uuid_t cluuid, struct recovd_obd *recovd, + ptlrpc_recovery_cb_t recover) { struct ptlrpc_request *req = NULL; struct lov_obd *lov = &obd->u.lov; @@ -47,7 +48,7 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd, } /* retrieve LOV metadata from MDS */ - rc = obd_connect(&mdc_conn, lov->mdcobd, NULL); + rc = obd_connect(&mdc_conn, lov->mdcobd, NULL, recovd, recover); if (rc) { CERROR("cannot connect to mdc: rc = %d\n", rc); GOTO(out_conn, rc); @@ -129,7 +130,8 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd, CERROR("Target %s not set up\n", uuidarray[i]); GOTO(out_disc, rc = -EINVAL); } - rc = obd_connect(&lov->tgts[i].conn, tgt, NULL); + rc = obd_connect(&lov->tgts[i].conn, tgt, NULL, recovd, + recover); if (rc) { CERROR("Target %s connect error %d\n", uuidarray[i], rc); diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 6f149ab..1f60205 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -264,7 +264,8 @@ struct dentry *mds_fid2dentry(struct mds_obd *mds, struct ll_fid *fid, * on the server, etc. */ static int mds_connect(struct lustre_handle *conn, struct obd_device *obd, - obd_uuid_t cluuid) + obd_uuid_t cluuid, struct recovd_obd *recovd, + ptlrpc_recovery_cb_t recover) { struct obd_export *exp; struct mds_export_data *med; diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 29d6f02..17f4355 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -828,7 +828,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, char * cluuid = "OBD_CLASS_UUID"; obd_data2conn(&conn, data); - err = obd_connect(&conn, obd, cluuid); + err = obd_connect(&conn, obd, cluuid, NULL, NULL); CDEBUG(D_IOCTL, "assigned export "LPX64"\n", conn.addr); obd_conn2data(data, &conn); diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 6e923ee..26d66a6 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -421,7 +421,6 @@ int class_connect(struct lustre_handle *conn, struct obd_device *obd, if (!export) return -ENOMEM; - conn->addr = (__u64) (unsigned long)export; conn->cookie = export->exp_cookie; diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index 6d434a2..b12fe4b 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -12,8 +12,8 @@ * and Andreas Dilger */ -static char rcsid[] __attribute ((unused)) = "$Id: echo.c,v 1.38 2002/09/24 19:18:16 adilger Exp $"; -#define OBDECHO_VERSION "$Revision: 1.38 $" +static char rcsid[] __attribute ((unused)) = "$Id: echo.c,v 1.39 2002/10/15 23:25:10 shaver Exp $"; +#define OBDECHO_VERSION "$Revision: 1.39 $" #define EXPORT_SYMTAB @@ -91,7 +91,8 @@ void echo_proc_fini(void) } static int echo_connect(struct lustre_handle *conn, struct obd_device *obd, - obd_uuid_t cluuid) + obd_uuid_t cluuid, struct recovd_obd *recovd, + ptlrpc_recovery_cb_t recover) { int rc; diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index b65b305..323b884 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -337,7 +337,8 @@ static struct dentry *filter_parent(struct obd_device *obddev, obd_mode mode) /* obd methods */ static int filter_connect(struct lustre_handle *conn, struct obd_device *obd, - obd_uuid_t cluuid) + obd_uuid_t cluuid, struct recovd_obd *recovd, + ptlrpc_recovery_cb_t recover) { int rc; ENTRY; diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 35a5360..541e3e1 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -597,7 +597,7 @@ static int ost_setup(struct obd_device *obddev, obd_count len, void *buf) GOTO(error_dec, err = -EINVAL); } - err = obd_connect(&ost->ost_conn, tgt, NULL); + err = obd_connect(&ost->ost_conn, tgt, NULL, NULL, NULL); if (err) { CERROR("fail to connect to device %d\n", data->ioc_dev); GOTO(error_dec, err = -EINVAL); diff --git a/lustre/ptlrpc/connection.c b/lustre/ptlrpc/connection.c index 124fd23..a5528fd 100644 --- a/lustre/ptlrpc/connection.c +++ b/lustre/ptlrpc/connection.c @@ -23,6 +23,7 @@ #define DEBUG_SUBSYSTEM S_RPC #include +#include #include static spinlock_t conn_lock; diff --git a/lustre/ptlrpc/recovd.c b/lustre/ptlrpc/recovd.c index f0fe5ca..d8ace91 100644 --- a/lustre/ptlrpc/recovd.c +++ b/lustre/ptlrpc/recovd.c @@ -51,6 +51,10 @@ void recovd_conn_manage(struct ptlrpc_connection *conn, { struct recovd_data *rd = &conn->c_recovd_data; ENTRY; + if (!recovd || !recover) { + EXIT; + return; + } if (!list_empty(&rd->rd_managed_chain)) { if (rd->rd_recovd == recovd && rd->rd_recover == recover) { diff --git a/lustre/ptlrpc/rpc.c b/lustre/ptlrpc/rpc.c index fbece03..25d6449 100644 --- a/lustre/ptlrpc/rpc.c +++ b/lustre/ptlrpc/rpc.c @@ -28,6 +28,7 @@ #include #include #include +#include #include extern int ptlrpc_init_portals(void); @@ -153,13 +154,19 @@ int connmgr_iocontrol(long cmd, struct lustre_handle *hdl, int len, void *karg, RETURN(rc); } +static int connmgr_connect(struct lustre_handle *conn, struct obd_device *src, + obd_uuid_t cluuid, struct recovd_obd *recovd, + ptlrpc_recovery_cb_t recover) +{ + return class_connect(conn, src, cluuid); +} /* use obd ops to offer management infrastructure */ static struct obd_ops recovd_obd_ops = { o_setup: connmgr_setup, o_cleanup: connmgr_cleanup, o_iocontrol: connmgr_iocontrol, - o_connect: class_connect, + o_connect: connmgr_connect, o_disconnect: class_disconnect }; diff --git a/lustre/tests/lov.xml b/lustre/tests/lov.xml index c5eb61f..b768f5d 100644 --- a/lustre/tests/lov.xml +++ b/lustre/tests/lov.xml @@ -1,20 +1,20 @@ + - + - + - - + localhost 988 @@ -26,17 +26,17 @@ - + - - - - + - + + + + extN /tmp/ost1 no @@ -49,21 +49,21 @@ - + extN /tmp/ost2 no - + - + - + /mnt/lustre