Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: "Hobin Woo" <hobin.woo@samsung.com>
To: "'Steve French'" <smfrench@gmail.com>
Cc: <linux-cifs@vger.kernel.org>, <linkinjeon@kernel.org>,
	<sfrench@samba.org>, <senozhatsky@chromium.org>, <tom@talpey.com>,
	<sj1557.seo@samsung.com>, <kiras.lee@samsung.com>
Subject: RE: [PATCH] ksmbd: make __dir_empty() compatible with POSIX
Date: Tue, 3 Sep 2024 14:53:06 +0900	[thread overview]
Message-ID: <002601dafdc5$8c483ce0$a4d8b6a0$@samsung.com> (raw)
In-Reply-To: <CAH2r5mvdprK8imp4MCgTS_t3Ke2Gk6bG3SJ0ksZGDNMR4wPGJQ@mail.gmail.com>

Android's FUSE file system, /storage/emulated/<USER>, is an example of this.
https://cs.android.com/android/platform/superproject/main/+/main:packages/providers/MediaProvider/jni/ReaddirHelper.cpp;l=52;drc=01c2d29eeefc2d344794429af3df08c38adfd57f

> -----Original Message-----
> From: Steve French <smfrench@gmail.com>
> Sent: Tuesday, September 3, 2024 2:45 PM
> To: Hobin Woo <hobin.woo@samsung.com>
> Cc: linux-cifs@vger.kernel.org; linkinjeon@kernel.org; sfrench@samba.org;
> senozhatsky@chromium.org; tom@talpey.com; sj1557.seo@samsung.com;
> kiras.lee@samsung.com
> Subject: Re: [PATCH] ksmbd: make __dir_empty() compatible with POSIX
> 
> Is there an example where you have seen an fs not report . and .. ?
> 
> On Tue, Sep 3, 2024 at 12:19 AM Hobin Woo <hobin.woo@samsung.com> wrote:
> >
> > Some file systems may not provide dot (.) and dot-dot (..) as they are
> > optional in POSIX. ksmbd can misjudge emptiness of a directory in
> those
> > file systems, since it assumes there are always at least two entries:
> > dot and dot-dot.
> > Just set the dirent_count to 2, if the first entry is not a dot.
> >
> > Signed-off-by: Hobin Woo <hobin.woo@samsung.com>
> > ---
> >  fs/smb/server/vfs.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c
> > index 9e859ba010cf..bb836fa0aaa6 100644
> > --- a/fs/smb/server/vfs.c
> > +++ b/fs/smb/server/vfs.c
> > @@ -1115,6 +1115,8 @@ static bool __dir_empty(struct dir_context *ctx,
> const char *name, int namlen,
> >         struct ksmbd_readdir_data *buf;
> >
> >         buf = container_of(ctx, struct ksmbd_readdir_data, ctx);
> > +       if (offset == 0 && !(namlen == 1 && name[0] == '.'))
> > +               buf->dirent_count = 2;
> >         buf->dirent_count++;
> >
> >         return buf->dirent_count <= 2;
> > --
> > 2.43.0
> >
> >
> 
> 
> --
> Thanks,
> 
> Steve



  reply	other threads:[~2024-09-03  5:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240903051932epcas1p31c823baa892d8dc3f3e2ed8e1c073250@epcas1p3.samsung.com>
2024-09-03  5:19 ` [PATCH] ksmbd: make __dir_empty() compatible with POSIX Hobin Woo
2024-09-03  5:45   ` Steve French
2024-09-03  5:53     ` Hobin Woo [this message]
     [not found]   ` <CAKYAXd_zBESXWJ+CubrDBd0u_i9h=CimJ=6E_DxtfNLTXxRPgA@mail.gmail.com>
     [not found]     ` <005401dafdc9$18aaee00$4a00ca00$@samsung.com>
2024-09-03  6:33       ` Hobin Woo

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='002601dafdc5$8c483ce0$a4d8b6a0$@samsung.com' \
    --to=hobin.woo@samsung.com \
    --cc=kiras.lee@samsung.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=sfrench@samba.org \
    --cc=sj1557.seo@samsung.com \
    --cc=smfrench@gmail.com \
    --cc=tom@talpey.com \
    /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