[Samba] locks on ._ files in Mac OS X

Brian Steigauf brian_steigauf at iu13.org
Tue Feb 15 19:39:36 GMT 2005


We have an issue with Mac OS X and Samba that is preventing files 
(specifically Microsoft Excel files) from being saved on a share. We 
have two different servers with different version of Samba that we can 
reproduce the issue. Server A is running Red Hat Enterprise Linux AS 
release 3 kernel 2.4.21 using Samba 3.0.9-1. Server B is Red Hat 7.3 
kernel 2.4.20 with Samba 2.2.7. Clients are variants of Mac OS 10.3, but 
in our testing the clients were both 10.3.8.
The issue can be reproduced consistently by performing the following:
User A opens an Excel file titled "testdocument.xls" on the server. User 
A can work fine, save multiple times, even close the file and reopen it. 
User A closes the file and quits Excel, but stays logged onto the 
server. User B opens "testdocument.xls" and starts to work on it. When 
User B goes to save the file, they get the following error after a 
pause, "Save not complete. File rename failed. Retry?" User B has the 
choice of Cancel or Retry. Pressing Retry puts them in a loop that the 
file cannot be saved. Clicking Cancel give you another message, "Your 
changes could not be saved to 'testdocument.xls', but were saved to a 
temporary document named 'the temp name of the file (an alpha-numeric 
string).' Close the existing document, then open the temporary document 
and save it under a new name." The only option is OK. Clicking OK writes 
a file to the share with the temporary alpha-numeric name and deletes 
the original "testdocument.xls."
The problem can be traced back to the ._testdocument.xls that is created 
with the testdocument.xls when it is copied to a non-HFS volume. If a 
smbstatus is performed on the server to show which files are locked, 
._testdocument.xls shows it is locked by User A, even though the parent 
file is closed. If User A logs off the server, then User B can will not 
have the problem, because the lock on ._testdocument.xls is released.
My questions, is there a way to prevent the creation of the ._ files in 
the first place or why doesn't the client release the files when the 
parent file is closed?
I know the way Excel does saving is slightly strange, in that it creates 
the temp file while the file is being worked on, then deletes the 
original and renames the temp file when a Save happens. I thought that 
may have been part of the problem, yet Word performs the same procedure 
when saving, but does not hold onto the the ._ file when the file is 
closed. I also know that the ._ file is the resource fork that is 
created when a file is copied to a non-HFS volume. Since all the files 
have extensions, the resource forks are not needed.
I believe the problem comes down to how OS X requests locks on the 
server and the creation of the ._ files with regard to saves in Excel. 
I've also seen on Internet searching of others having similar problems 
with other applications and straight file copies to Windows servers and 
Samba servers. 
Any suggestions?

-- 
Brian Steigauf
Systems Administrator
Lancaster Lebanon Intermediate Unit 13
1110 Enterprise Road
East Petersburg, PA 17520
717-560-5445
brian_steigauf at iu13.org




More information about the samba mailing list