[Ocfs2-tools-devel] [PATCH 9/9] ocfs2_controld: Notify dlm_controld when we have a node go down.
Mark Fasheh
mfasheh at suse.com
Wed Aug 13 18:56:16 PDT 2008
On Wed, Aug 13, 2008 at 05:15:39PM -0700, Joel Becker wrote:
> +/*
> + * This is a fire and forget function. It will queue the notification and
> + * send it to dlm_controld. If dlm_controld responds in the negative, this
> + * function is called again to send. This goes on until dlm_controld sees
> + * the node go down.
> + *
> + * We don't sleep because the process switching should be good enough.
> + *
> + * If there is any error, malloc/network/whatever, we kill the daemon. We
> + * can't continue safely if we're not interacting with dlm_controld.
> + */
> +void dlmcontrol_node_down(const char *name, int nodeid)
> +{
> + int rc;
> + struct dlmcontrol_fs *df;
> + struct dlmcontrol_notification *dn;
> +
> + df = find_fs(name);
> + if (!df) {
> + log_error("Name \"%s\" is unknown", name);
> + return;
> + }
> +
> + dn = find_notification(df, nodeid);
> + if (!dn) {
> + dn = malloc(sizeof(struct dlmcontrol_notification));
> + if (!dn) {
> + log_error("Unable to allocate memory");
> + goto fail;
> + }
> + dn->dn_nodeid = nodeid;
> + list_add(&dn->dn_list, &df->df_notifications);
> + }
> +
> + log_debug("Sending notification of node %d for \"%s\"",
> + dn->dn_nodeid, df->df_name);
> + rc = dlmc_fs_notified(dlmcontrol_fd, df->df_name, dn->dn_nodeid);
Is dlmc_fs_notified() itself also fire and forget? Can we get into a
situation where it'll take us to notify_result(), which will in turn call it
again, which will in turn call notify_result, etc until we've eaten up a
whole lot of stack...
> + if (rc) {
> + log_error("Unable to send notification for node %d on "
> + "\"%s\": %s",
> + dn->dn_nodeid, df->df_name, strerror(errno));
> + goto fail;
> + }
> +
> + return;
> +
> +fail:
> + shutdown_daemon();
> +}
> +
> +static void notify_result(struct dlmcontrol_fs *df, int nodeid, int status)
> +{
> + if (!find_notification(df, nodeid)) {
> + log_error("Notified for nodeid %d on \"%s\", but we never asked for it!",
> + nodeid, df->df_name);
> + return;
> + }
> +
> + if (!status) {
> + complete_notification(df, nodeid);
> + return;
> + }
> +
> + dlmcontrol_node_down(df->df_name, nodeid);
> +}
> +
> static void dead_dlmcontrol(int ci)
> {
> if (ci != dlmcontrol_ci) {
--
Mark Fasheh
More information about the Ocfs2-tools-devel
mailing list