From c2f1b24904f93404494a6f8a5fcac71637c02962 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Allan=C3=A7on?= <haltode@gmail.com>
Date: Wed, 6 Jan 2021 10:42:59 +0100
Subject: [PATCH] fuse: invalidate kernel cache when removing inode

---
 swh/fuse/fuse.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/swh/fuse/fuse.py b/swh/fuse/fuse.py
index 989e7b3..49c4cf8 100644
--- a/swh/fuse/fuse.py
+++ b/swh/fuse/fuse.py
@@ -60,9 +60,6 @@ class Fuse(pyfuse3.Operations):
         self._next_inode += 1
         self._inode2entry[inode] = entry
 
-        # TODO add inode recycling with invocation to invalidate_inode when
-        # the dicts get too big
-
         return inode
 
     def _remove_inode(self, inode: int) -> None:
@@ -71,6 +68,11 @@ class Fuse(pyfuse3.Operations):
         except KeyError:
             pass
 
+        try:
+            pyfuse3.invalidate_inode(inode)
+        except FileNotFoundError:
+            pass
+
     def inode2entry(self, inode: int) -> FuseEntry:
         """ Return the entry matching a given inode """
 
-- 
GitLab