namjaejeon / ksmbd

ksmbd kernel server(SMB/CIFS server)
https://github.com/cifsd-team/ksmbd
273 stars 62 forks source link

ksmbd [read only] : Text files corrupted after saving in Windows7 (NP++, Wordpad, Notepad...) #467

Closed freewalker-panda closed 7 months ago

freewalker-panda commented 9 months ago

Hi! Just installed and configured ksmbd file share. Debian 12.4 , ksmbd-tools 3.4.7-1. Client is Windows7. /etc/ksmbd/ksmbd.conf: [test] ; test share folder
comment = just a test share folder path = /home/user/net_folder writeable = no Created a text file with some text (with file manager on the server in "net_folder"). Client sees the file and can read its data. The problem: if the file is opened for editing (on client side) with notepad++ or Wordpad - the file becomes blank (for both sides client and server) after saving. No errors (like "it is read-only file") occurred. If the file is opened with SublimeText editor - an error (Unable to save , access prohibited) appears. But the file still becomes blank. Please correct me if I'm wrong - if file is read-only - it cannot be altered anyway. But somehow editors corrupt all data from such files.

namjaejeon commented 9 months ago

Okay. Can you tell me kernel version of your Debian 12.4 ? You can command "uname -r".

freewalker-panda commented 9 months ago

Okay. Can you tell me kernel version of your Debian 12.4 ? You can command "uname -r".

It is 6.1.0-16-amd64

namjaejeon commented 9 months ago

writeable = no

You have set read-only share on ksmbd server. Could you elaborate more what is problem ?

namjaejeon commented 9 months ago

Understood. I will try to reproduce it.

freewalker-panda commented 9 months ago

writeable = no

You have set read-only share on ksmbd server. Could you elaborate more what is problem ?

Just fresh install and update of Debian (LXQt enviroment, no another packages). After I have copied ksmbd.conf.example to ksmbd.conf. Added [test] section to that config file. No more actions - just tried if share folder is available over network. It was. After I have created some text files in the shared folder (via file manager on Debian machine). Strange, but files are not visible immediately after creation (on client side). Some times only after reboot of Debian machine. But this is another question. I have tried to edit files (stored and visible in the shared folder) via notepad++ on Windows machine. It was allowed to save edited data without errors. I opened it again - the file was empty. I opened it on Debian machine - still empty ( 0k file size). I have performed at lease 10 separate tries of editing with different editors. But notepad++ always allows to save with no errors and always corrupts the file. I have tried to comment all options in ksmbd.conf file except [test] section - still the same behaviour, files are empty after trying to edit. Please tell me if you need more information. I have a strong wish to find out what is the reason (just spent too much time trying to resolve the problem - to just leave it as is).

namjaejeon commented 9 months ago

Okay, I have fixed it. Can you update your linux kernel ? How will you apply the patch to your kernel ?

freewalker-panda commented 9 months ago

Okay, I have fixed it. Can you update your linux kernel ? How will you apply the patch to your kernel ?

Good question. I have never patched kernels. So if there is no simple and reliable procedure, I cannot guarantee appropriate result. Maybe, it is better for me to wait official kernel update.

namjaejeon commented 9 months ago

I don't know how debian upgrade kernel version. but current version is too old(6.1.0-16-amd64). There are big gap from the latest stable version(6.1.70). Even if I apply it into the latest stable kernel, I don't know when it will be apply into the debian kernel.

You can temporarily use out of tree ksmbd till it is upgraded.

git clone https://github.com/namjaejeon/ksmbd

Thanks for your report!