<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 2 Aug 2021 at 13:49, Max Reitz <<a href="mailto:mreitz@redhat.com">mreitz@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 02.08.21 12:44, Gal Hammer wrote:<br>
><br>
><br>
> On Mon, 2 Aug 2021 at 13:36, Dr. David Alan Gilbert <br>
> <<a href="mailto:dgilbert@redhat.com" target="_blank">dgilbert@redhat.com</a> <mailto:<a href="mailto:dgilbert@redhat.com" target="_blank">dgilbert@redhat.com</a>>> wrote:<br>
><br>
>     * Gal Hammer (<a href="mailto:ghammer@redhat.com" target="_blank">ghammer@redhat.com</a> <mailto:<a href="mailto:ghammer@redhat.com" target="_blank">ghammer@redhat.com</a>>) wrote:<br>
>     > Hello,<br>
>     ><br>
>     > When using NFS as a shared folder (mount type nfs4) with a Linux<br>
>     guest I<br>
>     > have the following issue:<br>
>     ><br>
>     > Guest:<br>
>     > $ ls -la /mnt/shared<br>
>     > total 8<br>
>     > drwxr-xrwx.  2  135  135 4096 Aug  2 13:08 .<br>
>     > dr-xr-xr-x. 17 root   root    224 May 23 10:58 ..<br>
>     > -rw-r--rw-.  1  135  135   27 Aug  2 13:07 readme.txt<br>
>     ><br>
>     > Host:<br>
>     > $ rm readme.txt<br>
>     ><br>
>     > Guest:<br>
>     > $ ls -la /mnt/shared<br>
>     > total 8<br>
>     > drwxr-xrwx.  2  135  135 4096 Aug  2 13:10 .<br>
>     > dr-xr-xr-x. 17 root   root    224 May 23 10:58 ..<br>
>     > -rw-r--rw-.  1  135  135   27 Aug  2 13:07<br>
>     .nfs0000000001b600d000000005<br>
>     ><br>
>     > Guest:<br>
>     > $ cat /mnt/shared/readme.txt<br>
>     > This is a readme.txt file.<br>
>     ><br>
>     > So it seems that the virtiofsd has a reference to the file which<br>
>     the guest<br>
>     > is not aware of and is unable to send a FUSE_FORGET message.<br>
>     This results<br>
>     > in a file not actually deleted (renamed to .nfsXXX) and is still<br>
>     accessible<br>
>     > by the guest.<br>
>     ><br>
>     > I have a similar problem when deleting a file from a Windows<br>
>     guest side.<br>
>     > The FUSE_READDIR(PLUS) commands add a reference count to files<br>
>     which the OS<br>
>     > doesn't have a file context for. However I was able to solve it<br>
>     (for now?)<br>
>     > by keeping track of returned files' inodes.<br>
>     ><br>
>     > Is this behaviour current and by design?<br>
><br>
>     Current problem, not really by design; the problem is the O_PATH files<br>
>     that we have open for the inodes.  I thought if the guest sent the<br>
>     forget for the file then it got closed.<br>
><br>
><br>
> So if I understand then sending forget message for each inode returned <br>
> by readdir won't solve the problem because you need the open files for <br>
> inodes?<br>
<br>
virtiofsd internally keeps an lo_inode object for every inode that has <br>
been looked up at some point, and every such lo_inode contains an O_PATH <br>
fd referencing that inode.  I don’t know by heart what the conditions <br>
for dropping those lo_inode objects are.<br></blockquote><div><br></div><div><div style="font-family:verdana,sans-serif" class="gmail_default">I think it depends on the guest's forget message.<br></div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
However, once it’s possible to use file handles to reference inodes <br>
instead of O_PATH fds (already in virtiofsd-rs, for virtiofsd there’s <br>
this series: <br>
<a href="https://listman.redhat.com/archives/virtio-fs/2021-July/msg00050.html" rel="noreferrer" target="_blank">https://listman.redhat.com/archives/virtio-fs/2021-July/msg00050.html</a>), <br>
then giving the appropriate options (-o inode_file_handles -o <br>
modcaps=+dac_read_search) should result in no O_PATH fds being kept <br>
around anymore, so that deleting an inode on the host will result in the <br>
inode being truly deleted (unless the guest still has it open).<br></blockquote><div><br></div><div><div style="font-family:verdana,sans-serif" class="gmail_default">Will the guest will still need to send forget messages with this new feature?</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
But with O_PATH fds, it’s kind of by design, I would say.<br></blockquote><div><br></div><div><div style="font-family:verdana,sans-serif" class="gmail_default">Thanks for the clarification.</div><div style="font-family:verdana,sans-serif" class="gmail_default"><br></div><div style="font-family:verdana,sans-serif" class="gmail_default">    Gal.</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Max<br>
<br>
</blockquote></div></div>