The "fail path X" CLI command was an interesting debug tool, showing the checkers automatically reinstating the failed path. But some fun spoilers want to use the thing to prepare cable unplugs and other maintenance ops. So make the command also care about diabling and enabling the checker to inhibit auto-reinstates.
.init = readsector0_init,
.free = readsector0_free
},
- {0, 1, "", "", NULL, NULL, NULL, NULL},
+ {0, 1, 0, "", "", NULL, NULL, NULL, NULL},
};
void checker_set_fd (struct checker * c, int fd)
c->sync = 0;
}
+void checker_enable (struct checker * c)
+{
+ c->disable = 0;
+}
+
+void checker_disable (struct checker * c)
+{
+ c->disable = 1;
+}
+
struct checker * checker_lookup (char * name)
{
struct checker * c = &checkers[0];
{
int r;
+ if (c->disable)
+ return PATH_UNCHECKED;
if (c->fd <= 0) {
MSG(c, "no usable fd");
return PATH_WILD;
struct checker {
int fd;
int sync;
+ int disable;
char name[CHECKER_NAME_LEN];
char message[CHECKER_MSG_LEN]; /* comm with callers */
void * context; /* store for persistent data */
int checker_init (struct checker *, void **);
void checker_put (struct checker *);
-void checker_reset (struct checker * c);
-void checker_set_sync (struct checker * c);
-void checker_set_async (struct checker * c);
+void checker_reset (struct checker *);
+void checker_set_sync (struct checker *);
+void checker_set_async (struct checker *);
void checker_set_fd (struct checker *, int);
+void checker_enable (struct checker *);
+void checker_disable (struct checker *);
struct checker * checker_lookup (char *);
int checker_check (struct checker *);
int checker_selected (struct checker *);
condlog(2, "%s: reinstate path %s (operator)",
pp->mpp->alias, pp->dev_t);
+ checker_enable(&pp->checker);
return dm_reinstate_path(pp->mpp->alias, pp->dev_t);
}
struct vectors * vecs = (struct vectors *)data;
char * param = get_keyparam(v, PATH);
struct path * pp;
+ int r;
pp = find_path_by_dev(vecs->pathvec, param);
condlog(2, "%s: fail path %s (operator)",
pp->mpp->alias, pp->dev_t);
- return dm_fail_path(pp->mpp->alias, pp->dev_t);
+ r = dm_fail_path(pp->mpp->alias, pp->dev_t);
+ /*
+ * Suspend path checking to avoid auto-reinstating the path
+ */
+ if (!r)
+ checker_disable(&pp->checker);
+ return r;
}
int