s3: Make change notify immediately return a catch-all packet on underlying error
authorSteven Danneman <steven.danneman@isilon.com>
Wed, 18 Feb 2009 00:20:18 +0000 (16:20 -0800)
committerSteven Danneman <steven.danneman@isilon.com>
Fri, 20 Feb 2009 22:10:30 +0000 (14:10 -0800)
* This allows a problem in the underlying CN backend to be bubbled up
  to the general CN layer so a catch-all reply can be returned
* We now also return a catch-all response immediately if the server-side
  event queue becomes too big

source3/smbd/notify.c

index e360af9ef5f5362d7bdc6e89a2e169de62972160..8ceeaf5f5588ae4e5d5c091a3379ce944c00bc88 100644 (file)
@@ -372,13 +372,26 @@ static void notify_fsp(files_struct *fsp, uint32 action, const char *name)
        if ((fsp->notify->num_changes > 1000) || (name == NULL)) {
                /*
                 * The real number depends on the client buf, just provide a
-                * guard against a DoS here.
+                * guard against a DoS here.  If name == NULL the CN backend is
+                * alerting us to a problem.  Possibly dropped events.  Clear
+                * queued changes and send the catch-all response to the client
+                * if a request is pending.
                 */
                TALLOC_FREE(fsp->notify->changes);
                fsp->notify->num_changes = -1;
+               if (fsp->notify->requests != NULL) {
+                       change_notify_reply(fsp->conn,
+                                           fsp->notify->requests->req,
+                                           fsp->notify->requests->max_param,
+                                           fsp->notify);
+                       change_notify_remove_request(fsp->notify->requests);
+               }
                return;
        }
 
+       /* If we've exceeded the server side queue or received a NULL name
+        * from the underlying CN implementation, don't queue up any more
+        * requests until we can send a catch-all response to the client */
        if (fsp->notify->num_changes == -1) {
                return;
        }