0

I've used CentOS 5 and 6 for many years as a web development server. I edit files directly on samba share mounted on a windows 7 (previously windows XP). I'm trying to migrate to CentOS 7 which has Samba 4.8. There is a strange problem when I edit a file on a samba share. I edit the file, save it and then I get a message "The file is modified outside this application". That happens a lot.

I tried "dos filetime resolution = yes". It didn't help, but I guess that's only a solution for really old software, because windows 7 shows odd times.

So I run watch -n 1 stat file.txt and I saved it. The Modify timestamp changed to: 2019-08-10 22:48:19 but few seconds later it changed again to: 019-08-10 22:48:33

So I guess that's the problem. Samba Something comes back and does something to the file which changes modification time. I have no idea what and why but it really messes the editors and makes it hard to work with. I've seen that on cifs mount under linux too when the server is samba 4.

This also happens on my QNAP NAS which runs Samba 4.4.

Any ideas?

Update:

inotifywait -m /home
...... on save:
/home/ OPEN output.txt
/home/ ATTRIB output.txt
/home/ MODIFY output.txt
/home/ CLOSE_NOWRITE,CLOSE,ISDIR
/home/ ATTRIB output.txt
...... about 10-15 seconds after the save:
/home/ CLOSE_NOWRITE,CLOSE output.txt
/home/ CLOSE_WRITE,CLOSE output.txt
/home/ ATTRIB output.txt
NickSoft
  • 278
  • 6
  • 23

1 Answers1

0

I found out that if option oplocks = yes Samba will have the above behavior. So in any normal linux distribution you could set oplocks = no. However I'm not sure how to workaround QNAP overwriting the config file every time I change samba configuration (and maybe on reboot?). So I won't accept this as an answer, but it might help to someone else with the same problem in normal linux distribution.

NickSoft
  • 278
  • 6
  • 23