Comments (17)
Did some digging but I'm now in over my head:
Error -EINVAL originates here:
static int smb_direct_rdma_xmit(struct smb_direct_transport *t,
void *buf, int buf_len,
struct smb2_buffer_desc_v1 *desc,
unsigned int desc_len,
bool is_read)
{
...
some code
....
for (i = 0; i < desc_len / sizeof(*desc); i++) {
desc_buf_len = le32_to_cpu(desc[i].length);
credits_needed += calc_rw_credits(t, desc_buf, desc_buf_len);
desc_buf += desc_buf_len;
total_length += desc_buf_len;
if (desc_buf_len == 0 || total_length > buf_len ||
total_length > t->max_rdma_rw_size)
{
ksmbd_debug(RDMA, "TEST RDMA %08X %08X %08X %08X", desc_buf_len, total_length, buf_len, t->max_rdma_rw_size);
return -EINVAL;
}
}
Logging is my addition.
Is where it errors, seems total_length > buf_len
triggers the exit. (hex since I do now know the value representation)
ksmbd: smb_direct: TEST RDMA 00020000 00020000 00000400 01000000
from ksmbd.
Thanks for your report! I will try to reproduce it.
from ksmbd.
I tried to understand it a bit and this seems to work. I'm not completely sure it is correct but transfering a large sum of files with many different small filesizes seems to work now, it looks like the read descriptor being set to 128k is the issue: (update to match pr)
diff --git a/smb2pdu.c b/smb2pdu.c
index 591d899..e9749fc 100644
--- a/smb2pdu.c
+++ b/smb2pdu.c
@@ -6792,7 +6792,13 @@ static ssize_t smb2_read_rdma_channel(struct ksmbd_work *work,
size_t length)
{
int err;
+ struct smb2_buffer_desc_v1 *desc;
+ /* set descriptor lenght to nbytes if less than request size */
+ if (length < req->Length) {
+ desc = (struct smb2_buffer_desc_v1 *)((char *)req + le16_to_cpu(req->ReadChannelInfoOffset));
+ desc->length = cpu_to_le32(length);
+ }
err = ksmbd_conn_rdma_write(work->conn, data_buf, length,
(struct smb2_buffer_desc_v1 *)
((char *)req + le16_to_cpu(req->ReadChannelInfoOffset)),
Tested with (all seems to do fine):
#! /bin/bash
for n in {1..1000}; do
dd if=/dev/zero of=file$( printf %03d "$n" ).bin bs=1024 count=$(( 128 + RANDOM / 1024 ))
done
Result master branch:
Result fix I made later (better place to do it):
from ksmbd.
@consp Hm.. I can not reproduce it with windows 10 workstation. In my case, multichannel -> RDMA is changed in the middle of copying while a lot of data is being copied. It seems that Windows cannot transfer such small files with RDMA. How did you get RDMA to transfer even for small files?
from ksmbd.
@consp I have added the patch for this issue? Can you review and verify it(namjaejeon@e255ebe) ?
git clone https://github.com/namjaejeon/ksmbd --branch=rdma
from ksmbd.
@consp ping ?
from ksmbd.
Hi, I have the same issue. I can't clone your branch though, it says it doesn't exist. Did you delete it, or did you merge the fix into the master branch?
from ksmbd.
I don't know if it's related but ksmbd
is also spamming these lines into the kernel log non-stop:
...
[27547.422677] ksmbd: Invalid Buffer Size Requested
[27547.429593] ksmbd: Invalid Buffer Size Requested
[27547.435637] ksmbd: Invalid Buffer Size Requested
...
I'm using Windows 10 and Linux 6.6.0 ksmbd module over RDMA (ConnectX-3)
from ksmbd.
I've tried with the master
branch of https://github.com/namjaejeon/ksmbd, I still get these errors. Copying it from Windows onto Linux/ksmbd worked, but moving or renaming the file still produces "file too large" errors:
from ksmbd.
@nitroxis Can you check the below branch if problem is still happening ?
git clone https://github.com/consp/ksmbd --branch=reduce-descriptor-length
from ksmbd.
@nitroxis ping?
from ksmbd.
Hi, sorry for the late response. I'm unable to compile that branch against kernel 6.6.0 due to various errors:
make -C /lib/modules/6.6.0-arch1-1-custom/build M=/home/nitroxis/src/ksmbd2 modules
make[1]: Entering directory '/usr/lib/modules/6.6.0-arch1-1-custom/build'
CC [M] /home/nitroxis/src/ksmbd2/vfs.o
/home/nitroxis/src/ksmbd2/vfs.c: In function ‘ksmbd_vfs_fill_dentry_attrs’:
/home/nitroxis/src/ksmbd2/vfs.c:3000:33: warning: passing argument 2 of ‘generic_fillattr’ makes integer from pointer without a cast [-Wint-conversion]
3000 | generic_fillattr(idmap, d_inode(dentry), ksmbd_kstat->kstat);
| ^~~~~~~~~~~~~~~
| |
| struct inode *
In file included from /home/nitroxis/src/ksmbd2/vfs.c:8:
./include/linux/fs.h:3016:43: note: expected ‘u32’ {aka ‘unsigned int’} but argument is of type ‘struct inode *’
3016 | void generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *);
| ^~~
/home/nitroxis/src/ksmbd2/vfs.c:3000:61: error: passing argument 3 of ‘generic_fillattr’ from incompatible pointer type [-Werror=incompatible-pointer-types]
3000 | generic_fillattr(idmap, d_inode(dentry), ksmbd_kstat->kstat);
| ~~~~~~~~~~~^~~~~~~
| |
| struct kstat *
./include/linux/fs.h:3016:48: note: expected ‘struct inode *’ but argument is of type ‘struct kstat *’
3016 | void generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *);
| ^~~~~~~~~~~~~~
/home/nitroxis/src/ksmbd2/vfs.c:3000:9: error: too few arguments to function ‘generic_fillattr’
3000 | generic_fillattr(idmap, d_inode(dentry), ksmbd_kstat->kstat);
| ^~~~~~~~~~~~~~~~
./include/linux/fs.h:3016:6: note: declared here
3016 | void generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *);
| ^~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:243: /home/nitroxis/src/ksmbd2/vfs.o] Error 1
make[2]: *** [/usr/lib/modules/6.6.0-arch1-1-custom/build/Makefile:1913: /home/nitroxis/src/ksmbd2] Error 2
make[1]: *** [Makefile:234: __sub-make] Error 2
make[1]: Leaving directory '/usr/lib/modules/6.6.0-arch1-1-custom/build'
make: *** [Makefile:47: all] Error 2
from ksmbd.
Nevermind, I merged with cifsd-team/ksmbd
master, that compiled successfully. However, loading the new module still leads to the same Windows error message as before.
from ksmbd.
I am not sure if it's related to this issue, but opening files with some programs also leads to errors. For example, opening a small 1kB file in HxD
gives me the following error:
Opening text files with VSCode simply shows an empty file. I guess it too encounters an error somewhere, but doesn't propagate it properly in the UI.
Playing a video file with mpv
or opening an image with XnView
on the other hand works fine, so I'm guessing it's only a specific function/request that fails, which is only triggered by some programs but not by others.
This also happens on master
branch, not just the reduce-descriptor-length
branch
from ksmbd.
Now VSCode actually displayed the following error:
from ksmbd.
@nitroxis Can you give me wireshark dump(or tcpdump) on problem situation ? Acutally I didn't reproduce it with windows client before. Once, want to check packets that you will give on your reproduction environment.
from ksmbd.
@nitroxis please give also me debug prints after enabling RDMA log(sudo ksmbd.control -d rdma).
from ksmbd.
Related Issues (20)
- use IPC$ access by host name while host name length are 8 and 9 connection create will fail. the tree connect response compare by the normal miss some part. my config way is guest access HOT 6
- "ksmbd: cli req too short" all over dmesg HOT 18
- btrfs: Directories in subvolumes appear as files on SMB client HOT 3
- UTF-8 characters encoded in 4 bytes not supported in filenames HOT 4
- Kernel warning occurs when deleting uploaded file HOT 23
- SMB Direct with a Windows client HOT 9
- Is there a rpc client to send rpc requests to ksmbd? HOT 2
- ubuntu 22.04 (ksmbd v3.4.2) , mount.cifs is ok, but some simple file io ops are failed? HOT 10
- Please enable some debug kernel options to do test HOT 3
- ksmbd is not configured to SMB-Direct automatically HOT 20
- [SMB_DIRECT] Test ksmbd over rdma, fs/smb/client occors errors 'kernel NULL pointer dereference, address: 00000000000000a8 HOT 2
- Failed to bind socket HOT 13
- ksmbd direct io HOT 2
- RDMA and RSS capabilities always 0 for infiniband interfaces. HOT 4
- RDMA crash HOT 11
- ksmbd: not respecting sticky bit permission on shared directory HOT 2
- files disappear after being copied from macOS HOT 5
- ksmbd does not handle case-insensitive parent directory names correctly HOT 1
- Ksmbd mount error(121): Remote I/O error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ksmbd.