smbnetfs suggestions
Status: Beta
Brought to you by:
kshevetskiy
1. Using main config in user home dirs is wrong for host setup. Rather use /etc/smbnetfs.conf and directive to include user configs with variable instantiation. Like: include %H/.config/smbnetfs.conf
2. Copying smb.conf to user home dir is something outstanding! What is config directive to use system wide smb.conf?
3. Autoupdate config by time period is not kosher enough and in fact completely unnecessary! Setting 'config_update_period 0' doesn't work!
4. use_gnome_keyring "false" doesn't turn off warning:
** Message: secret service operation failed: The name org.freedesktop.secrets was not provided by any .service files
5. very long timeout for absent server. Must work instantly.
I would say, that 5. is most important here...
The latter is because of getaddrinfo() delay in libsmbclient:
#0 0x00007ffff6c8e370 in getaddrinfo () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff75479f1 in resolve_hosts (name=0x7fffdc012ce0 "undefined.local", name_type=32, return_iplist=0x7ffff11634c8, return_count=0x7ffff11634d8)
at libsmb/namequery.c:1785
#2 0x00007ffff75485c3 in internal_resolve_name (name=0x7fffdc012ce0 "undefined.local", name_type=32, sitename=0x0, return_iplist=0x7ffff11634c8, return_count=0x7ffff11634d8,
resolve_order=0x7fffdc014d20 "lmhosts wins host bcast") at libsmb/namequery.c:2029
#3 0x00007ffff7548c37 in resolve_name (name=0x7fffdc012ce0 "undefined.local", return_ss=0x7ffff1163700, name_type=32, prefer_ipv4=false) at libsmb/namequery.c:2167
#4 0x00007ffff7422a05 in SMBC_opendir_ctx (context=0x7fffdc013480, fname=0x625ea0 "smb://undefined.local") at libsmb/libsmb_dir.c:714
#5 0x00007ffff741dffd in smbc_opendir (durl=0x625ea0 "smb://undefined.local") at libsmb/libsmb_compat.c:253
#6 0x000000000040ccb9 in smb_conn_srv_opendir (ctx=0x7ffff1163a50, query=0x6214b0, query_len=25) at smb_conn_srv.c:972
#7 0x000000000040b1ed in smb_conn_srv_listen (ctx=0x7ffff1163a50) at smb_conn_srv.c:300
Of course, the source of problem is in wrong network configuration. But user experience should be protected anyway from such kind of problems. The best solution would be to introduce name_resolution_timeout (in milliseconds) to libsmbclient with asynchronous name resolution (getaddrinfo_a or thread).
Delays minimized and more
Delays minimized and more:
* Timestamps in debug log
* Useless periodic config update is disabled by default
* Proper config handling, exit if config failed at startup
* max_retry_count is 0 by default
* Don't do last sleep(2) after last retry
* Per-host negative cache for errors ECONNREFUSED and ETIMEDOUT
(adds C++ to build requirements)
There is situation when GUI software in file open dialog try to stat some history files that were used in that software. And also with retries (guess how much, yes 3). So when you turned off your NAS box for example, that was used with smbnetfs previously. And try to save some file in your browser, it tries to stat dozens of files on that NAS. Each file is tried 3 * 3 times with 2 seconds delay between each try (fortunately, GUI software does not add delay, only smbnetfs). So, each file will take 18 seconds. And dozens of such files -- in my case more, than hundred will be 18 seconds * 100 = 30 minutes. That is, the browser will freeze for 30 minutes. It's obvious, that smbnetfs becomes unusable in such cases.
Suggested patch tries to address such problems by minimizing delays in smbnetfs. It will cache negative responses from hosts, and will not pass multiple requests in short periods of time. On each check it cleans cache for items that are older, than 3 seconds. Currently it works only with 2 errors: connection error and connection timeout -- practically that covers all hot spots. The patch have received decent testing with unit test and performance test.
works on it, unfortunatently i have no test environment anymore:-(
you may use a simlink. Frankly speaking i do not see anything wrong here.
This is a specific of libsmbclient library. It search ~/.smb/smb.conf and use system wide smb.conf if user configuration is not found. I saw too many cases where system wide smb.conf was not properly configured or libsmbclient require specific configuration.
you are right. this is a bug. fixed in smbnetfs-0.6.0.
I think, this is gnome keyring initialization that runs before use_gnome_keyring value is checked.