On 05/25/2017 04:08 PM, Nikolaus Rath wrote:
Hello, I am trying to debug a sporadic test failure in libfuse (https://github.com/libfuse/libfuse/issues/157). Can someone tell me at which point the fuse kernel module will send a RELEASE request to userspace?
Anytime after fuse_release(). It only puts request to background queue. Later, the request will be transferred to pending queue. And later, the userspace will fetch it by fuse_dev_do_read().
Is it possible that this is delayed until after the close() syscall for the last fd has returned and userspace has submitted a different fuse request for the same fs?
I think it's possible. See how flush_bg_queue() do nothing if fc->active_background > fc->max_background.
Looking at fs/fuse/file.c, it looks as if fuse_release() directly calls fuse_request_send_background() to send the request. But at that point I can no longer follow the code. Is it possible for another request to sneak in at this point?
Yes, but not for that given fuse_file that we're closing now.
Furthermore, does the VFS call fuse_release() directly while handling the close() syscall, or does this happen asynchronously later on?
It's called directly for well-behaved applications in well-controlled environment, but there are some exceptions. You may be interested to read https://sourceforge.net/p/fuse/mailman/message/32872225/
Thanks! -Nikolaus