I have a Windows Server 2016 server with a file share that clients have write permissions to. Sometimes clients disconnect while the client has file locks that are not released.
Here is a view using 'openfiles.exe' of the share with the file.txt locked.
openfiles.exe //Query //s servername //v
servername 56784213 user Windows 0 Read D:\share\subfolder
servername 95678421 [Disconnected] Windows 0 Write + Read D:\share\subfolder\a\file.txt
The problem is when this client comes back online (same system, same IP address) and it tries to read or write file.txt, it gets a permission denied error.
I have seen similar issues reported on Samba, How to prevent samba from holding a file lock after a client disconnects?. Also, on old Windows Server versions (I used to run Server 2008 many years ago), this was not a problem.
I would like to know how to control what Windows does when the same client disconnects with file locks open and then re-connects. I would like it to kill previous connections from the same client/same IP.