[Samba] silent data loss with samba and lack of rename() locking
Michael Tokarev
mjt at tls.msk.ru
Tue Mar 19 11:24:49 UTC 2024
Just want to emphasize this particular bug, since it is serious enough,
even if apparently this mode isn't used often.
Having a samba server S, a windows client W and a linux client L,
and two files on S, file1 and file2.
1. On W, mount the share and lock file1
(eg. if it is executable, start it).
2. On L, mount the share and try to remove (rm) file1.
This will hang because the file is locked by W.
Interrupt rm.
3. On L, rename file2 on top of (busy, locked) file1.
This will works just fine.
At this point, we have file2 under name file1.
4. On W, unlock the file
5. Watch the file (which is file2 now) got removed.
So, we tried to remove file1, but in the end we got
BOTH files deleted, losing file2 unexpectedly.
FWIW.
/mjt
More information about the samba
mailing list