linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.org>
To: Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org>
Cc: fuse-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Miklos Szeredi <mszeredi-AlSwsSmVLrQ@public.gmane.org>
Subject: Re: [RFC] fuse: consistently use readdirplus offsets
Date: Wed, 6 Feb 2013 18:55:12 +0100	[thread overview]
Message-ID: <CAJfpegvm-CSgvPbEhdyuvL3rrryOVo1jGeXD98O+exMhkuhPGQ@mail.gmail.com> (raw)
In-Reply-To: <20130205031202.GA9062-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>

On Tue, Feb 5, 2013 at 4:12 AM, Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org> wrote:
> Miklos Szeredi <miklos-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.org> wrote:
>> I think the problem is that directory offsets are not consistent
>> between readdir and readdirplus.  The solution is that userspace
>> should always use the same offsets.  This makes the readdirplus
>> implementation more complex but that's really the only sane thing to
>> do.
>
> I think something like the following is necessary in the kernel, too.
> (Userspace patch coming)

Can you please explain what this patch is trying to do?  Because I
think it's not doing what it wants ;)

Thanks,
Miklos

>
> ------------------------------- 8< --------------------------------
> From ed52619fda61c8f2b723ef72666e7acdd8885a1c Mon Sep 17 00:00:00 2001
> From: Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org>
> Date: Tue, 5 Feb 2013 02:54:28 +0000
> Subject: [PATCH] fuse: consistently use readdirplus offsets
>
> With adaptive readdirplus, filesystems may switch between normal
> readdir or readdirplus requests.  However, directory offsets
> must be maintained consistently to prevent the kernel from
> misinterpreting the offsets between different requests which
> may use the same buffer.
>
> Signed-off-by: Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org>
> ---
>  fs/fuse/dir.c |    7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
> index dc5e648..a8e4abb 100644
> --- a/fs/fuse/dir.c
> +++ b/fs/fuse/dir.c
> @@ -1313,7 +1313,7 @@ static int parse_dirplusfile(char *buf, size_t nbytes, struct file *file,
>
>  static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
>  {
> -       int plus, err;
> +       int err;
>         size_t nbytes;
>         struct page *page;
>         struct inode *inode = file->f_path.dentry->d_inode;
> @@ -1334,12 +1334,11 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
>                 return -ENOMEM;
>         }
>
> -       plus = fuse_use_readdirplus(inode, file);
>         req->out.argpages = 1;
>         req->num_pages = 1;
>         req->pages[0] = page;
>         req->page_descs[0].length = PAGE_SIZE;
> -       if (plus) {
> +       if (fuse_use_readdirplus(inode, file)) {
>                 attr_version = fuse_get_attr_version(fc);
>                 fuse_read_fill(req, file, file->f_pos, PAGE_SIZE,
>                                FUSE_READDIRPLUS);
> @@ -1352,7 +1351,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
>         err = req->out.h.error;
>         fuse_put_request(fc, req);
>         if (!err) {
> -               if (plus) {
> +               if (fc->do_readdirplus) {
>                         err = parse_dirplusfile(page_address(page), nbytes,
>                                                 file, dstbuf, filldir,
>                                                 attr_version);
> --
> Eric Wong

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb

  parent reply	other threads:[~2013-02-06 17:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87mx1ngmip.fsf@tucsk.pomaz.szeredi.hu>
2013-01-15  3:23 ` [PATCH v3 0/2] FUSE: Adaptive NFS-like readdirplus support Feng Shuo
2013-01-15  3:23   ` [PATCH v3 1/2] fuse: implement " Feng Shuo
2013-01-15  3:23   ` [PATCH v3 2/2] FUSE: Adapt readdirplus to application usage patterns Feng Shuo
     [not found]     ` <1358220208-27131-3-git-send-email-steve.shuo.feng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-01-25 14:16       ` Miklos Szeredi
2013-02-03  7:15     ` Eric Wong
2013-02-03  8:10       ` Eric Wong
2013-02-04 10:03         ` Feng Shuo
2013-02-04 10:10           ` Eric Wong
2013-02-04 12:46             ` [fuse-devel] " Miklos Szeredi
     [not found]               ` <CAJfpegtKM6jsegxV+Jx0QkOEP6MhO6en6nEq7bCEJHxAAfMKHw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-04 13:20                 ` Eric Wong
2013-02-05  3:12               ` [RFC] fuse: consistently use readdirplus offsets Eric Wong
     [not found]                 ` <20130205031202.GA9062-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2013-02-06 17:55                   ` Miklos Szeredi [this message]
2013-02-06 21:40                     ` Eric Wong

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=CAJfpegvm-CSgvPbEhdyuvL3rrryOVo1jGeXD98O+exMhkuhPGQ@mail.gmail.com \
    --to=miklos-sudqsbjrdhqhwmgevkv9ka@public.gmane.org \
    --cc=fuse-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mszeredi-AlSwsSmVLrQ@public.gmane.org \
    --cc=normalperson-rMlxZR9MS24@public.gmane.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;
as well as URLs for NNTP newsgroup(s).