[Samba] gvfs and (lib)smbclient

rosslagerwall at gmail.com rosslagerwall at gmail.com
Sun Apr 13 04:43:06 MDT 2014


Hi all,

I'm one of the GNOME gvfs maintainers, and would like to improve the support of
smb in gvfs, especially in the context of taking advantage of the improvements
of SMB2 and SMB3.  Currently we use libsmbclient which provides a fairly easy to
use API.  It is not, however, quite sufficient for the way that we would like to
use it (at least I think so):

- Slow transfer speeds.  Based on a comment from Jeremy [1], we use a maximum
block size of 65534 which seems to prevent us from maximizing throughput, even
on a 100MBps LAN.  I note that smbclient can achieve a higher throughput with
the same block size [2].
This may be related to the ability to support multiple packets in flight
to reduce the effect of latency (which is probably why smbclient can achieve
higher speeds for the same block size). The gvfs push and pull functions could
map to the cli_push and cli_pull functions.

- The mapping between NT error message and UNIX errno makes it difficult to
provide a nice error message to the user or even to know what's going on.  For
example, calling rename() with one of the path's having an invalid character
gives ENOMEM.  It is difficult to tell whether this is an out of memory error,
a malformed source URI or a malformed target URI.  It would be nice to get
access to the real error message.
Related bugs: https://bugzilla.gnome.org/show_bug.cgi?id=702568
              https://bugzilla.gnome.org/show_bug.cgi?id=350976

- No way of easily mapping to and from POSIX permissions resulting in files'
permissions often being inadvertently changed when saving files.
Related bugs: https://bugzilla.gnome.org/show_bug.cgi?id=592651
              https://bugzilla.gnome.org/show_bug.cgi?id=581368

- No support for POSIX extensions.
Related bugs: https://bugzilla.gnome.org/show_bug.cgi?id=562029
              https://bugzilla.samba.org/show_bug.cgi?id=5926

- No support for file monitoring, e.g. NT_TRANSACT_NOTIFY_CHANGE.
Related bugs: https://bugzilla.gnome.org/show_bug.cgi?id=627107
              https://bugzilla.samba.org/show_bug.cgi?id=7393

- Some extras that would be nice to have:
Server side copy.  (I understand this hasn't been implemented in Samba
client-side?).
Setting mtime and atime individually.
Finer-grained (e.g. microsecond/nanosecond) timestamps.

Grepping through the Samba source code suggests that almost all of the above is
tantalizingly available somewhere in Samba's various client bits.  So my
question is whether it is possible to access this functionality (through
libsmbclient or otherwise), and if so, how?  I note that my system has a
smbclient-raw pkgconfig file, yet can find almost nothing online about
how to use this library.

Cheers
Ross Lagerwall

[1] https://bugzilla.gnome.org/show_bug.cgi?id=588391#c10

[2]
Testing pulling files from a local Samba server from a tmpfs to a tmpfs.
Note that the latency of this is small and across a LAN any latency effects
would be more noticeable.
smbclient with default block size: 1429MB/s
smbclient with bs of 65534 bytes: 1644MB/s
smbget with default block size: 207MB/s
smbget with bs of 65534 bytes: 190MB/s
smbget with bs of 1MiB: 884MB/s


More information about the samba mailing list