openwrt / packages

Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md
GNU General Public License v2.0
4k stars 3.48k forks source link

samba4: file transfer hangs with default configuration #17832

Open gfrancesco opened 2 years ago

gfrancesco commented 2 years ago

Maintainer: @Andy2244 Environment: ARMv5TE, ZyXEL NSA325-Feroceon 88FR131, OpenWrt SNAPSHOT r18717-0e32c6baf3

Description: Hi, I cannot copy files from/to a share using a freshly installed samba4-server default configuration without modifications in the smb.conf.template file. I can access and list the directories, but copying files hangs and then terminates with an error. Very small files (few kb) seems to transfer after a lot of struggle. I'm on samba4-server v4.14.12-1.

After a bit of trial and error, I maneged to fix the problem by uncommenting these two lines from smb.conf.template:

aio read size = 0
aio write size = 0

But from my understanding, which is probably wrong, uncommenting those parameters would enable sync I/O (aka disable async I/O). That is fine, but I would then expect VFS io_uring to be disabled, which apparently is not, from logread:

Tue Feb  8 17:59:32 2022 daemon.info samba4-server: io_uring module found, enabling VFS io_uring. (also needs Kernel 5.4+ Support)
Tue Feb  8 17:59:33 2022 daemon.err smbd[7857]: [2022/02/08 17:59:33.954086,  0] ../../lib/util/become_daemon.c:135(daemon_ready)
Tue Feb  8 17:59:33 2022 daemon.err smbd[7857]:   daemon_ready: daemon 'smbd' finished starting up and ready to serve connections

Using the working configuration I tested transfers up to ~400 Mbit with ~60% of CPU use (1.6 Ghz I think). I wonder if this is a bug, and if at the end of the day I am using io_uring async I/O or not.

Andy2244 commented 2 years ago

The "io_uring module found, enabling VFS io_uring" is just about finding the module and adding it to the used list automatically. If samba actually uses io_uring may depend on other setting as well, so you would have to debug samba and see if it spits out some errors in this case, since i don't know what actually happens there. Also keep in mind for normal openwrt use cases io_uring will do nothing for you, its mainly usefully for more demanding heavily queued read/write stuff, so don't worry about it too much.

gfrancesco commented 2 years ago

Which other settings are needed for io_uring? I couldn't find any particular setting required for it to work, from the example configuration in here it just seem that listing the module in vfs object is enough. I have definitely some issues with aio read/write size = 1 (or without that setting at all, like in the example above) but couldn't see anything in the logs. Anyway, since performance is good enough for me without async I/O, I'll follow your advice and stop worrying, thanks.