Speed problem - smbclient doesn't send duplicate ACKs in case of pacekt loss

Derrell.Lipman at UnwiredUniverse.com Derrell.Lipman at UnwiredUniverse.com
Tue Jan 4 05:46:17 GMT 2005


Jeremy Allison <jra at samba.org> writes:

> Can you send me this patch asap for evaluation please !
> I'd like to get this into the latest 3.0.11pre release.

Here it is, a bit earlier than expected.

Attached is a patch to the latest 3.0.11pre2 tree which features the following
bug fixes and additional capabilities.  The changes are explained here in
approximately the order in which they are found in the patch.

- lib/util.c and lib/select.c

  * In an application with signals, it was possible for functions to block
    indefinitely while awaiting timeouts.  This patch ensures that if a system
    call with a timeout is aborted and needs to be restarted, it is restarted
    with a timeout which is adjusted for the amount of time already waited.

- libsmb/clisecdesc.c

  * Fixed a bug in which it was possible for memory to be freed without having
    been first allocated.

- libsmb/libsmbclient.c

  * My previous contribution of extended attribute functions applied primarily
    to access control lists.  These changes add the ability to set and get the
    DOS attributes.  This change was needed because simulating the DOS
    attributes with mode bits in chmod() was unreliable; i.e. for directories,
    changes to these bits were ignored entirely (since directories need to have
    the execute bits set).  It is now possible to set and get DOS attributes of
    any file or folder using the new extended attribute functions.

  * URL encoding and decoding was not done symmetrically.  Although
    smbc_opendir() and smbc_open() expected a url-encoded path (e.g. spaces
    converted to "%20", etc.), smbc_readdir() would return non-url-encoded
    paths.  There are many times when this is desired behavior, e.g. when the
    returned paths are to be presented directly to a user.  However, there are
    also many times when it would be better to have the returned strings url-
    encoded, e.g. when they will be appended to the path opened with
    smbc_opendir() and passed back to an smbc_*() function.

    ~ smbc_urldecode() and smbc_urlencode() are now publicly accessible
      functions.

    ~ added an option in the context structure to specify whether or not to
      url-encode returned readdir entries.

  * In my earlier patch, currently in the 3.0 tree, I had provided a method of
    specifying which master browser to query when browsing for workgroups.
    This was to solve the problem that a master browser which has been running
    for only a short period of time does not yet know about all workgroups on
    the local network.  I had implemented a method where one could pass
    "smb://" or "smb://?mb=.any" to use, as was traditional, the first
    discovered master browser; or "smb://?mb=.all" to request the browse list
    from all discovered master browsers and return a merged list.

    Unfortunately, my implementation violated the URI syntax.  In this patch, I
    have removed the the previous implementation (following discussions a few
    months ago with crh and rsharpe) and replaced it with a choice in a set of
    options within the context structure.

  * Fixed a bug where memory was freed after having been previously freed.

  * Added the capability, again through an options selection in the context, to
    have only one connection per server.  Previously, each share would get its
    own connection.  For long-running applications, it is not necessarily
    desirable to maintain lots and lots of connections -- in fact, XP Home
    appears to stop replying if too many connections are established
    concurrently -- so instead, a single connection may be maintained with a
    tree connect being issued for each change of share use on that server.

- libsmb/cliconnect.c

  * cli_tdis() was not setting the cnum field back to -1, so there was no way
    to determine whether an existing tree connection was active.

- libsmb/libsmb_cache.c

  * more changes here pertaining to whether to reuse a connection to a server
    for multiple shares, or to establish a new connection for each share.

- include/libsmb_internal.h

  * The space for directory entries was not adequate given the new option of
    urlencoding the returned directory entries

- include/libsmbclient.h

  * mappings of DOS mode bits

  * new _smbc_options structure in context.  The capabilities are explained in
    excruciating detail, therein.



Note that all new features default to the original behavior, to prevent
backwards compatibility issues, except for the number of local master browsers
to query for the list of workgroups.  This now defaults to 3 instead of 1,
which is a reasonable compromise between getting an accurate browse list, and
the extra (really, pretty insubstantial) amount of time required to query
additional local master browsers.

I've been running with these changes for the past few months with no problems,
so I believe this to be a reasonably stable patch.

Cheers,

Derrell

-------------- next part --------------
A non-text attachment was scrubbed...
Name: samba3-diffs
Type: application/octet-stream
Size: 93071 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20050104/7f8e8edf/samba3-diffs-0001.obj


More information about the samba-technical mailing list