From a7458e10b0ad40cd9872712423ab406a782508a8 Mon Sep 17 00:00:00 2001
From: Daira Hopwood <daira@jacaranda.org>
Date: Fri, 29 May 2015 21:39:47 +0100
Subject: [PATCH] Add logging of IN_IGNORED and IN_Q_OVERFLOW.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---
 src/allmydata/frontends/drop_upload.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/allmydata/frontends/drop_upload.py b/src/allmydata/frontends/drop_upload.py
index 0b658d6f..f1466f70 100644
--- a/src/allmydata/frontends/drop_upload.py
+++ b/src/allmydata/frontends/drop_upload.py
@@ -193,7 +193,24 @@ class DropUploader(service.MultiService):
 
     def _notify(self, opaque, path, events_mask):
         self._log("inotify event %r, %r, %r\n" % (opaque, path, ', '.join(self._inotify.humanReadableMask(events_mask))))
+
+        # IN_Q_OVERFLOW, IN_IGNORED and IN_UNMOUNT can be sent to any watch.
+
+        if events_mask & IN_Q_OVERFLOW != 0:
+            self.log("queue overflow")
+            # FIXME should rescan
+            return
+
         path_u = unicode_from_filepath(path)
+        if events_mask & IN_IGNORED != 0:
+            if abspath_expanduser_unicode(path_u) == self._local_dir:
+                self.log("watch removed, directory deleted, or filesystem unmounted")
+                # FIXME what to do here?
+            return
+        if events_mask & IN_UNMOUNT != 0:
+            # ignore this; we'll also get an IN_IGNORED event.
+            return
+
         if path_u not in self._pending:
             self._append_to_deque(path_u)
 
-- 
2.45.2