[Samba] file leases and replacing files

Michael Tokarev mjt at tls.msk.ru
Tue Dec 27 09:56:17 UTC 2022


Hi!

What are windows file leases (displayed in smbstatus when
smbd grants one to a client) and how they work?  I bet
there's some documentation about this, but so far I
can't find it.

The problem is that when one replaces or modifies a file on linux
which is "leased" on windows, windows client start acting in a
weird way, for example it can start claiming the file does not
exist anymore when trying to open it, - up to client reboot.
This happens not just with executable files which are run from
the samba shares, but also for regular text files too, sometimes.

I can think that samba does not "notify" windows about the file
change "properly" in this case (I'm not saying it "should" here).

And I also can think that by using smbclient to modify these files
instead of direct open/write/close calls against the filesystem,
this problem can be eliminated, - this way, the modifications is
seen by samba immediately and it can break the leases.

Is there something I can read about that?

Thanks,

/mjt



More information about the samba mailing list