Return-Path: Received: from out1-smtp.messagingengine.com ([66.111.4.25]:36513 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750947AbdE2Qti (ORCPT ); Mon, 29 May 2017 12:49:38 -0400 From: Nikolaus Rath To: Maxim Patlasov Cc: linux-fsdevel , "fuse-devel\@lists.sourceforge.net" Subject: Re: [fuse-devel] fuse: when are release requests queued? References: <87a860r0v9.fsf@thinkpad.rath.org> Date: Mon, 29 May 2017 09:49:36 -0700 In-Reply-To: (Maxim Patlasov's message of "Fri, 26 May 2017 18:39:56 -0700") Message-ID: <87zidva9r3.fsf@vostro.rath.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hi Maxim, On May 26 2017, Maxim Patlasov wrote: > 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. Thanks Maxim! Not sure what I'd do with these issues without you :-). Is there a way to deliberate trigger this behavior for debugging? For example, is there a kernel equivalent of sleep(1) that I could put into fuse_release()? >> 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. I assume that a fuse_file refers to the (formerly) opened file, right? So e.g. a unlink() request for the same directly entry could still go through before RELEASE has been transferred to the pending queue? Best, -Nikolaus --=20 GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F =C2=BBTime flies like an arrow, fruit flies like a Banana.=C2= =AB