<br><br><div class="gmail_quote">On Tue, Jun 12, 2012 at 9:43 PM, Emmanuel Dreyfus <span dir="ltr">&lt;<a href="mailto:manu@netbsd.org" target="_blank">manu@netbsd.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi<br>
<br>
I have a concern with how NetBSD FUSE hande nodes TTL and FORGET.<br>
<br>
When we create/mkdir/mknod/lookup a node, we get a TTL for it (this is<br>
the entry_valid field in struct fuse_entry_out). The kernel should not<br>
lookup the node again until the TTL expires.<br>
<br>
This means that once the TTL is expired, the kernel must do a lookup,<br>
again, and therefore that the previously obtained node should not be<br>
used. That suggests a FUSE FORGET can be sent for it as soon as (the<br>
kernel does not reference it AND TTL is expired).<br>
<br>
For now, NetBSD is lazy about the FUSE FORGET. It is sent when it<br>
reaches the vnode limit and needs to make room. This means there are a<br>
lot of stale nodes that remain in the kernel and in glusterfs, consuming<br>
memory. I can switch to a behavior where the FUSE FORGET are sent<br>
aggressively as soon as (kernel reference drops to 0 and TTL is<br>
expired), but this will cause a lot of useless FUSE messages, with an<br>
impact on the performance front.<br>
<br>
To make it clear, here is what we have with lazy FORGET policy:<br>
LOOKUP a<br>
INACTIVE a<br>
(ttl expires)<br>
LOOKUP a<br>
INACTIVE a<br>
(ttl expires)<br>
LOOKUP a<br>
...<br>
<br>
And here is what I get wth aggressive FORGET policy<br>
LOOKUP a<br>
INACTIVE a<br>
(ttl expires)<br>
FORGET a  &lt;- extra useless FORGET<br>
LOOKUP a<br>
INACTIVE a<br>
(ttl expires)<br>
FORGET a  &lt;- extra useless FORGET<br>
LOOKUP a<br>
...<br>
<br>
What do you think is the best approach? How does the Linux kernel<br>
handles the situation?<br>
<span class="HOEnZb"><font color="#888888">
<br></font></span></blockquote><div><br></div><div>The Linux kernel uses the second method. That works fine most of the time. In Linux there is also the option of the userspace filesystem explicitly hand-picking and invalidating entries which results in FORGET for that inode (provided it is not ref&#39;d by anything else like calls, fds etc.)</div>
<div><br></div><div>Avati</div></div>