[SSSD] [PATCH] Add SIGUSR2 to reset offline status

Sumit Bose sbose at redhat.com
Mon Nov 22 13:32:52 UTC 2010


On Mon, Nov 22, 2010 at 06:49:20AM -0500, Stephen Gallagher wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 11/22/2010 06:33 AM, Sumit Bose wrote:
> > Hi,
> > 
> > I have found this patch useful for testing, but it might be useful for
> > other cases, too.
> > 
> 
> You have a misspelling in the manpage. s/immediatly/immediately/
> 
> I'm also not sure we want to bother mentioning that it "might help if
> online/offline detection is not fast enough".
> 
> If our detection isn't fast enough, that's a bug. We shouldn't be
> advertising in the manpages that this would be used to mitigate that.

ok, patch with a new version of the manpage is attached.

bye,
Sumit

> 
> - -- 
> Stephen Gallagher
> RHCE 804006346421761
> 
> Delivering value year after year.
> Red Hat ranks #1 in value among software vendors.
> http://www.redhat.com/promo/vendor/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAkzqWLsACgkQeiVVYja6o6MphwCgkhjOKTqIL2rHfQympq7izyBB
> XBgAn3DkVsBXRB/Lx9W2vpl0Joxw5TH3
> =Hqo1
> -----END PGP SIGNATURE-----
> _______________________________________________
> sssd-devel mailing list
> sssd-devel at lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/sssd-devel
-------------- next part --------------
From 48b2d5959052278a37fcb1e42805a3165f2eaef1 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Fri, 19 Nov 2010 21:09:47 +0100
Subject: [PATCH] Add SIGUSR2 to reset offline status

---
 src/man/sssd.8.xml    |    9 +++++++++
 src/monitor/monitor.c |   29 +++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/src/man/sssd.8.xml b/src/man/sssd.8.xml
index eaf37ca..bab37b2 100644
--- a/src/man/sssd.8.xml
+++ b/src/man/sssd.8.xml
@@ -150,6 +150,15 @@
                     </para>
                 </listitem>
             </varlistentry>
+            <varlistentry>
+                <term>SIGUSR2</term>
+                <listitem>
+                    <para>
+                        Tells the SSSD to go online immediately. This is mostly
+                        useful for testing purposes.
+                    </para>
+                </listitem>
+            </varlistentry>
         </variablelist>
     </refsect1>
 
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 98b671b..3eca764 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -1266,6 +1266,27 @@ static void signal_offline(struct tevent_context *ev,
     }
 }
 
+static void signal_offline_reset(struct tevent_context *ev,
+                                 struct tevent_signal *se,
+                                 int signum,
+                                 int count,
+                                 void *siginfo,
+                                 void *private_data)
+{
+    struct mt_ctx *monitor;
+    struct mt_svc *cur_svc;
+
+    monitor = talloc_get_type(private_data, struct mt_ctx);
+
+    DEBUG(8, ("Signaling providers to reset offline immediately.\n"));
+
+    for(cur_svc = monitor->svc_list; cur_svc; cur_svc = cur_svc->next) {
+        if (cur_svc->provider) {
+            service_signal_reset_offline(cur_svc);
+        }
+    }
+}
+
 int read_config_file(const char *config_file)
 {
     int ret;
@@ -1910,6 +1931,14 @@ int monitor_process_init(struct mt_ctx *ctx,
         return EIO;
     }
 
+    /* Handle SIGUSR2 (tell all providers to go reset offline) */
+    BlockSignals(false, SIGUSR2);
+    tes = tevent_add_signal(ctx->ev, ctx, SIGUSR2, 0,
+                            signal_offline_reset, ctx);
+    if (tes == NULL) {
+        return EIO;
+    }
+
     return EOK;
 }
 
-- 
1.7.3.2



More information about the sssd-devel mailing list