From: Daira Hopwood <daira@jacaranda.org>
Date: Fri, 29 May 2015 20:39:47 +0000 (+0100)
Subject: Add logging of IN_IGNORED and IN_Q_OVERFLOW.
X-Git-Url: https://git.rkrishnan.org/pf/vdrive/bar.txt?a=commitdiff_plain;h=refs%2Fheads%2F1431.windows-drop-upload.5;p=tahoe-lafs%2Ftahoe-lafs.git

Add logging of IN_IGNORED and IN_Q_OVERFLOW.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---

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)