[PATCH] Optimisation for readdir using fstatat.

Jeremy Allison jra at samba.org
Fri May 24 14:31:17 MDT 2013


On Fri, May 24, 2013 at 01:23:20PM -0700, Jeremy Allison wrote:
> On Fri, May 24, 2013 at 04:19:59PM -0400, Ira Cooper wrote:
> > A concern raised by Richard, which I haven't had the chance to look at... Is
> > the use of "stat" here premature?
> 
> No.
> 
> > (For every readdir, are we guaranteed to stat, and not lstat etc...)
> 
> If we pass in a SMB_STRUCT_STAT *sbuf then yes, we are
> guaranteed to stat(). If it's a POSIX path then we will
> ignore the reply from readdir() here and re-stat using
> lstat() on top (see the comment in the patch). I checked
> out all codepaths before adding this.

If you're really worried about this I can add a:

int flags = (lp_posix_pathnames() ? AT_SYMLINK_NOFOLLOW : 0);

arg to the fstatat() call just to make sure we can't
mess up here.

Jeremy


More information about the samba-technical mailing list