[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-unstable-847-g22ac34a
Jeremy Allison
jra at samba.org
Sun Dec 23 00:51:04 GMT 2007
On Sat, Dec 22, 2007 at 04:42:12PM -0800, Jeremy Allison wrote:
> On Sat, Dec 22, 2007 at 04:30:49PM -0800, Jeremy Allison wrote:
> > On Sat, Dec 22, 2007 at 04:11:14PM -0600, James Peach wrote:
> > >
> > > Cache the underlying filesystem capabilities at connection time.
> > >
> > > This change alters the Samba connection code to cache the filesystem
> > > capabilities when a new client connects. This can be used to enable
> > > filesystem specific optimisations is a general manner.
> >
> > James, once you've determined the filesystem capabilities
> > for the share, if they're found to be case insensitive and
> > case preserving, then it needs to override these settings
> > in the connection struct.
> >
> > bool case_sensitive;
> > bool case_preserve;
> > bool short_case_preserve;
> >
> > If you do this then the unix_convert() function already
> > has the logic to bypass case sensitive searches for pathname
> > lookups that will never be found. This will massively speed
> > up smbd on directories with thousands of entries when a filename
> > that doesn't exist is looked up.
>
> Alternately we need to finish the fixes in smbd/filename.c,
> which I'm looking at now :-).
Here is the proposed patch. James please review.
Thanks,
Jeremy.
-------------- next part --------------
diff --git a/source/smbd/filename.c b/source/smbd/filename.c
index f0d036b..6da4f2c 100644
--- a/source/smbd/filename.c
+++ b/source/smbd/filename.c
@@ -222,8 +222,14 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
start = name;
- if(!conn->case_sensitive
- && stat_cache_lookup(conn, &name, &dirpath, &start, &st)) {
+ /* If we're providing case insentive semantics or
+ * the underlying filesystem is case insensitive,
+ * then a case-normalized hit in the stat-cache is
+ * authoratitive. JRA.
+ */
+
+ if((!conn->case_sensitive || !(conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) &&
+ stat_cache_lookup(conn, &name, &dirpath, &start, &st)) {
*pst = st;
goto done;
}
@@ -269,10 +275,11 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
/*
* A special case - if we don't have any mangling chars and are case
- * sensitive then searching won't help.
+ * sensitive or the underlying filesystem is case insentive then searching
+ * won't help.
*/
- if (conn->case_sensitive &&
+ if ((conn->case_sensitive || (conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) &&
!mangle_is_mangled(name, conn->params)) {
goto done;
}
More information about the samba-technical
mailing list