Skip to contentSkip to conversation

when not to forget explicitly

Virtio-fs Laszlo Ersek 2 participants 2 messages Dec 6, 2020 – Dec 7, 2020

lore
Share & tools
lore
#0 lore raw

Hi Miklos,

what FUSE requests are those after which the client is not supposed to ask the server to forget a nodeid?

I'm surprised to see the following comment in "tools/virtiofsd/passthrough_ll.c", in "struct lo_inode":

/*
* This counter keeps the inode alive during the FUSE session.
* Incremented when the FUSE inode number is sent in a reply
* (FUSE_LOOKUP, FUSE_READDIRPLUS, etc). Decremented when an inode is
* released by requests like FUSE_FORGET, FUSE_RMDIR, FUSE_RENAME, etc. *
* Note that this value is untrusted because the client can manipulate
* it arbitrarily using FUSE_FORGET requests.
*
* Protected by lo->mutex.
*/
uint64_t nlookup;

I can identify the places in my FUSE client code where I learn of a new inode, but I can't tell what requests include an automatic "forget".

The above mentions FUSE_RMDIR, which I didn't expect. I guess it also applies to FUSE_UNLINK. Is there anything else?

I'd really appreciate an exhaustive list of request types that auto-forget :)

Thank you!
Laszlo

#1 lore raw
Quoted 22 lines · Laszlo Ersek

Hi Miklos,

what FUSE requests are those after which the client is not supposed to ask the server to forget a nodeid?

I'm surprised to see the following comment in "tools/virtiofsd/passthrough_ll.c", in "struct lo_inode":

/*
* This counter keeps the inode alive during the FUSE session.
* Incremented when the FUSE inode number is sent in a reply
* (FUSE_LOOKUP, FUSE_READDIRPLUS, etc). Decremented when an inode is
* released by requests like FUSE_FORGET, FUSE_RMDIR, FUSE_RENAME, etc. *
* Note that this value is untrusted because the client can manipulate
* it arbitrarily using FUSE_FORGET requests.
*
* Protected by lo->mutex.
*/
uint64_t nlookup;

Quoted 5 lines

I can identify the places in my FUSE client code where I learn of a new inode, but I can't tell what requests include an automatic "forget".

The above mentions FUSE_RMDIR, which I didn't expect. I guess it also applies to FUSE_UNLINK. Is there anything else?

Nope, the comment is wrong. It is only decremented on FUSE_FORGET.

Thanks,
Miklos