[ARVADOS] updated: 03faf36a90f23cdf6ec2e07ffe905bc46fb5a048

Git user git at public.curoverse.com
Thu Sep 22 11:38:27 EDT 2016


Summary of changes:
 services/fuse/arvados_fuse/__init__.py |  2 +-
 services/fuse/arvados_fuse/fresh.py    | 13 +++++++++++--
 services/fuse/arvados_fuse/fusedir.py  |  6 +++---
 services/fuse/tests/test_cache.py      |  2 +-
 services/fuse/tests/test_inodes.py     |  1 +
 5 files changed, 17 insertions(+), 7 deletions(-)

       via  03faf36a90f23cdf6ec2e07ffe905bc46fb5a048 (commit)
      from  f40a1843030dea9c6dc65df7a1c3b0d507b95231 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 03faf36a90f23cdf6ec2e07ffe905bc46fb5a048
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Sep 22 11:38:21 2016 -0400

    10117: Tweak behavior of has_ref().  Fix naming of CacheTest.

diff --git a/services/fuse/arvados_fuse/__init__.py b/services/fuse/arvados_fuse/__init__.py
index 463a5f7..527e027 100644
--- a/services/fuse/arvados_fuse/__init__.py
+++ b/services/fuse/arvados_fuse/__init__.py
@@ -146,7 +146,7 @@ class InodeCache(object):
             if obj.in_use():
                 _logger.debug("InodeCache cannot clear inode %i, in use", obj.inode)
                 return
-            if obj.has_ref(only_children=True):
+            if obj.has_ref(True):
                 obj.kernel_invalidate()
                 _logger.debug("InodeCache sent kernel invalidate inode %i", obj.inode)
                 return
diff --git a/services/fuse/arvados_fuse/fresh.py b/services/fuse/arvados_fuse/fresh.py
index 43f53c9..e7e91db 100644
--- a/services/fuse/arvados_fuse/fresh.py
+++ b/services/fuse/arvados_fuse/fresh.py
@@ -115,8 +115,17 @@ class FreshBase(object):
         self.ref_count -= n
         return self.ref_count
 
-    def has_ref(self, only_children=False):
-        return self.ref_count > 0
+    def has_ref(self, only_children):
+        """Determine if there are any kernel references to this
+        object or its children.
+
+        If only_children is True, ignore refcount of self and only consider
+        children.
+        """
+        if only_children:
+            return False
+        else:
+            return self.ref_count > 0
 
     def objsize(self):
         return 0
diff --git a/services/fuse/arvados_fuse/fusedir.py b/services/fuse/arvados_fuse/fusedir.py
index 15f7564..7653084 100644
--- a/services/fuse/arvados_fuse/fusedir.py
+++ b/services/fuse/arvados_fuse/fusedir.py
@@ -164,11 +164,11 @@ class Directory(FreshBase):
                 return True
         return False
 
-    def has_ref(self, only_children=False):
-        if not only_children and super(Directory, self).has_ref():
+    def has_ref(self, only_children):
+        if super(Directory, self).has_ref(only_children):
             return True
         for v in self._entries.itervalues():
-            if v.has_ref():
+            if v.has_ref(False):
                 return True
         return False
 
diff --git a/services/fuse/tests/test_cache.py b/services/fuse/tests/test_cache.py
index f90c5b0..745c6f7 100644
--- a/services/fuse/tests/test_cache.py
+++ b/services/fuse/tests/test_cache.py
@@ -11,7 +11,7 @@ import unittest
 from .integration_test import IntegrationTest
 from .mount_test_base import MountTestBase
 
-class TmpCollectionTest(IntegrationTest):
+class CacheTest(IntegrationTest):
     mnt_args = ["--by-id", "--directory-cache=0"]
 
     @IntegrationTest.mount(argv=mnt_args)
diff --git a/services/fuse/tests/test_inodes.py b/services/fuse/tests/test_inodes.py
index 15bd8a9..f9d73b6 100644
--- a/services/fuse/tests/test_inodes.py
+++ b/services/fuse/tests/test_inodes.py
@@ -108,6 +108,7 @@ class InodeTests(unittest.TestCase):
         cache.touch(ent3)
         self.assertFalse(ent1.clear.called)
         self.assertFalse(ent3.clear.called)
+        self.assertTrue(ent3.kernel_invalidate.called)
         self.assertEqual(1100, cache.total())
 
         # ent1 still in use, ent3 doesn't have ref,

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list