-
Notifications
You must be signed in to change notification settings - Fork 64
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
Interrupted transfers when exceeding max simultaneous SMB operations #492
Comments
Looks great work!
Yes. we can use max_credits for max simultaneous requests. and we can move it to server_conf.
As you checked, ksmbd don't count smb2 cancel for req_running. because it doesn't add it to request list. Please check smb2_cacnel function. ksmbd need to find the request using message id of smb2 cancel. If you want to use req_running, we need to add if condition to skip smb2 cancel type when finding a request in smb2 cancel. |
I was thinking we can get away with always updating req_running in The current code doesn't account for a smb2 cancel that is in flight when either |
Right, If we do that as you said, we can use req_running instead of mux_smb_requests. |
Tentative implementation: https://github.com/mmakassikis/ksmbd/tree/private/marios/wip-max-inflight-req Comments & tests welcome |
Totally looks good except missing wake_up event. I have added the comment in your patch. Please update it. I will test it. |
updated |
reconnect1 test in smbtorture failed.
|
I have sent the testcase to your mail. Can you check it? |
I have checked testcases I sent. You need to move atomic_dec to under wait_event_interruptible(). and no need to use XXX_return. use _dec().
So..
Can you test on your side and your testcases(smbclient) also? |
This is correct fix. Please check.
|
I have updated your patch. Please check it. |
Hello,
There is an issue when transferring large files when the "ksmbd: check outstanding simultaneous SMB operations" d0e6ce1
commit is applied and "smb2 max credits" is set to a small value.
My test environment has the following config:
Copying a large file (~25GB) fails and there is the following console log:
[ 5980.324541] ksmbd: Cannot handle request
On the client side I see:
The connection is closed because checking conn->mux_smb_requests returns -ENOSPC in queue_ksmbd_work() and this breaks out of the loop in ksmbd_conn_handler_loop().
I tried handling the error with the following patch:
This doesn't break the connection, but the transfer still fails:
I see the same behaviour using Windows as a client (fails with error 0x8007003b).
I am not sure the "Insufficient credits" message is relevant (or event right).
Without the "check outstanding simultaneous SMB operations" patch, the file transfer completes with no errors.
I tested doing a file copy to a samba server (4.15.13+dfsg-0ubuntu1.6 and 4.20.6-r1 on alpinelinux) with "smb2 max credits = 64" and read/write/trans set as 64K and smbclient succeeded.
I tried the following quick and dirty patch to try to apply backpressure to the client, i.e.: stop reading from the socket until there is room for new smb operations:
This works better (more data is transferred) but it still fails:
Server side ksmbd sees the connection was reset:
The NT_STATUS_IO_TIMEOUT makes me think smbclient starts a timer when it has finished sending a request, so I modified the patch to check mux_smb_requests counter before reading from the socket:
Since
conn->vals
is not initialized in the loop, I hardcoded the max to 64 for testing purposes.With the patch above, smbclient and windows don't fail when transferring a large file.
I'd like to clean this up for inclusion, but there are a few questions:
server_conf
so that userland can override it if necessary. This would solve the problem with the value not being known early inksmbd_conn_handler_loop()
req_running_q
can be used instead. How is mux_smb_requests different from conn->req_running ?Related: why is
conn->req_running
not incremented on SMB Cancel requests ?ksmbd_conn_try_dequeue_request()
always decrementsconn->req_running
The text was updated successfully, but these errors were encountered: