use.
#define OBD_IOC_OPEN _IOWR('f', 134, long)
#define OBD_IOC_CLOSE _IOWR('f', 135, long)
+#define OBD_IOC_RECOVD_FAILCONN _IOWR('f', 136, long)
+
/*
* l_wait_event is a flexible sleeping function, permitting simple caller
* configuration of interrupt and timeout sensitivity along with actions to
ENTRY;
- if (cmd != OBD_IOC_RECOVD_NEWCONN)
- RETURN(0);
+ if (cmd != OBD_IOC_RECOVD_NEWCONN && cmd != OBD_IOC_RECOVD_FAILCONN)
+ RETURN(-EINVAL); /* XXX ENOSYS? */
- /* Find the connection that's been rebuilt. */
+ /* Find the connection that's been rebuilt or has failed. */
spin_lock(&recovd->recovd_lock);
list_for_each(tmp, &recovd->recovd_troubled_items) {
conn = list_entry(tmp, struct ptlrpc_connection,
conn = NULL;
}
- if (!conn)
- GOTO(out, rc = -EINVAL);
+ if (!conn) {
+ if (cmd == OBD_IOC_RECOVD_NEWCONN)
+ GOTO(out, rc = -EINVAL);
+ /* XXX macroize/inline and share with loop above */
+ list_for_each(tmp, &recovd->recovd_managed_items) {
+ conn = list_entry(tmp, struct ptlrpc_connection,
+ c_recovd_data.rd_managed_chain);
+
+ LASSERT(conn->c_recovd_data.rd_recovd == recovd);
+
+ if (!strcmp(conn->c_remote_uuid, data->ioc_inlbuf1))
+ break;
+ conn = NULL;
+ }
+ if (!conn)
+ GOTO(out, rc = -EINVAL);
+ }
+
+ if (cmd == OBD_IOC_RECOVD_FAILCONN) {
+ spin_unlock(&recovd->recovd_lock);
+ recovd_conn_fail(conn);
+ spin_lock(&recovd->recovd_lock);
+
+ /* Jump straight to the "failed" phase of recovery. */
+ conn->c_recovd_data.rd_phase = RD_FAILED;
+ goto out;
+ }
+ /* else (NEWCONN) */
if (conn->c_recovd_data.rd_phase != RD_PREPARING)
GOTO(out, rc = -EALREADY);
{"dump_ldlm", jt_obd_dump_ldlm, 0,
"dump all lock manager state (no args)"},
{"newconn", jt_obd_newconn, 0, "newconn <olduuid> [newuuid]"},
+ {"failconn", jt_obd_failconn, 0, "failconn <uuid>"},
/* Debug commands */
{"======== debug =========", jt_noop, 0, "debug"},
return rc;
}
+int jt_obd_failconn(int argc, char **argv)
+{
+ int rc;
+ struct obd_ioctl_data data;
+
+ IOCINIT(data);
+ if (argc < 2)
+ return CMD_HELP;
+
+ data.ioc_inllen1 = strlen(argv[1]) + 1;
+ data.ioc_inlbuf1 = argv[1];
+
+ if (obd_ioctl_pack(&data, &buf, max)) {
+ fprintf(stderr, "error: %s: invalid ioctl\n", cmdname(argv[0]));
+ return -2;
+ }
+
+ rc = ioctl(fd, OBD_IOC_RECOVD_FAILCONN, buf);
+ if (rc < 0)
+ fprintf(stderr, "error: %s: %s\n", cmdname(argv[0]),
+ strerror(rc = errno));
+
+ return rc;
+}
+
static void signal_server(int sig)
{
if (sig == SIGINT) {
int jt_obd_ldlm_regress_stop(int argc, char **argv);
int jt_obd_dump_ldlm(int argc, char **argv);
int jt_obd_newconn(int argc, char **argv);
+int jt_obd_failconn(int argc, char **argv);
#endif