From: bmarzins@sourceware.org <bmarzins@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/gnbd/tools/gnbd_import gnbd_import.c
Date: 11 Oct 2006 22:10:13 -0000 [thread overview]
Message-ID: <20061011221013.10424.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: bmarzins at sourceware.org 2006-10-11 22:10:13
Modified files:
gnbd/tools/gnbd_import: gnbd_import.c
Log message:
Change the way gnbd notifies multipathd about device changes, to deal with the
new udev.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gnbd/tools/gnbd_import/gnbd_import.c.diff?cvsroot=cluster&r1=1.18&r2=1.19
--- cluster/gnbd/tools/gnbd_import/gnbd_import.c 2006/08/11 15:18:14 1.18
+++ cluster/gnbd/tools/gnbd_import/gnbd_import.c 2006/10/11 22:10:12 1.19
@@ -577,13 +577,11 @@
}
-#define MULTIPATH_SCRIPT "/etc/dev.d/block/multipath.dev"
-void run_multipath_code(int minor_nr, int add)
+#define MULTIPATH_CTL "/sbin/mpath_ctl"
+void stop_mpath_monitoring(int minor_nr)
{
int i_am_parent, fd;
- char *envp[6];
- char devpath[32];
- char devname[32];
+ char args[32];
i_am_parent = daemonize();
if (i_am_parent < 0){
@@ -601,18 +599,10 @@
dup2(fd, 2);
if (fd > 2)
close(fd);
- envp[0] = "HOME=/";
- envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
- envp[2] = (add)? "ACTION=add" : "ACTION=remove";
- snprintf(devpath, 31, "DEVPATH=/block/gnbd%d", minor_nr);
- devpath[31] = '\0';
- envp[3] = devpath;
- snprintf(devname, 31, "DEVNAME=/dev/gnbd%d", minor_nr);
- devname[31] = '\0';
- envp[4] = devname;
- envp[5] = NULL;
- execle(MULTIPATH_SCRIPT, MULTIPATH_SCRIPT, NULL, envp);
- log_verbose("cannot exec %s : %s", MULTIPATH_SCRIPT, strerror(errno));
+ snprintf(args, 31, "remove path gnbd%d", minor_nr);
+ args[31] = '\0';
+ execl(MULTIPATH_CTL, MULTIPATH_CTL, args, NULL);
+ log_verbose("cannot exec %s : %s", MULTIPATH_CTL, strerror(errno));
exit(1);
}
@@ -642,7 +632,7 @@
if (pid > 0)
kill(pid, SIGKILL);
cleanup_device(name, minor, fd);
- run_multipath_code(minor, 0);
+ stop_mpath_monitoring(minor);
close(fd);
}
@@ -1042,7 +1032,7 @@
exit(1);
if (start_receiver(minor_nr))
exit(1);
- run_multipath_code(minor_nr, 1);
+ do_set_sysfs_attr(minor_nr, "block/uevent", "1");
}
ptr++;
}
reply other threads:[~2006-10-11 22:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061011221013.10424.qmail@sourceware.org \
--to=bmarzins@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.