[Samba] Lock order violation and file lost

Thomas Schulz schulz at adi.com
Fri Apr 25 12:10:23 MDT 2014


> On Thu, Apr 24, 2014 at 11:52:26AM -0400, Thomas Schulz wrote:
> > I will probably file a bug about this, but perhaps someone here will
> > have some ideas.

Bug 10564 filed.

> > We have a problem with files being deleted instead of being saved when
> > making changes in Microsoft Excel. The log shows an error of:
> > 'Lock order violation'. This is with Samba 4.1.6 and happens on both
> > Linux (2.6.25-14.fc9.i686) and Solaris 10. No such problem when running
> > Samba 3.6.22.
> > 
> > We have a setup where we need to allow any user to edit an excel file.
> > To allow this we have an ACL set on the directory and on the file to force
> > wirte permission for group. The problem only occurs when the user doing
> > the editing is not the current owneer of the file. Before the attempt to
> > edit the file we have the file (as seen on Linux or Solaris):
> > 
> > -rwxrwxr--+  1 user1    users    2611248 Apr 23 14:02 glorp.xlsx*
> > 
> > The directory and the file have the following ACLs.
> > # file: .
> > # owner: root
> > # group: users
> > user::rwx
> > group::rwx              #effective:rwx
> > group:users:rwx         #effective:rwx
> > mask:rwx
> > other:r-x
> > default:user::rwx
> > default:group::rwx
> > default:group:users:rwx
> > default:mask:rwx
> > default:other:r-x
> > 
> > # file: glorp.xlsx
> > # owner: user1
> > # group: users
> > user::rwx
> > user:user1:rwx          #effective:rwx
> > group::rwx              #effective:rwx
> > group:users:rwx         #effective:rwx
> > mask:rwx
> > other:r--
> > 
> > After making changes and trying to save the file, a pop up box says
> > 'file not saved'. At this point the file is gone but we have the following
> > files in the directroy.
> > 
> > -rwxrwxr--+  1 user1    users    2596791 Apr 23 13:39 F790B97D.tmp
> > -rwxrwxr--+  1 user2    users        165 Apr 23 14:01 ~$glorp.xlsx
> > 
> > The F790B97D.tmp looks to be the original file without the changes.
> 
> What is in your smb.conf ? Are you storing DOS
> attributes in extended EA's ?
> 
> As far as I can see in the code the offending
> open_file_fchmod() can only get called if
> 'store dos attributes = no' (i.e. smbd is
> trying to store DOS attrs in the filesystem
> mode bits, not an EA).
> 
> Jeremy.

This is now open in Bug 10564. But for the benefit of anyone reading this:

According to the man page for smb.conf, 'store dos attributes' defaults
to no. I do not have that set in my smb.conf. Here is what is in my
smb.conf file and the file that it includes:

[global]
max protocol = NT1
   workgroup = adi
   server string =
   security = domain
   load printers = yes
   printcap name = /etc/printers.samba
   printing = sysv
  guest account = nobody2
   log file = /opt/local/samba4/var/logs/%h/log.%m
   max log size = 150
   password server = starfish2
   passdb backend = tdbsam
   socket options = TCP_NODELAY 
   dns proxy = no 
dos filemode = yes
delete readonly = yes
name resolve order = bcast host
host msdfs = yes
msdfs root = yes
unix extensions = no
wide links = yes
include = /opt/local/samba4/etc/smb.conf.%h

******* The included file ************

[homes]
   comment = Home Directories
   browseable = no
   writable = yes
   inherit permissions = yes

[foom]
   comment = Foom Project Directories
   path = /home/foom
   browseable = yes
   writable = yes
   inherit permissions = yes

Tom Schulz
Applied Dynamics Intl.
schulz at adi.com


More information about the samba mailing list