Re: [Samba] Auto-Removal of Straggling File locks due to Ungraceful Client Disconnects
Thanks Volker, Yes, while awaiting a reply, I had already zoned in on the Linux TCP/IP keepalive mechanism and it works perfectly. I ended up using samba's SO_KEEPALIVE socket option but tweaked the OS parameters directly using sysctl.conf (my distro is CentOS 5). The default OS check interval is 2 hours which is far too long for my purposes. I changed this to 5 mins (actually 10 mins in total allowing for retry probes). Now, when the OS disconnects an inactive client, Samba picks up the disconnection and kills the relevant process, releasing any locked files. In the unusual scenario that the disconnected client only had an intermittent problem (e.g. network issue) which eventually fixed itself, the client CIFS stack will simply reconnect under the covers (that's where the samba reset on zero vc option is important). IMHO, this tweak should be part-and-parcel of any self-contained LAN deployment e.g. a Windows-Server replacement in a business network. In summary -- and as I anticipated -- the heart of the matter is the OS stack (with some helpful prodding from Samba). BTW, my allusion to Windows Server not having this problem was incorrect as a further web search showed up -- I want to put the record straight on that one. After a long, sometimes frustrating, journey with Samba over three years, I am hugely impressed with the work you guys have done. Apart from this particular problem/corner case (which is now solved), my CentOS 5 based PDC just runs and runs and runs with minimal maintenance and performance is superb. Regards, Vincent On 6 January 2011 16:55, Volker Lendecke volker.lende...@sernet.de wrote: On Thu, Dec 30, 2010 at 03:36:04AM +, Vincent Callanan wrote: This question has come up many times before in a number of guises. But I do not believe that it has ever been answered satisfactorily. That's because it can't be anwered really satisfactorily given that the CIFS protocol does not allow the server to ping the client if it's still around. All you can do is to apply heuristics. This may well reflect fundamental difficulties in the CIFS protocol However, recent incarnations of Windows Server seem to handle the problem better possibly due to tweaks in the underlying TCP/IP stack vis-a-vis Linux. If you're on moderately recent Linux, you might want to play with something like socket options = SO_KEEPALIVE TCP_KEEPIDLE=300 TCP_KEEPINTVL=10 TCP_KEEPCNT=5 This should kick dead clients after something like 6 minutes. A description of these parameters can be found in man tcp. With best regards, Volker Lendecke -- SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen phone: +49-551-37-0, fax: +49-551-37-9 AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen -- Regards, Vincent Callanan +353-86-8511625 -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/options/samba
Re: [Samba] Auto-Removal of Straggling File locks due to Ungraceful Client Disconnects
On Thu, Dec 30, 2010 at 03:36:04AM +, Vincent Callanan wrote: This question has come up many times before in a number of guises. But I do not believe that it has ever been answered satisfactorily. That's because it can't be anwered really satisfactorily given that the CIFS protocol does not allow the server to ping the client if it's still around. All you can do is to apply heuristics. This may well reflect fundamental difficulties in the CIFS protocol However, recent incarnations of Windows Server seem to handle the problem better possibly due to tweaks in the underlying TCP/IP stack vis-a-vis Linux. If you're on moderately recent Linux, you might want to play with something like socket options = SO_KEEPALIVE TCP_KEEPIDLE=300 TCP_KEEPINTVL=10 TCP_KEEPCNT=5 This should kick dead clients after something like 6 minutes. A description of these parameters can be found in man tcp. With best regards, Volker Lendecke -- SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen phone: +49-551-37-0, fax: +49-551-37-9 AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/options/samba
[Samba] Auto-Removal of Straggling File locks due to Ungraceful Client Disconnects
Hi all, This question has come up many times before in a number of guises. But I do not believe that it has ever been answered satisfactorily. This may well reflect fundamental difficulties in the CIFS protocol However, recent incarnations of Windows Server seem to handle the problem better possibly due to tweaks in the underlying TCP/IP stack vis-a-vis Linux. At the end of the day, a centralised/shared file system should be immune to client misbehaviour. While file corruption by a misbehaving client with write access is always a possibility. Surely it is reasonable that a file should not be left locked indefinitely by a client that has long since departed the scene. Suggested solutions usually revolve around: 1. Client configuration tweaks. 2. Samba's Reset on Zero VC option in smb.conf. My response to these is that: 1. A server should not have to depend on well-behaving clients to maintain basic file system integrity. 2. Reset on Zero VC only helps in the case where the disconnected client actually reconnects. But what if a client suddenly disconnects due to a crash, power outage or careless disconnect? What if the client stays disconnected indefinitely e.g. laptop has been whipped out and gone off site? In these situations, a server administrator needs to be on standby. And straggling locks can be removed manually by: 1. Identifying them using the smbstatus utility 2. Killing the relevant server process. But this can become extremely tedious in busy ad hoc networks with mobile users So can someone please advise me why it is not possible for Samba to: 1. Identify obvious long term client disconnects e.g. by polling every five minutes. 2. Automatically remove any locks still held by such clients. Hope I am making some sense here and haven't missed something obvious. TIA rvjcallanan -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/options/samba