summaryrefslogtreecommitdiff
path: root/msg.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-10-13 17:37:02 -0700
committerDan Williams <dan.j.williams@intel.com>2009-10-13 17:41:58 -0700
commit9f1da8242161ba684f2867f211eb7e9d4baa84bb (patch)
treee396bffdec4ef5915f4eb138f343809431042dc0 /msg.c
parentb928b5a0384e7181425a282a0586cbbb3c85fbc3 (diff)
mdmon: preserve socket over chroot
Connect to the monitor in the old namespace and use that connection for WaitClean requests when stopping the victim mdmon instance. This allows ping_monitor() to work post chroot(). Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'msg.c')
-rw-r--r--msg.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/msg.c b/msg.c
index 5a4839fa..8d52b948 100644
--- a/msg.c
+++ b/msg.c
@@ -177,10 +177,8 @@ int connect_monitor(char *devname)
return sfd;
}
-/* give the monitor a chance to update the metadata */
-int ping_monitor(char *devname)
+int fping_monitor(int sfd)
{
- int sfd = connect_monitor(devname);
int err = 0;
if (sfd < 0)
@@ -194,6 +192,16 @@ int ping_monitor(char *devname)
if (!err && wait_reply(sfd, 20) != 0)
err = -1;
+ return err;
+}
+
+
+/* give the monitor a chance to update the metadata */
+int ping_monitor(char *devname)
+{
+ int sfd = connect_monitor(devname);
+ int err = fping_monitor(sfd);
+
close(sfd);
return err;
}