_client_'s) through the various obd connection functions.
* Use this newfound UUID to match up the exports conjured up from reading
last_rcvd with reattaching clients.
struct obd_device;
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);
+int client_obd_connect(struct lustre_handle *conn, struct obd_device *obd,
+ char *cluuid);
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);
int (*o_detach)(struct obd_device *dev);
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);
+ int (*o_connect)(struct lustre_handle *conn, struct obd_device *src,
+ char *cluuid);
int (*o_disconnect)(struct lustre_handle *conn);
struct obd_export {
__u64 exp_cookie;
- struct lustre_handle exp_rconnh; /* remote connection handle */
- struct lustre_handle exp_impconnh;
- struct list_head exp_chain;
- struct obd_device *exp_obd;
+ struct lustre_handle exp_rconnh; /* remote connection handle */
+ struct lustre_handle exp_impconnh;
+ struct list_head exp_chain;
+ struct obd_device *exp_obd;
struct ptlrpc_connection *exp_connection;
- struct mds_export_data exp_mds_data;
+ struct mds_export_data exp_mds_data;
#if NOTYET && 0
- struct ldlm_export_data exp_ldlm_data;
- struct ost_export_data exp_ost_data;
+ struct ldlm_export_data exp_ldlm_data;
+ struct ost_export_data exp_ost_data;
#endif
- void *exp_data; /* device specific data */
- int exp_desclen;
- char *exp_desc;
+ void *exp_data; /* device specific data */
+ int exp_desclen;
+ char *exp_desc;
+ uuid_t exp_uuid;
};
struct obd_import {
RETURN(rc);
}
-static inline int obd_connect(struct lustre_handle *conn, struct obd_device *obd)
+static inline int obd_connect(struct lustre_handle *conn, struct obd_device *obd,
+ char *cluuid)
{
int rc;
OBD_CHECK_DEVSETUP(obd);
OBD_CHECK_OP(obd,connect);
- rc = OBP(obd, connect)(conn, obd);
+ rc = OBP(obd, connect)(conn, obd, cluuid);
RETURN(rc);
}
int class_uuid2dev(char *name);
struct obd_device *class_uuid2obd(char *name);
struct obd_export *class_new_export(struct obd_device *obddev);
-int class_connect (struct lustre_handle *conn, struct obd_device *obd);
+int class_connect(struct lustre_handle *conn, struct obd_device *obd,
+ char *cluuid);
int class_disconnect(struct lustre_handle *conn);
struct obd_export *class_conn2export(struct lustre_handle *);
return 0;
}
-int client_obd_connect(struct lustre_handle *conn, struct obd_device *obd)
+int client_obd_connect(struct lustre_handle *conn, struct obd_device *obd,
+ char *cluuid)
{
struct client_obd *cli = &obd->u.cli;
struct ptlrpc_request *request;
ENTRY;
down(&cli->cl_sem);
MOD_INC_USE_COUNT;
- rc = class_connect(conn, obd);
+#warning shaver: we might need a real cluuid here
+ rc = class_connect(conn, obd, NULL);
if (!rc)
cli->cl_conn_count++;
else {
if (rc)
RETURN(rc);
- req->rq_status = obd_connect(&conn, target);
+ req->rq_status = obd_connect(&conn, target, cluuid);
req->rq_repmsg->addr = conn.addr;
req->rq_repmsg->cookie = conn.cookie;
}
#endif
- err = obd_connect(&sbi->ll_mdc_conn, obd);
+#warning shaver: might need a cluuid here
+ err = obd_connect(&sbi->ll_mdc_conn, obd, NULL);
if (err) {
CERROR("cannot connect to %s: rc = %d\n", mdc, err);
GOTO(out_free, sb = NULL);
CERROR("OSC %s: not setup or attached\n", osc);
GOTO(out_mdc, sb = NULL);
}
- err = obd_connect(&sbi->ll_osc_conn, obd);
+#warning shaver: might need a cluuid here
+ err = obd_connect(&sbi->ll_osc_conn, obd, NULL);
if (err) {
CERROR("cannot connect to %s: rc = %d\n", osc, err);
GOTO(out_mdc, sb = NULL);
extern struct obd_device obd_dev[MAX_OBD_DEVICES];
/* obd methods */
-static int lov_connect(struct lustre_handle *conn, struct obd_device *obd)
+static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
+ char *cluuid)
{
struct ptlrpc_request *req;
struct lov_obd *lov = &obd->u.lov;
int i;
MOD_INC_USE_COUNT;
- rc = class_connect(conn, obd);
+ rc = class_connect(conn, obd, cluuid);
if (rc) {
MOD_DEC_USE_COUNT;
RETURN(rc);
}
/* retrieve LOV metadata from MDS */
- rc = obd_connect(&mdc_conn, lov->mdcobd);
+ rc = obd_connect(&mdc_conn, lov->mdcobd, NULL);
if (rc) {
CERROR("cannot connect to mdc: rc = %d\n", rc);
GOTO(out, rc = -EINVAL);
CERROR("Target %s not set up\n", uuidarray[i]);
GOTO(out_mem, rc = -EINVAL);
}
- rc = obd_connect(&lov->tgts[i].conn, tgt);
+ rc = obd_connect(&lov->tgts[i].conn, tgt, NULL);
if (rc) {
CERROR("Target %s connect error %d\n",
uuidarray[i], rc);
return result;
}
-static int mds_connect(struct lustre_handle *conn, struct obd_device *obd)
+static int mds_connect(struct lustre_handle *conn, struct obd_device *obd,
+ char *cluuid)
{
int rc;
+ struct list_head *p, *n;
-#warning shaver: find existing export if there is one.
MOD_INC_USE_COUNT;
- rc = class_connect(conn, obd);
+ if (cluuid) {
+ list_for_each_safe(p, n, &obd->obd_exports) {
+ struct obd_export *exp;
+ struct mds_client_data *mcd;
+
+ exp = list_entry(p, struct obd_export, exp_chain);
+ mcd = exp->exp_mds_data.med_mcd;
+ if (mcd && !memcmp(cluuid, mcd->mcd_uuid,
+ sizeof(mcd->mcd_uuid))) {
+ CDEBUG(D_INFO,
+ "existing export for UUID '%s' at %p\n",
+ cluuid, exp);
+ if (exp->exp_obd != obd)
+ LBUG();
+ exp->exp_rconnh.addr = conn->addr;
+ exp->exp_rconnh.cookie = conn->cookie;
+ conn->addr = (__u64) (unsigned long)exp;
+ conn->cookie = exp->exp_cookie;
+ CDEBUG(D_IOCTL, "connect: addr %Lx cookie %Lx\n",
+ (long long)conn->addr,
+ (long long)conn->cookie);
+ return 0;
+ }
+ }
+ }
+ rc = class_connect(conn, obd, NULL);
if (rc)
MOD_DEC_USE_COUNT;
case OBD_IOC_CONNECT: {
obd_data2conn(&conn, data);
- err = obd_connect(&conn, obd);
+ err = obd_connect(&conn, obd, NULL);
CDEBUG(D_IOCTL, "assigned export %Lx\n", conn.addr);
obd_conn2data(data, &conn);
/* a connection defines an export context in which preallocation can
be managed. */
-int class_connect (struct lustre_handle *conn, struct obd_device *obd)
+int class_connect (struct lustre_handle *conn, struct obd_device *obd,
+ char *cluuid)
{
struct obd_export * export;
if (conn == NULL) {
* You should have received a copy of the GNU General Public License
* along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
/* OBD devices materialize in /proc as a directory:
* /proc/lustre/obd/<number>
* by Peter Braam <braam@clusterfs.com>
*/
-static char rcsid[] __attribute ((unused)) = "$Id: echo.c,v 1.19 2002/07/31 20:49:37 braam Exp $";
-#define OBDECHO_VERSION "$Revision: 1.19 $"
+static char rcsid[] __attribute ((unused)) = "$Id: echo.c,v 1.20 2002/08/07 21:46:32 shaver Exp $";
+#define OBDECHO_VERSION "$Revision: 1.20 $"
#define EXPORT_SYMTAB
remove_proc_entry(ECHO_PROC_STAT, 0);
}
-static int echo_connect(struct lustre_handle *conn, struct obd_device *obd)
+static int echo_connect(struct lustre_handle *conn, struct obd_device *obd,
+ char *cluuid)
{
int rc;
MOD_INC_USE_COUNT;
- rc = class_connect(conn, obd);
+ rc = class_connect(conn, obd, NULL);
if (rc)
MOD_DEC_USE_COUNT;
}
/* obd methods */
-static int filter_connect(struct lustre_handle *conn, struct obd_device *obd)
+static int filter_connect(struct lustre_handle *conn, struct obd_device *obd,
+ char *cluuid)
{
int rc;
ENTRY;
MOD_INC_USE_COUNT;
- rc = class_connect(conn, obd);
+ rc = class_connect(conn, obd, cluuid);
if (rc)
MOD_DEC_USE_COUNT;
RETURN(rc);
GOTO(error_dec, err = -EINVAL);
}
- err = obd_connect(&ost->ost_conn, tgt);
+ err = obd_connect(&ost->ost_conn, tgt, NULL);
if (err) {
CERROR("fail to connect to device %d\n", data->ioc_dev);
GOTO(error_dec, err = -EINVAL);