public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxim Patlasov <mpatlasov@parallels.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Anand Avati <avati@gluster.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Michael j Theall <mtheall@us.ibm.com>,
	fuse-devel <fuse-devel@lists.sourceforge.net>
Subject: Re: [PATCH 0/5] fuse: handle release synchronously (v4)
Date: Thu, 16 Oct 2014 14:31:17 +0400	[thread overview]
Message-ID: <543F9E75.2090509@parallels.com> (raw)
In-Reply-To: <CAJfpegs4Up_feUbqEGxfhq+rZneTmy0qcZy-k3so7VjufQY7-w@mail.gmail.com>

Hi Miklos,

On 10/09/2014 12:14 PM, Miklos Szeredi wrote:
> On Wed, Oct 1, 2014 at 1:28 PM, Maxim Patlasov <mpatlasov@parallels.com> wrote:
>> Given those patches must die, do you have any ideas how to resolve that
>> "spurious EBUSY" problem?
> Check the "sync_release" branch of fuse:
>
>    git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git sync_release
>
> And same branch name for libfuse:
>
>    git://git.code.sf.net/p/fuse/fuse sync_release
>
> What it does is send RELEASE from ->flush() after checking the
> refcount of file (being careful about RCU accesses).
>
> Lightly tested, more testing, as well as review, is welcome.

Thank you very much for efforts, highly appreciated! I've had a close 
look at your patches and found a few issues. Most of them can be easily 
fixed, but one puzzles me: the way how you detect last flush is not race 
free. Something as simple as:

int main(int argc, char *argv[])
{
     int fd = open(argv[1], O_RDWR);
     fork();
}

may easily dive into fuse_try_sync_release() concurrently and both 
observe file->f_count == 2. Then both return falling back to sending the 
release asynchronously. This makes sync/async behaviour unpredictable 
even for well-behaved applications which don't do any esoteric things 
like racing i/o with close or exiting while a descriptor is in-flight in 
a unix domain socket.

I cannot see any way to recognise last flush without help of VFS layer, 
can you?

Thanks,
Maxim

  reply	other threads:[~2014-10-16 10:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-25 12:05 [PATCH 0/5] fuse: handle release synchronously (v4) Maxim Patlasov
2014-09-25 12:05 ` [PATCH 1/5] fuse: add FOPEN_SYNC_RELEASE flag to ff->open_flags Maxim Patlasov
2014-09-25 12:05 ` [PATCH 2/5] fuse: cosmetic rework of fuse_send_readpages Maxim Patlasov
2014-09-25 12:06 ` [PATCH 3/5] fuse: wait for end of IO on release Maxim Patlasov
2014-09-25 12:06 ` [PATCH 4/5] fuse: add mount option to disable synchronous release Maxim Patlasov
2014-09-25 12:07 ` [PATCH 5/5] fuse: enable close_wait " Maxim Patlasov
2014-09-26 15:28 ` [PATCH 0/5] fuse: handle release synchronously (v4) Miklos Szeredi
2014-09-30  3:15   ` Miklos Szeredi
2014-09-30  3:55 ` Linus Torvalds
     [not found]   ` <CAFboF2yhGyjk4e_CHQV5b2WvB-QhsWNyHvFiFG_OM_=3-KArLQ@mail.gmail.com>
2014-09-30  7:43     ` Miklos Szeredi
2014-09-30 18:22     ` Linus Torvalds
2014-09-30 19:04     ` Linus Torvalds
2014-09-30 19:19       ` Miklos Szeredi
2014-09-30 20:44         ` Linus Torvalds
2014-10-01  3:47           ` Miklos Szeredi
2014-10-01 11:28           ` Maxim Patlasov
2014-10-09  8:14             ` Miklos Szeredi
2014-10-16 10:31               ` Maxim Patlasov [this message]
2014-10-16 13:43                 ` Miklos Szeredi
2014-10-16 13:54                   ` Linus Torvalds
2014-10-17  8:55                     ` Miklos Szeredi
2014-10-18 15:35                       ` Linus Torvalds
2014-10-18 15:40                         ` Linus Torvalds
2014-10-18 18:01                           ` Miklos Szeredi
2014-10-18 18:24                             ` Al Viro
2014-10-18 18:45                               ` Al Viro
2014-10-18 18:38                             ` Linus Torvalds
2014-10-18 18:22                           ` Al Viro
2014-10-18 22:44                             ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=543F9E75.2090509@parallels.com \
    --to=mpatlasov@parallels.com \
    --cc=avati@gluster.org \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=mtheall@us.ibm.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox