cifsd-team / ksmbd

ksmbd kernel server(SMB/CIFS server)
151 stars 23 forks source link

wrong disk size #577

Closed FireStorma closed 1 year ago

FireStorma commented 1 year ago

Hi

In previous commit the way sector size is handled changed. That causes a weird bug / problem with the right sector size. The size of a hard drive shows double or even more of the acutal size of a mapped hard drive.

The issue with wrong disk size is only visible when the share is mapped to a network drive (e.g. Z) otherwise the right size is shown.

namjaejeon commented 1 year ago

Hi

Can you tell me how to reproduce it ? I can not reproduce it on ksmbd & ext4(local fs) ?

namjaejeon commented 1 year ago

Let me know what local fs is used for share (ext4? zfs?) ?

FireStorma commented 1 year ago

Sorry my fault, using NTFS MBR. And thank you for taking my issue as serious. Beside that, I am not sure if this fits to the topic. However, there is another problem:

Android / Smart TV does not recognize the smb anymore, which makes it very difficult on SMART TV's as simply the smb folder does not show up. Same on Android, but for Android if I use xplorer app it works. However, it used to work with default files manager. And Smart TV there is no work around possible. Nevertheless, I can confirm in past it worked with both, with no problems.

namjaejeon commented 1 year ago

? NTFS MBR ? When I tried to reproduce it on ksmbd & ntfs3 filesytem, I can not reproduce it.

Can you help me reproduce your issue ?

Android / Smart TV does not recognize the smb anymore, which makes it very difficult on SMART TV's as simply the smb folder does not show up. Same on Android, but for Android if I use xplorer app it works. However, it used to work with default files manager. And Smart TV there is no work around possible. Nevertheless, I can confirm in past it worked with both, with no problems

Sorry, Is it ksmbd issue ?

namjaejeon commented 1 year ago

Can I try to reproduce it with network drive in windows client ?

the-j0k3r commented 1 year ago

So this has more detailed information since @FireStorma just omitted entirely, I took it upon myself to try to duplicate in order to gather relevant information much needed to try make some head or tails of these reports.

ksmbd is being used in DD-WRT along with wdds2 and ntf3 in this case, the information below was pulled from the following report downstream at out community forums where we have aggregated several other similar reports from various other users.

https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1269700#1269700

Capture The drive is 500GB HDD NTFS formatted not that it matters.

The below screenshot shows the test samba configuration and included the share Mapped to a Network Drive Y: Capture

Clearly shows a 1.81TB drive, which is a nice way to turn a 500GB drive into more than triple the size ;)

This is a common report across DD-WT after the commit https://github.com/cifsd-team/ksmbd/commit/cca2e29823daf5d4d91c07c43117339865461f7d was merged in (see corresponding commit downstream https://svn.dd-wrt.com/changeset/48606)

Please dont hesitate to ask for any further information I will try to find time to pull it.

and shameless ping to @brainslayer

@FireStorma please try to stick to the topic, your woes with share visibility SmartTV side is offtopic, that is a separate issue unrelated to ksmbd.

namjaejeon commented 1 year ago

@the-j0k3r There are some suspicious code, but this issue can't be reproduced on my windows client, so I can't confirm whether it improves or not even though I make the patch. Are you reproducible? Or can any of the dd-wrt users reproduce the problem?

namjaejeon commented 1 year ago

@the-j0k3r @BrainSlayer When I checked ksmbd source in dd-wrt is different with mainline ksmbd. FS_SIZE_INFORMATION and FS_FULL_SIZE_INFORMATION in smb2pdu.c is different with mainline ksmbd. FS_SIZE_INFORMATION and FS_FULL_SIZE_INFORMATION is related with disk size info. if you make it same with mainline ksmbd, I think that this issue will be clear. Please update ksmbd in dd-wrt.

the-j0k3r commented 1 year ago

Right. thanks for the info, I thought that mostly ksmbd was like for like, but will indeed pass this along and retest.

FireStorma commented 1 year ago

@the-j0k3r Can you tell me where I can report the issue with Android / Smart TV as this is truly a bug that occured as well with an firmware update long time ago.

the-j0k3r commented 1 year ago

@namjaejeon seems the issue is now fixed downstream with the following patch https://svn.dd-wrt.com/changeset/49776

Capture

Indeed that in future we shouldn't report any issues here ksmbd, since the DD-WRT ksmbd is not in sync, perhaps due to backporting issues to kernel 4.x which is a shame. So I have to apologize for this noise it was my fault to begin with ;)

Thank you so much for having us around anyway, feel free to close this.

namjaejeon commented 1 year ago

@the-j0k3r No problem, I am always grateful for the use of ksmbd in the dd-wrt project. As long as I know how to reproduce, I can help with ksmbd issues in dd-wrt.

@BrainSlayer I think this is my mistake. Perhaps you applied the patch I reverted. When ksmbd mainline patches are applied to ksmbd of dd-wrt, if you take the patches when I release the version, we can avoid this problem in the future.

the-j0k3r commented 1 year ago

@the-j0k3r No problem, I am always grateful for the use of ksmbd in the dd-wrt project. As long as I know how to reproduce, I can help with ksmbd issues in dd-wrt.

Thank you, our ksmbd version being quite dissimilar and our kernels not permitting a synced version this makes your offer welcome and interesting.

It would be nicer to get something more up to date but Im not complaining. ;)

take care and thanks again.

BrainSlayer commented 1 year ago

@namjaejeon i used codepieces now from the current version. it seems to have fixed the issue so far. unfortunatly i cannot keep everything up to date right now since you switched to use xarray which is unsupported by older kernels. i havent found yet a way to do a proper backport of it

namjaejeon commented 1 year ago

@the-j0k3r Thanks!

@BrainSlayer Hm.. There is nothing I can do about xarray for now. I recommend upgrading the dd-wrt kernel to 5.4 or higher if possible. The cost of backporting it to support lower versions than 5.4 is too expensive for me. Actually, I also have a lot of work... If it is difficult to upgrade the 5.4 kernel, please exclude that patch... anyway, Thanks for your ksmbd works in dd-wrt. Let me know if there is some issue in ksmbd of dd-wrt. I will help!

BrainSlayer commented 1 year ago

@namjaejeon unfortunaly impossible for alot of devices. the more recent kernels are simply to big and consuming too much ram and flash space. so i have still to maintain the backport version based on your sources.

the-j0k3r commented 1 year ago

@namjaejeon sorry for bothering you, didn't know how to reach you regarding downstream, a minor issue with NTFS causing misbehavior https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1272277

Any patches we could pull in that would help this or any suggestions?

Thanks in advance.

the-j0k3r commented 1 year ago

pong @namjaejeon