[Samba] Lock order violation and file lost

Thomas Schulz schulz at adi.com
Thu Apr 24 09:52:26 MDT 2014


I will probably file a bug about this, but perhaps someone here will
have some ideas.

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.

If the user now tries to exit Excel the user is again prompted to save
the file. If he now clicks on Don't Save than as far as he can tell the
file is lost. If he clicks on Save to try again to save the file, the
file will be saved correctly and will show up as:

-rwxrwxr--+  1 user2    users    2611248 Apr 23 14:02 glorp.xlsx

But the '~$glorp.xlsx' and 'F790B97D.tmp' files remain in the directory.
Unfortunately after having had one failure to save the file, the users
usually click on Don't Save the second time and the file is gone.

The system log file now shows the following:

Apr 23 13:58:39 bream smbd[29505]: [2014/04/23 13:58:39.412682,  0] ../lib/dbwrap/dbwrap.c:193(dbwrap_check_lock_order)
Apr 23 13:58:39 bream smbd[29505]:   Lock order violation: Trying /opt/local/samba4/var/lock/smbXsrv_open_global.tdb at 1 while /opt/local/samba4/var/lock/locking.tdb at 1 is locked
Apr 23 13:58:39 bream smbd[29505]: [2014/04/23 13:58:39.413837,  0] ../lib/dbwrap/dbwrap.c:133(debug_lock_order)
Apr 23 13:58:39 bream smbd[29505]:   lock order:  1:/opt/local/samba4/var/lock/locking.tdb 2:<none> 3:<none>
Apr 23 13:58:39 bream smbd[29505]: [2014/04/23 13:58:39.414353,  0] ../source3/lib/util.c:785(smb_panic_s3)
Apr 23 13:58:39 bream smbd[29505]:   PANIC (pid 29505): invalid lock_order
Apr 23 13:58:39 bream smbd[29505]: [2014/04/23 13:58:39.417636,  0] ../source3/lib/util.c:896(log_stack_trace)
Apr 23 13:58:39 bream smbd[29505]:   BACKTRACE: 35 stack frames:
Apr 23 13:58:39 bream smbd[29505]:    #0 /opt/local/samba4/lib/libsmbconf.so.0(log_stack_trace+0x2b) [0x6de8dd]
Apr 23 13:58:39 bream smbd[29505]:    #1 /opt/local/samba4/lib/libsmbconf.so.0(smb_panic_s3+0x87) [0x6de730]
Apr 23 13:58:39 bream smbd[29505]:    #2 /opt/local/samba4/lib/libsamba-util.so.0(smb_panic+0x2a) [0x1613c6]
Apr 23 13:58:39 bream smbd[29505]:    #3 /opt/local/samba4/lib/private/libdbwrap.so [0xfa7d2c]
Apr 23 13:58:39 bream smbd[29505]:    #4 /opt/local/samba4/lib/private/libdbwrap.so [0xfa7e5e]
Apr 23 13:58:39 bream smbd[29505]:    #5 /opt/local/samba4/lib/private/libdbwrap.so(dbwrap_fetch_locked+0x2f) [0xfa7f5e]
Apr 23 13:58:39 bream smbd[29505]:    #6 /opt/local/samba4/lib/private/libsmbd_base.so [0x2fb932]
Apr 23 13:58:39 bream smbd[29505]:    #7 /opt/local/samba4/lib/private/libsmbd_base.so(smbXsrv_open_create+0x145) [0x2fc742]
Apr 23 13:58:39 bream smbd[29505]:    #8 /opt/local/samba4/lib/private/libsmbd_base.so(file_new+0xcd) [0x2121c7]
Apr 23 13:58:39 bream smbd[29505]:    #9 /opt/local/samba4/lib/private/libsmbd_base.so [0x28ebc9]
Apr 23 13:58:39 bream smbd[29505]:    #10 /opt/local/samba4/lib/private/libsmbd_base.so(create_file_default+0x32b) [0x28f885]
Apr 23 13:58:39 bream smbd[29505]:    #11 /opt/local/samba4/lib/private/libsmbd_base.so [0x3bd5d9]
Apr 23 13:58:39 bream smbd[29505]:    #12 /opt/local/samba4/lib/private/libsmbd_base.so(smb_vfs_call_create_file+0xba) [0x29b3c9]
Apr 23 13:58:39 bream smbd[29505]:    #13 /opt/local/samba4/lib/private/libsmbd_base.so(open_file_fchmod+0xbd) [0x28bf7f]
Apr 23 13:58:39 bream smbd[29505]:    #14 /opt/local/samba4/lib/private/libsmbd_base.so(file_set_dosmode+0x647) [0x281294]
Apr 23 13:58:39 bream smbd[29505]:    #15 /opt/local/samba4/lib/private/libsmbd_base.so(rename_internals_fsp+0xa25) [0x254943]
Apr 23 13:58:39 bream smbd[29505]:    #16 /opt/local/samba4/lib/private/libsmbd_base.so(rename_internals+0x575) [0x25509b]
Apr 23 13:58:39 bream smbd[29505]:    #17 /opt/local/samba4/lib/private/libsmbd_base.so(reply_mv+0x558) [0x255efb]
Apr 23 13:58:39 bream smbd[29505]:    #18 /opt/local/samba4/lib/private/libsmbd_base.so [0x2b0806]
Apr 23 13:58:39 bream smbd[29505]:    #19 /opt/local/samba4/lib/private/libsmbd_base.so [0x2b0984]
Apr 23 13:58:39 bream smbd[29505]:    #20 /opt/local/samba4/lib/private/libsmbd_base.so [0x2b1996]
Apr 23 13:58:39 bream smbd[29505]:    #21 /opt/local/samba4/lib/private/libsmbd_base.so [0x2b2b6d]
Apr 23 13:58:39 bream smbd[29505]:    #22 /opt/local/samba4/lib/private/libsmbd_base.so [0x2b2bdd]
Apr 23 13:58:39 bream smbd[29505]:    #23 /opt/local/samba4/lib/libsmbconf.so.0(run_events_poll+0x487) [0x6fb4d6]
Apr 23 13:58:39 bream smbd[29505]:    #24 /opt/local/samba4/lib/libsmbconf.so.0 [0x6fb7ba]
Apr 23 13:58:39 bream smbd[29505]:    #25 /opt/local/samba4/lib/private/libtevent.so.0(_tevent_loop_once+0xf5) [0x4c6394]
Apr 23 13:58:39 bream smbd[29505]:    #26 /opt/local/samba4/lib/private/libsmbd_base.so(smbd_process+0x1480) [0x2b6360]
Apr 23 13:58:39 bream smbd[29505]:    #27 /opt/local/samba4/sbin/smbd [0xb7fee6d7]
Apr 23 13:58:39 bream smbd[29505]:    #28 /opt/local/samba4/lib/libsmbconf.so.0(run_events_poll+0x487) [0x6fb4d6]
Apr 23 13:58:39 bream smbd[29505]:    #29 /opt/local/samba4/lib/libsmbconf.so.0 [0x6fb7ba]
Apr 23 13:58:39 bream smbd[29505]:    #30 /opt/local/samba4/lib/private/libtevent.so.0(_tevent_loop_once+0xf5) [0x4c6394]
Apr 23 13:58:39 bream smbd[29505]:    #31 /opt/local/samba4/sbin/smbd [0xb7fef41c]
Apr 23 13:58:39 bream smbd[29505]:    #32 /opt/local/samba4/sbin/smbd(main+0x1857) [0xb7ff0ddf]
Apr 23 13:58:39 bream smbd[29505]:    #33 /lib/libc.so.6(__libc_start_main+0xe6) [0xcc35d6]
Apr 23 13:58:39 bream smbd[29505]:    #34 /opt/local/samba4/sbin/smbd [0xb7fe9e21]
Apr 23 13:58:39 bream smbd[29505]: [2014/04/23 13:58:39.426906,  0] ../source3/lib/dumpcore.c:317(dump_core)
Apr 23 13:58:39 bream smbd[29505]:   dumping core in /opt/local/samba4/var/logs/bream.adi.com/cores/smbd
Apr 23 13:58:39 bream smbd[29505]: 

Tom Schulz
Applied Dynamics Intl.
schulz at adi.com


More information about the samba mailing list