Samba version 3.0.24-4 on a Fedora Core 5 box. I've been working solidly on this for the last 2 days but don't seem to be getting anywhere. Any and all help would be greatly appreciated. I've found that once a file has been opened, smbstatus shows the file is locked as expected (see below) Locked files: Pid Uid DenyMode Access R/W Oplock SharePath Name Time ---------------------------------------------------------------------------- ---------------------- 20863 670 DENY_NONE 0x2019f RDWR EXCLUSIVE+BATCH /data/home/public New Microsoft Word Document.doc Tue May 1 22:22:36 2007 Then when the file is then closed the lock stays (see below) for approx 20 mins before disappearing Locked files: Pid Uid DenyMode Access R/W Oplock SharePath Name Time ---------------------------------------------------------------------------- ---------------------- 20863 670 DENY_NONE 0x2019f RDWR NONE /data/home/public New Microsoft Word Document.doc Tue May 1 22:22:36 2007 Now if the user opens the file again they get a message that the file is locked for editing by 'another user' and then prompted to open a read-only version of the file. Below is the output of smbstatus showing the file locking. Locked files: Pid Uid DenyMode Access R/W Oplock SharePath Name Time ---------------------------------------------------------------------------- ---------------------- 20863 670 DENY_NONE 0x2019f RDWR NONE /data/home/public New Microsoft Word Document.doc Tue May 1 22:22:36 2007 24344 670 DENY_NONE 0x20089 RDONLY LEVEL_II /data/home/public New Microsoft Word Document.doc Tue May 1 22:23:33 2007 I'm concentrating on this problem in relation to Word and Excel documents however other formats such as pdfs and jpgs are also effected. I've found that extremely short file names (ie 5 or 6 chars) are not being effected by this. I can open these files and the lock appears while the file is open then when the file is closed the lock disappears just as expected. Could filename length have this sort of impact? I've experimented with kernel oplocks, oplocks and level2 oplocks. Various combinations of these settings have not resolved the problem. I've also tried reset on zero vc = yes. This solves the locking problem but corrupts file contents instead. Stopping samba and clearing out the tdb files in /var/cache/samba then restarting also hasn't resolved the problem Below is the global section of the smb.conf file. [global] netbios name = server workgroup = HEADOFFICE server string = Samba Server printcap name = /etc/printcap load printers = yes printing = lprng log file = /var/log/samba/%m.log max log size = 0 security = user encrypt passwords = yes smb passwd file = /etc/samba/smbpasswd unix password sync = Yes passwd program = /usr/bin/passwd %u passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n *passwd:*all*authentication*tokens*updated*successfully* username map = /etc/samba/smbusers socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 local master = yes os level = 64 domain master = yes preferred master = yes logon drive = H: add user script = /usr/sbin/useradd -d /dev/null -g 100 -s /bin/false -M %u wins support = yes dns proxy = no kernel oplocks = no regards, Neil Wright
Jeremy Allison
2007-May-25 22:31 UTC
[Samba] 3.0.24 lock not releasing when file is closed
On Wed, May 02, 2007 at 10:19:23AM +0800, Neil Wright wrote:> Samba version 3.0.24-4 on a Fedora Core 5 box. > > > > I've been working solidly on this for the last 2 days but don't seem to be > getting anywhere. Any and all help would be greatly appreciated. > > > > I've found that once a file has been opened, smbstatus shows the file is > locked as expected (see below) > > > > Locked files: > Pid Uid DenyMode Access R/W Oplock > SharePath Name Time > ---------------------------------------------------------------------------- > ---------------------- > 20863 670 DENY_NONE 0x2019f RDWR EXCLUSIVE+BATCH > /data/home/public New Microsoft Word Document.doc Tue May 1 22:22:36 > 2007 > > > > Then when the file is then closed the lock stays (see below) for approx 20 > mins before disappearing > > > > Locked files: > Pid Uid DenyMode Access R/W Oplock > SharePath Name Time > ---------------------------------------------------------------------------- > ---------------------- > 20863 670 DENY_NONE 0x2019f RDWR NONE > /data/home/public New Microsoft Word Document.doc Tue May 1 22:22:36 > 2007 > > > > Now if the user opens the file again they get a message that the file is > locked for editing by 'another user' and then prompted to open a read-only > version of the file. Below is the output of smbstatus showing the file > locking.If the client redirector is holding the file open even after the app has exited (as they sometimes do), the second open with an oplock break should close it.... Do you have a wireshark/ethereal trace of this ? Jeremy.