Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Accessing folder with many subfolders (NTFS) #391

Open
hegabo opened this issue Jan 19, 2022 · 26 comments
Open

Issue with Accessing folder with many subfolders (NTFS) #391

hegabo opened this issue Jan 19, 2022 · 26 comments

Comments

@hegabo
Copy link

hegabo commented Jan 19, 2022

NTFS USB HDD connected and mounted properly; I can see the contents of the hard disk on the mounted location. Though for the samba clients, I have the following:

Windows 11: If SMB1 is enabled on Windows I have access to all folders except for the one with many subfolders which gives the memory error. If SMB1 is disabled, I can't access the router at all from Windows.
Android: Can access all folders from x File Explorer.
Coreelec (minimal Linux-based OS for TV Box): the share mounts, but even while setting SMB client minimum version to 2, the folder with too many subfolders shows up empty. Other folders open with no problem.
@mmakassikis
Copy link

Please share your smb.conf.

What is the memory error ? Is that on the server side or client side ?
Share the full log.

On Linux, you shouldn't need to specify a version (it will pick smb3.1.1 dialect automatically)

What's the error when trying to connect with Windows 11 (SMB1 disabled) ?

Are you using authenticated or guest access ?

@hegabo
Copy link
Author

hegabo commented Jan 19, 2022

`[global]
netbios name = C7
server string = Ksmbd on OpenWrt
workgroup = WORKGROUP
interfaces = br-lan
bind interfaces only = yes
ipc timeout = 20
deadtime = 15
map to guest = Bad User
smb2 max read = 1024K
smb2 max write = 1024K
smb2 max trans = 1024K
cache read buffers = no
cache trans buffers = no

######### Dynamic written config options #########

[TV]
path = /mnt/TV
valid users = m
create mask = 0666
directory mask = 0777
read only = no
guest ok = no

[MV]
path = /mnt/MV
valid users = m
create mask = 0666
directory mask = 0777
read only = no
guest ok = no
`

Error is:
"Not enough memory resources are available to process this command"

On Windows 11, I can't even access the router. It can't find the host. Like as if I'm typing incorrect IP.

I'm using authenticated access.

@mmakassikis
Copy link

Remove these:

smb2 max read = 1024K
smb2 max write = 1024K
smb2 max trans = 1024K
cache read buffers = no
cache trans buffers = no

then restart ksmbd and retest.

For the windows issue, enable debug on the server, by running the following command as root:
echo all > /sys/class/ksmbd-control/debug

This will make ksmbd log messages, which you can retrieve by dmesg or through the syslog daemon.

Then try to connect, and paste the debug log.
Make sure there are not other clients when you do this.

@hegabo
Copy link
Author

hegabo commented Jan 20, 2022

Thanks for the prompt reply.

I removed the lines, restarted (actually restarted the whole router), and still the same. On the Linux Box, I don't see the folder empty, as well as if I check it from WinSCP. (though I created a subfolder in that folder as mounted as a Samba share on the Linux Box, didn't see it of course, but then when I looked at the mounted folder on the router, the folder was actually created).

I got the following error though when trying to open the problematic folder from the Linux machine
kern.err kernel: [ 1705.006499] ksmbd: smb2_query_dir:3727: error while processing smb2 query dir rc = -12

And below is some of the log related to ksmbd, in case any of it is useful. I got nothing when trying ot access the fodler form the Windows Machine by ther way

Thu Jan 20 01:47:32 2022 kern.info kernel: [  651.875455] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Thu Jan 20 01:47:32 2022 kern.info kernel: [  651.882246] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:47:32 2022 kern.info kernel: [  651.888456] ksmbd: smb2_calc_size:248: SMB2 len 68
Thu Jan 20 01:47:32 2022 kern.info kernel: [  651.893326] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[441]
Thu Jan 20 01:47:34 2022 kern.info kernel: [  653.923479] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Thu Jan 20 01:47:34 2022 kern.info kernel: [  653.930277] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:47:34 2022 kern.info kernel: [  653.936482] ksmbd: smb2_calc_size:248: SMB2 len 68
Thu Jan 20 01:47:34 2022 kern.info kernel: [  653.941349] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[66]
Thu Jan 20 01:48:33 2022 kern.info kernel: [  713.315546] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Thu Jan 20 01:48:33 2022 kern.info kernel: [  713.322330] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:48:33 2022 kern.info kernel: [  713.328543] ksmbd: smb2_calc_size:248: SMB2 len 68
Thu Jan 20 01:48:33 2022 kern.info kernel: [  713.333411] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[441]
Thu Jan 20 01:48:35 2022 kern.info kernel: [  715.363558] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Thu Jan 20 01:48:35 2022 kern.info kernel: [  715.370345] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:48:35 2022 kern.info kernel: [  715.376556] ksmbd: smb2_calc_size:248: SMB2 len 68
Thu Jan 20 01:48:35 2022 kern.info kernel: [  715.381427] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[66]
Thu Jan 20 01:49:35 2022 kern.info kernel: [  774.755754] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Thu Jan 20 01:49:35 2022 kern.info kernel: [  774.762543] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:49:35 2022 kern.info kernel: [  774.768756] ksmbd: smb2_calc_size:248: SMB2 len 68
Thu Jan 20 01:49:35 2022 kern.info kernel: [  774.773627] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[441]
Thu Jan 20 01:49:37 2022 kern.info kernel: [  776.803851] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Thu Jan 20 01:49:37 2022 kern.info kernel: [  776.810791] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:49:37 2022 kern.info kernel: [  776.817133] ksmbd: smb2_calc_size:248: SMB2 len 68
Thu Jan 20 01:49:37 2022 kern.info kernel: [  776.822016] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[66]
Thu Jan 20 01:50:36 2022 kern.info kernel: [  836.195787] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Thu Jan 20 01:50:36 2022 kern.info kernel: [  836.202582] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:50:36 2022 kern.info kernel: [  836.208788] ksmbd: smb2_calc_size:248: SMB2 len 68
Thu Jan 20 01:50:36 2022 kern.info kernel: [  836.213658] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[441]
Thu Jan 20 01:50:38 2022 kern.info kernel: [  838.243742] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Thu Jan 20 01:50:38 2022 kern.info kernel: [  838.250531] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:50:38 2022 kern.info kernel: [  838.256741] ksmbd: smb2_calc_size:248: SMB2 len 68
Thu Jan 20 01:50:38 2022 kern.info kernel: [  838.261611] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[66]
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.069176] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 128 bytes
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.076475] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.082739] ksmbd: smb2_calc_size:231: SMB2 data length 0 offset 120
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.089196] ksmbd: smb2_calc_size:248: SMB2 len 121
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.094156] ksmbd: smb2_open:2330: share path len 7
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.099153] ksmbd: smb_check_perm_dacl:1126: check permission using windows acl
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.106604] ksmbd: ksmbd_vfs_get_dos_attrib_xattr:1675: failed to load dos attribute in xattr
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.115267] ksmbd: smb2_set_rsp_credits:378: credits: requested[2] granted[2] total_granted[442]
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.125397] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 128 bytes
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.132575] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 105 bytes
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.139681] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.145910] ksmbd: smb2_calc_size:231: SMB2 data length 0 offset 120
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.152370] ksmbd: smb2_calc_size:248: SMB2 len 121
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.157329] ksmbd: smb2_open:2330: share path len 7
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.162321] ksmbd: smb_check_perm_dacl:1126: check permission using windows acl
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.169950] ksmbd: ksmbd_vfs_get_dos_attrib_xattr:1675: failed to load dos attribute in xattr
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.178619] ksmbd: smb2_set_rsp_credits:378: credits: requested[2] granted[2] total_granted[67]
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.190316] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.196532] ksmbd: smb2_calc_size:231: SMB2 data length 0 offset 104
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.202982] ksmbd: smb2_calc_size:248: SMB2 len 105
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.207937] ksmbd: smb2_query_info:4899: GOT query info request
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.213945] ksmbd: smb2_query_info:4903: GOT SMB2_O_INFO_FILE
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.219787] ksmbd: get_file_all_info:4141: filename = \
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.225104] ksmbd: smb2_set_rsp_credits:378: credits: requested[2] granted[2] total_granted[443]
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.234235] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 105 bytes
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.241902] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 88 bytes
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.250823] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.257034] ksmbd: smb2_calc_size:231: SMB2 data length 0 offset 104
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.263482] ksmbd: smb2_calc_size:248: SMB2 len 105
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.268437] ksmbd: smb2_query_info:4899: GOT query info request
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.274445] ksmbd: smb2_query_info:4903: GOT SMB2_O_INFO_FILE
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.280295] ksmbd: get_file_all_info:4141: filename = \
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.285614] ksmbd: smb2_set_rsp_credits:378: credits: requested[2] granted[2] total_granted[68]
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.295539] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.301909] ksmbd: smb2_calc_size:248: SMB2 len 88
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.306798] ksmbd: smb2_close:5034: volatile_id = 38
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.311852] ksmbd: smb2_set_rsp_credits:378: credits: requested[2] granted[2] total_granted[444]
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.320923] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 88 bytes
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.328034] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.334258] ksmbd: smb2_calc_size:248: SMB2 len 88
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.339130] ksmbd: smb2_close:5034: volatile_id = 16
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.344436] ksmbd: smb2_set_rsp_credits:378: credits: requested[2] granted[2] total_granted[69]
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.353743] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.360696] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.366917] ksmbd: smb2_calc_size:248: SMB2 len 68
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.371786] ksmbd: smb2_tree_disconnect:1835: request
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.376949] ksmbd: smb2_set_rsp_credits:378: credits: requested[2] granted[2] total_granted[445]
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.386955] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.393741] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.400799] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.407140] ksmbd: smb2_calc_size:248: SMB2 len 68
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.412026] ksmbd: smb2_tree_disconnect:1835: request
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.417195] ksmbd: smb2_set_rsp_credits:378: credits: requested[2] granted[2] total_granted[70]
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.427131] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.434078] ksmbd: smb2_get_ksmbd_tcon:103: skip to check tree connect request
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.441423] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.447709] ksmbd: smb2_calc_size:248: SMB2 len 68
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.452587] ksmbd: smb2_session_logoff:1866: request
Thu Jan 20 01:50:57 2022 kern.info kernel: [  857.457660] ksmbd: smb2_set_rsp_credits:378: credits: requested[2] granted[2] total_granted[446]
Thu Jan 20 01:50:58 2022 kern.info kernel: [  857.467315] ksmbd: smb2_get_ksmbd_tcon:103: skip to check tree connect request
Thu Jan 20 01:50:58 2022 kern.info kernel: [  857.474694] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Thu Jan 20 01:50:58 2022 kern.info kernel: [  857.480888] ksmbd: smb2_calc_size:248: SMB2 len 68
Thu Jan 20 01:50:58 2022 kern.info kernel: [  857.485752] ksmbd: smb2_session_logoff:1866: request
Thu Jan 20 01:50:58 2022 kern.info kernel: [  857.490826] ksmbd: smb2_set_rsp_credits:378: credits: requested[2] granted[2] total_granted[71]
Thu Jan 20 01:50:58 2022 kern.info kernel: [  858.082917] Atheros AR8216/AR8236/AR8316 mdio.0:00: Port 4 is down
Thu Jan 20 01:53:26 2022 kern.info kernel: [ 1006.083627] ksmbd: ksmbd_conn_alive:269: No response from client in 15 minutes
Thu Jan 20 01:53:26 2022 kern.info kernel: [ 1006.339630] ksmbd: ksmbd_conn_alive:269: No response from client in 15 minutes
Thu Jan 20 01:53:49 2022 authpriv.info dropbear[2738]: Exit (root) from <192.168.0.100:50826>: Exited normally
Thu Jan 20 02:03:04 2022 kern.info kernel: [ 1584.090523] Atheros AR8216/AR8236/AR8316 mdio.0:00: Port 4 is up
Thu Jan 20 02:03:14 2022 kern.info kernel: [ 1594.330827] Atheros AR8216/AR8236/AR8316 mdio.0:00: Port 4 is down
Thu Jan 20 02:03:16 2022 kern.info kernel: [ 1596.378512] Atheros AR8216/AR8236/AR8316 mdio.0:00: Port 4 is up
Thu Jan 20 02:03:24 2022 kern.err kernel: [ 1604.212999] ksmbd: smb2_query_dir:3727: error while processing smb2 query dir rc = -12
Thu Jan 20 02:05:05 2022 kern.err kernel: [ 1705.006499] ksmbd: smb2_query_dir:3727: error while processing smb2 query dir rc = -12

@namjaejeon
Copy link
Owner

Isn't 1MB read/write size too large for your HW (RAM)? As far as I know, I remember that the openWRT mainline was set to 64KB. please try it after changing 1024K to 64K.

smb2 max read = 1024K
smb2 max write = 1024K
smb2 max trans = 1024K

@hegabo
Copy link
Author

hegabo commented Jan 20, 2022

The issue was there with the original settings. That's why I put the 1024K in the first place.

Anyway, I put 64K and got the same error.

Router is Archer C7, has 57 MiB available right now.

@namjaejeon
Copy link
Owner

namjaejeon commented Jan 20, 2022

Okay, Can I think that windows 10 is not a problem and it is only a problem with windows 11 ? And can it be said that only NTFS is the problem and there is no problem with ext4 or other FS? I'd like to narrow the problem down a bit.

@namjaejeon
Copy link
Owner

ksmbd: smb2_query_dir:3727: error while processing smb2 query dir rc = -12

-12 errno is -ENOMEM, i.e. this error is returned when memory is lacked.

@mmakassikis
Copy link

@hegabo
What version of ksmbd are you using ?
Can you test with the latest code from master (both ksmbd & ksmbd-tools) and add this configuration in smb.conf ?

smb2 max credits = 256

@hegabo
Copy link
Author

hegabo commented Jan 24, 2022

Can I think that windows 10 is not a problem and it is only a problem with windows 11

I tried from a different laptop, running Windows 10. It shows the shares when I browse the IP of the router (unlike Windows 11 which gives me an error message that the host doesn't exist).

However, in Windows 10, if I try to open one of the shares (I have 2 drives) it asks for credentials. I provide them but it gives me an error message as if the credentials are incorrect.

I disabled SMB1 on Windows 10 and still the same.

Nothing in system log about that.

@hegabo
Copy link
Author

hegabo commented Jan 25, 2022

What version of ksmbd are you using ?

Both ksmbd-server and -utils are 3.4.2-1.

smb2 max credits = 256
I get the following from Windows 11

Tue Jan 25 02:03:47 2022 kern.info kernel: [ 3846.686180] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Tue Jan 25 02:03:47 2022 kern.info kernel: [ 3846.693038] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Tue Jan 25 02:03:47 2022 kern.info kernel: [ 3846.699997] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Tue Jan 25 02:03:47 2022 kern.info kernel: [ 3846.706219] ksmbd: smb2_calc_size:248: SMB2 len 68
Tue Jan 25 02:03:47 2022 kern.info kernel: [ 3846.711088] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[3]
Tue Jan 25 02:03:47 2022 kern.info kernel: [ 3846.720234] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Tue Jan 25 02:03:47 2022 kern.info kernel: [ 3846.726552] ksmbd: smb2_calc_size:248: SMB2 len 68
Tue Jan 25 02:03:47 2022 kern.info kernel: [ 3846.731585] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[3]

And in Windows 10 now (SMB1 disabled) I see the following (and nothing on Windows 10 machine---takes forever and doesn't browse the IP

Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.465973] ksmbd: ksmbd_kthread_fn:270: connect success: accepted new connection
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.478556] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 244 bytes
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.485423] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.491631] ksmbd: smb2_get_data_area_len:171: no length check for command
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.498618] ksmbd: smb2_calc_size:231: SMB2 data length 0 offset 0
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.504889] ksmbd: smb2_calc_size:248: SMB2 len 100
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.509846] ksmbd: ksmbd_smb2_check_message:413: cli req padded more than expected. Length 244 not 100 for cmd:0 mid:0
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.520768] ksmbd: ksmbd_lookup_dialect_by_id:245: client requested dialect 0x311
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.528379] ksmbd: ksmbd_lookup_dialect_by_id:252: selected �SMB 3.1.1 dialect
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.535707] ksmbd: ksmbd_smb_negotiate_common:473: conn->dialect 0x311
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.542332] ksmbd: smb2_handle_negotiate:1014: Received negotiate request
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.549224] ksmbd: deassemble_neg_contexts:949: negotiate context count = 5
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.556290] ksmbd: deassemble_neg_contexts:954: deassemble SMB2_PREAUTH_INTEGRITY_CAPABILITIES context
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.565732] ksmbd: deassemble_neg_contexts:963: deassemble SMB2_ENCRYPTION_CAPABILITIES context
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.574558] ksmbd: deassemble_neg_contexts:972: deassemble SMB2_COMPRESSION_CAPABILITIES context
Tue Jan 25 02:07:46 2022 kern.info kernel: [ 4085.583471] ksmbd: deassemble_neg_contexts:981: deassemble SMB2_NETNAME_NEGOTIATE_CONTEXT_ID context
Tue Jan 25 02:07:50 2022 kern.info kernel: [ 4089.342576] Atheros AR8216/AR8236/AR8316 mdio.0:00: Port 2 is down
Tue Jan 25 02:07:53 2022 kern.info kernel: [ 4092.414288] Atheros AR8216/AR8236/AR8316 mdio.0:00: Port 2 is up
Tue Jan 25 02:07:53 2022 kern.info kernel: [ 4092.441640] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Tue Jan 25 02:07:53 2022 kern.info kernel: [ 4092.448562] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Tue Jan 25 02:07:53 2022 kern.info kernel: [ 4092.455520] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Tue Jan 25 02:07:53 2022 kern.info kernel: [ 4092.461742] ksmbd: smb2_calc_size:248: SMB2 len 68
Tue Jan 25 02:07:53 2022 kern.info kernel: [ 4092.466612] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[3]
Tue Jan 25 02:07:53 2022 kern.info kernel: [ 4092.492529] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Tue Jan 25 02:07:53 2022 kern.info kernel: [ 4092.498733] ksmbd: smb2_calc_size:248: SMB2 len 68
Tue Jan 25 02:07:53 2022 kern.info kernel: [ 4092.503754] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[3]
Tue Jan 25 02:08:06 2022 kern.info kernel: [ 4105.726443] Atheros AR8216/AR8236/AR8316 mdio.0:00: Port 2 is down
Tue Jan 25 02:08:55 2022 kern.info kernel: [ 4153.878822] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Tue Jan 25 02:08:55 2022 kern.info kernel: [ 4153.885614] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Tue Jan 25 02:08:55 2022 kern.info kernel: [ 4153.892579] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Tue Jan 25 02:08:55 2022 kern.info kernel: [ 4153.898800] ksmbd: smb2_calc_size:248: SMB2 len 68
Tue Jan 25 02:08:55 2022 kern.info kernel: [ 4153.903676] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[3]
Tue Jan 25 02:08:55 2022 kern.info kernel: [ 4153.929844] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Tue Jan 25 02:08:55 2022 kern.info kernel: [ 4153.936043] ksmbd: smb2_calc_size:248: SMB2 len 68
Tue Jan 25 02:08:55 2022 kern.info kernel: [ 4153.940925] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[3]
Tue Jan 25 02:09:56 2022 kern.info kernel: [ 4215.315392] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Tue Jan 25 02:09:56 2022 kern.info kernel: [ 4215.322325] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Tue Jan 25 02:09:56 2022 kern.info kernel: [ 4215.329287] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Tue Jan 25 02:09:56 2022 kern.info kernel: [ 4215.335504] ksmbd: smb2_calc_size:248: SMB2 len 68
Tue Jan 25 02:09:56 2022 kern.info kernel: [ 4215.340371] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[3]
Tue Jan 25 02:09:56 2022 kern.info kernel: [ 4215.366235] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Tue Jan 25 02:09:56 2022 kern.info kernel: [ 4215.372432] ksmbd: smb2_calc_size:248: SMB2 len 68
Tue Jan 25 02:09:56 2022 kern.info kernel: [ 4215.377312] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[3]
Tue Jan 25 02:10:58 2022 kern.info kernel: [ 4276.759047] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Tue Jan 25 02:10:58 2022 kern.info kernel: [ 4276.765999] ksmbd: ksmbd_conn_handler_loop:310: RFC1002 header 68 bytes
Tue Jan 25 02:10:58 2022 kern.info kernel: [ 4276.772965] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Tue Jan 25 02:10:58 2022 kern.info kernel: [ 4276.779186] ksmbd: smb2_calc_size:248: SMB2 len 68
Tue Jan 25 02:10:58 2022 kern.info kernel: [ 4276.784056] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[3]
Tue Jan 25 02:10:58 2022 kern.info kernel: [ 4276.809976] ksmbd: ksmbd_verify_smb_message:149: got SMB2 command
Tue Jan 25 02:10:58 2022 kern.info kernel: [ 4276.816176] ksmbd: smb2_calc_size:248: SMB2 len 68
Tue Jan 25 02:10:58 2022 kern.info kernel: [ 4276.821057] ksmbd: smb2_set_rsp_credits:378: credits: requested[1] granted[1] total_granted[3]

@namjaejeon
Copy link
Owner

namjaejeon commented Jan 25, 2022

@hegabo Can you give me tcpdump(or wireshark dump) on problem situation ? and don't set mb2 max credits = 256

@hegabo
Copy link
Author

hegabo commented Jan 25, 2022

@namjaejeon THanks. Sent by email.

@hegabo
Copy link
Author

hegabo commented Feb 10, 2022

@namjaejeon, @mmakassikis Any update? Thanks.

@mmakassikis
Copy link

@hegabo
Can you test with latest code from master branch (both ksmbd & ksmbd-tools must be compiled) ?

How many subfolders do you have in the share ?

For NTFS access, are you using ntfs-3g ?

@hegabo
Copy link
Author

hegabo commented Feb 18, 2022

I am on Windows and never tried compiling packages before. I could try though. Do you expect this to solve the subfolders issue or accessing the share ofrm Windows 11?

The subfolders were about 1550 (not counting their recursive subfolders). It's probably wroth mentioning that this issue seems to be particular to SMB 1.0 (somehow), as I don't see this problem now if I try to access that folder from Android. The current problem I have now is with accessing the share itself from Windows 11.

I'm using kmod-fs-antfs. (but I think I initially tried ntfs-3g).

@mmakassikis
Copy link

You're describing multiple issues:

  • accessing a share from Windows 11
  • listing share contents when it is backed by a NTFS fs
  • SMB1 access

These may be related, and some may have already been fixed.

Windows defaults to SMB1 disabled: why are you saying the issue is related to SMB1 ?
Did you enable SMB1 on Windows ?
Did you enable SMB1 support on ksmbd ?

Can you try without SMB1 (disable it on Windows, and set server min protocol = SMB3_11 in ksmbd.conf) ?

Do you have this issue only on Windows 11 ? Do you have any other client to test from (windows 10, linux, smartphone app, etc) ?

@hegabo
Copy link
Author

hegabo commented Feb 18, 2022

I tried different things, including trying enabling SMB1 on both server and Windows client, so can't be 100% sure of correlation, but the conclusion that makes sense is as follows:

  • With SMB1 enabled on the server, the folder with too many subfolders doesn't open. I observed that on both Windows and Android Clients.
  • With SMB1 disabled, Android reads everything (I use Cx File Explorer), while Windows 11 doesn't open the server at all.

@mmakassikis
Copy link

Clients will try to negotiate a protocol version. This can happen with either a SMB2 negotiate command, or a SMB1 negotiate, that can result in a SMB1 connection, or can be upgraded to an SMB2 connection.

There is a bug that was fixed in 5354422 that results in a failed negotiation. I'm not sure if the bug was there in 3.4.2. It would be great if you could test with the latest code. It's possible you're seeing a bug that was already fixed (or there is a bug with Windows 11 clients).

@hegabo
Copy link
Author

hegabo commented Feb 18, 2022

Thanks. I figured as much, but I'm not interested in solving the issue with SMB1 and too-many-subfolders because it's an outdated, insecure protocol.

So I think the main issue is with accessing the share from Windows 11.

I will try to compile the packages, if not then I will just wait for the new release.

Thanks

@hegabo
Copy link
Author

hegabo commented Feb 19, 2022

I tried different things, including trying enabling SMB1 on both server and Windows client, so can't be 100% sure of correlation, but the conclusion that makes sense is as follows:

  • With SMB1 enabled on the server, the folder with too many subfolders doesn't open. I observed that on both Windows and Android Clients.
  • With SMB1 disabled, Android reads everything (I use Cx File Explorer), while Windows 11 doesn't open the server at all.

@hegabo
Copy link
Author

hegabo commented Feb 19, 2022

OK I did some more trials and came up to the following conclusion (I think):

With /etc/ksmbd/smb.con:

[global]
	netbios name = C7
	server string = Ksmbd on OpenWrt
	workgroup = WORKGROUP
	interfaces = br-lan 
	bind interfaces only = yes
	ipc timeout = 20
	deadtime = 15
	map to guest = Bad User
	server min protocol = SMB3_11

######### Dynamic written config options #########

[MV]
	path = /mnt/MV
	valid users = sam
	create mask = 0666
	directory mask = 0777
	read only = no
	guest ok = no

With guest disabled, Windows 11 doesn't open the server at all, Windows 10 Opens the server, asks for credentials when I open the share but rejects them, even though they are correct.

If I allow guest access on the shares, Windows 10 can access the share but not that large folder (the one with too many subfolders Windows 11 still doesn't open the server at all.

Cx File Explorer on Android opens the server, sees the share and opens the large folder.

@namjaejeon
Copy link
Owner

namjaejeon commented Feb 20, 2022

@hegabo Okay. I don't have windows 11 client yet. It is hard to reproduce it right now.
So I would like to fix the issue from windows 10 client first.

Windows 10 Opens the server, asks for credentials when I open the share but rejects them, even though they are correct.

What is meaning "guest disabled" ? How do you turn guest on/off in smb.conf ?
And Can you tell me your user account string ?

@hegabo
Copy link
Author

hegabo commented Feb 21, 2022

I don't have windows 11 client yet.
OK, thanks. FYI, I think you can download and install Windows 11 from Microsoft with no license. At least this was the case with Windows 10.

What is meaning "guest disabled"
I mean unticking "Aloow guest" for the individual shares in LuCI.

And Can you tell me your user account string ?

Not sure what do you mean.

@mmakassikis
Copy link

@hegabo
In your config, you have this:

valid users = sam

Which means there's another file which contains something like this:

sam:0yopAQERdjSbQdQG3MlakA==

Can you share the contents of that file ? In ksmbd docs it's smbpwd.db -- not sure what OpenWRT calls it.

@hegabo
Copy link
Author

hegabo commented Feb 22, 2022

ksmbdpwd.db
sam:9a8+IN7HvNQhyP5sZ+GCwg==

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants