linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Avati <avati@redhat.com>
To: Miklos Szeredi <miklos@szeredi.hu>,
	Maxim Patlasov <MPatlasov@parallels.com>
Cc: fuse-devel <fuse-devel@lists.sourceforge.net>,
	Anand Avati <avati@gluster.org>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [fuse-devel] [PATCH 6/6] fuse: add mount option to disable synchronous release
Date: Fri, 22 Aug 2014 11:10:08 -0700	[thread overview]
Message-ID: <53F78780.9000206@redhat.com> (raw)
In-Reply-To: <CAJfpegvGhPYnrwUk3gZwBo=NKpk=KzCSMpfm_sgji5O-X9kJLA@mail.gmail.com>

On 8/22/14, 7:09 AM, Miklos Szeredi wrote:
> On Thu, Aug 21, 2014 at 6:09 PM, Maxim Patlasov <MPatlasov@parallels.com> wrote:
>> Synchronous release ensures that kernel fuse reports to userspace exactly
>> last fput(). However, nothing guarantees that last fput() will happen in the
>> context of close(2). So userspace applications must be prepared to the
>> situation when close(2) returned, but processing of FUSE_RELEASE is not
>> completed by fuse daemon yet. To make testing such use cases easier, the
>> patch introduces DISABLE_SYNC_RELEASE mount option which effectively mask out
>> FOPEN_SYNC_RELEASE flag.
>
> Why not make this an INIT flag?  Much easier to add support for in userspace.
>
> Thanks,
> Miklos

In a real world scenario you may want to perform synchronous release 
selectively. As such performance over lots of small files is generally 
slow because of context switches, and a synchronous release adds an 
extra switch. In cases like 'grep -r' over lots of text files where 
consistency don't matter or userspace knows data doesn't get modified, 
the userspace can chose to not perform synchronous release with some 
heuristics (like size is small and open flag is O_RDONLY etc.) where as 
for large read/write files (like VM images?) you would want to perform 
synchronous release for consistency purposes. A global flag in INIT 
would make it too crude and impose the same consistency for all files.

Thanks
Avati

>
>>
>> Signed-off-by: Maxim Patlasov <mpatlasov@parallels.com>
>> ---
>> ---
>>   fs/fuse/file.c   |    3 ++-
>>   fs/fuse/fuse_i.h |    3 +++
>>   fs/fuse/inode.c  |    8 ++++++++
>>   3 files changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
>> index b92143a..ad3d357 100644
>> --- a/fs/fuse/file.c
>> +++ b/fs/fuse/file.c
>> @@ -296,7 +296,8 @@ static void fuse_prepare_release(struct fuse_file *ff, int flags, int opcode)
>>
>>   static bool must_release_synchronously(struct fuse_file *ff)
>>   {
>> -       return ff->open_flags & FOPEN_SYNC_RELEASE;
>> +       return ff->open_flags & FOPEN_SYNC_RELEASE &&
>> +               !(ff->fc->flags & FUSE_DISABLE_SYNC_RELEASE);
>>   }
>>
>>   void fuse_release_common(struct file *file, int opcode)
>> diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
>> index e8e47a6..c5e2fca 100644
>> --- a/fs/fuse/fuse_i.h
>> +++ b/fs/fuse/fuse_i.h
>> @@ -44,6 +44,9 @@
>>       doing the mount will be allowed to access the filesystem */
>>   #define FUSE_ALLOW_OTHER         (1 << 1)
>>
>> +/** Disable synchronous release */
>> +#define FUSE_DISABLE_SYNC_RELEASE (1 << 2)
>> +
>>   /** Number of page pointers embedded in fuse_req */
>>   #define FUSE_REQ_INLINE_PAGES 1
>>
>> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
>> index 03246cd..86d47d0 100644
>> --- a/fs/fuse/inode.c
>> +++ b/fs/fuse/inode.c
>> @@ -463,6 +463,7 @@ enum {
>>          OPT_ALLOW_OTHER,
>>          OPT_MAX_READ,
>>          OPT_BLKSIZE,
>> +       OPT_DISABLE_SYNC_RELEASE,
>>          OPT_ERR
>>   };
>>
>> @@ -475,6 +476,7 @@ static const match_table_t tokens = {
>>          {OPT_ALLOW_OTHER,               "allow_other"},
>>          {OPT_MAX_READ,                  "max_read=%u"},
>>          {OPT_BLKSIZE,                   "blksize=%u"},
>> +       {OPT_DISABLE_SYNC_RELEASE,      "disable_sync_release"},
>>          {OPT_ERR,                       NULL}
>>   };
>>
>> @@ -560,6 +562,10 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
>>                          d->blksize = value;
>>                          break;
>>
>> +               case OPT_DISABLE_SYNC_RELEASE:
>> +                       d->flags |= FUSE_DISABLE_SYNC_RELEASE;
>> +                       break;
>> +
>>                  default:
>>                          return 0;
>>                  }
>> @@ -583,6 +589,8 @@ static int fuse_show_options(struct seq_file *m, struct dentry *root)
>>                  seq_puts(m, ",default_permissions");
>>          if (fc->flags & FUSE_ALLOW_OTHER)
>>                  seq_puts(m, ",allow_other");
>> +       if (fc->flags & FUSE_DISABLE_SYNC_RELEASE)
>> +               seq_puts(m, ",disable_sync_release");
>>          if (fc->max_read != ~0)
>>                  seq_printf(m, ",max_read=%u", fc->max_read);
>>          if (sb->s_bdev && sb->s_blocksize != FUSE_DEFAULT_BLKSIZE)
>>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> fuse-devel mailing list
> fuse-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fuse-devel
>


      reply	other threads:[~2014-08-22 18:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-21 16:07 [PATCH 0/6] fuse: handle release synchronously (v3) Maxim Patlasov
2014-08-21 16:08 ` [PATCH 1/6] fuse: add FOPEN_SYNC_RELEASE flag to ff->open_flags Maxim Patlasov
2014-08-21 16:08 ` [PATCH 2/6] fuse: cosmetic rework of fuse_send_readpages Maxim Patlasov
2014-08-21 16:08 ` [PATCH 3/6] fuse: wait for end of IO on release Maxim Patlasov
2014-08-22 14:00   ` Miklos Szeredi
2014-08-25 15:12     ` Maxim Patlasov
2014-08-26  8:42   ` [PATCH 3/6] fuse: wait for end of IO on release (v2) Maxim Patlasov
2014-08-21 16:09 ` [PATCH 4/6] fuse: enable close_wait synchronous release Maxim Patlasov
2014-08-22 14:04   ` Miklos Szeredi
2014-08-25 15:27     ` Maxim Patlasov
2014-08-21 16:09 ` [PATCH 5/6] fuse: fix synchronous case of fuse_file_put() Maxim Patlasov
2014-08-22 14:08   ` Miklos Szeredi
2014-08-25 15:58     ` Maxim Patlasov
2014-09-11 16:14     ` Maxim Patlasov
2014-09-16  8:19       ` Miklos Szeredi
2014-09-24  7:19         ` Maxim Patlasov
2014-08-21 16:09 ` [PATCH 6/6] fuse: add mount option to disable synchronous release Maxim Patlasov
2014-08-22 14:09   ` Miklos Szeredi
2014-08-22 18:10     ` Anand Avati [this message]

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=53F78780.9000206@redhat.com \
    --to=avati@redhat.com \
    --cc=MPatlasov@parallels.com \
    --cc=avati@gluster.org \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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;
as well as URLs for NNTP newsgroup(s).