[PATCH] Make tdb transaction lock recursive (samba version)

Tim Prouty tprouty at samba.org
Mon Jul 20 18:37:26 MDT 2009

On Jul 20, 2009, at 1:20 PM, Michael Adam wrote:

> Pushed to master - thanks!

I haven't looked at this patch, but running make test from a source3  
merged-build with this patch causes smbd to hang in fcntl for me.  It  
didn't repro for me immediately running the POSIX torture test on its  
own, but the hang goes away when I "git-rebase -i" the patch out of my  
working tree.

Michael, can you take a look at this?

# make test

... doing a bunch of stuff ...

Testing CHAIN1 (0)
Testing POSIX (0)

... hanging ...

# gdb bin/smbd 5188
GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and  
you are
welcome to change it and/or distribute copies of it under certain  
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for  
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
Attaching to program: /mnt/tdev/samba.git.head/source3/bin/smbd,  
process 5188

... loading symbols ...

Loaded symbols for /code/samba.git.head/source3/bin/xattr_tdb.so
0xffffe410 in __kernel_vsyscall ()
(gdb) bt
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x401a9343 in fcntl () from /lib/tls/i686/cmov/libpthread.so.0
#2  0x088a9970 in tdb_brlock (tdb=0x8b070c8, offset=8, rw_type=1,  
lck_type=14, probe=0, len=1) at ../lib/tdb/common/lock.c:67
#3  0x088aa1dd in tdb_transaction_lock (tdb=0x8b070c8, ltype=1) at ../ 
#4  0x088a7651 in tdb_traverse (tdb=0x8b070c8, fn=0x8453cf8  
<db_tdb_traverse_func>, private_data=0xbfea2454) at ../lib/tdb/common/ 
#5  0x08453dcc in db_tdb_traverse (db=0x8b06f10, f=0x8482084  
<conn_traverse_fn>, private_data=0xbfea24bc) at lib/dbwrap_tdb.c:254
#6  0x0848212c in connections_traverse (fn=0x8482084  
<conn_traverse_fn>, private_data=0xbfea24bc) at lib/conn_tdb.c:106
#7  0x08482167 in connections_forall (fn=0x8449b19 <traverse_fn>,  
private_data=0xbfea24ec) at lib/conn_tdb.c:120
#8  0x08449d9a in message_send_all (msg_ctx=0x8b00c78, msg_type=783,  
buf=0x8b14ed0, len=10, n_sent=0x0) at lib/messages.c:175
#9  0x081668ab in send_stat_cache_delete_message (name=0x8b14ed0  
"posix:dir") at smbd/statcache.c:336
#10 0x083d4a1a in set_delete_on_close (fsp=0x8b111c0,  
delete_on_close=true, tok=0x8b14f1c) at locking/locking.c:1446
#11 0x081410b1 in smb_set_file_disposition_info (conn=0x8b0d340,  
pdata=0xbfea268b "\001�R�\b�'��X��\b\230'��\vU 
\024\b�&��@Ӱ\b", total_data=1,
     fsp=0x8b111c0, smb_fname=0x8b168f0) at smbd/trans2.c:5490
#12 0x08144c20 in smb_posix_unlink (conn=0x8b0d340, req=0x8b16800,  
pdata=0x8b05600 "\001", total_data=2, smb_fname=0x8b168f0)
     at smbd/trans2.c:7062
#13 0x0814550b in smbd_do_setfilepathinfo (conn=0x8b0d340,  
req=0x8b16800, mem_ctx=0x8b16800, info_level=522, fsp=0x0,  
     ppdata=0x8b0b360, total_data=2, ret_data_size=0xbfea282c) at smbd/ 
#14 0x08146092 in call_trans2setfilepathinfo (conn=0x8b0d340,  
req=0x8b16800, tran_call=6, pparams=0x8b0b358, total_params=26,  
     total_data=2, max_data_bytes=0) at smbd/trans2.c:7511
#15 0x08147795 in handle_trans2 (conn=0x8b0d340, req=0x8b16800,  
state=0x8b0b320) at smbd/trans2.c:8012
#16 0x081483ff in reply_trans2 (req=0x8b16800) at smbd/trans2.c:8241
#17 0x081793e1 in switch_message (type=50 '2', req=0x8b16800,  
size=100) at smbd/process.c:1363
#18 0x0817953b in construct_reply (inbuf=0x0, size=100,  
unread_bytes=0, seqnum=0, encrypted=false, deferred_pcd=0x0) at smbd/ 
#19 0x0817988f in process_smb (conn=0x8a602e8, inbuf=0x8b16760 "",  
nread=100, unread_bytes=0, seqnum=0, encrypted=false, deferred_pcd=0x0)
     at smbd/process.c:1463
#20 0x0817a506 in smbd_server_connection_read_handler (conn=0x8a602e8)  
at smbd/process.c:1881
#21 0x0817a56d in smbd_server_connection_handler (ev=0x8a60278,  
fde=0x8b0a768, flags=1, private_data=0x8a602e8) at smbd/process.c:1896
#22 0x08486277 in run_events (ev=0x8a60278, selrtn=1,  
read_fds=0xbfea2bb4, write_fds=0xbfea2b34) at lib/events.c:131
#23 0x08178818 in smbd_server_connection_loop_once (conn=0x8a602e8) at  
#24 0x0817b491 in smbd_process () at smbd/process.c:2207
#25 0x08897a9b in smbd_accept_connection (ev=0x8a60278, fde=0x8b15860,  
flags=1, private_data=0x8b156f0) at smbd/server.c:404
#26 0x08486277 in run_events (ev=0x8a60278, selrtn=1,  
read_fds=0xbfea2f44, write_fds=0xbfea2ec4) at lib/events.c:131
#27 0x0848659a in s3_event_loop_once (ev=0x8a60278, location=0x8a47ad2  
"smbd/server.c:692") at lib/events.c:194
#28 0x0848755b in _tevent_loop_once (ev=0x8a60278, location=0x8a47ad2  
"smbd/server.c:692") at ../lib/tevent/tevent.c:488
#29 0x0889874c in smbd_parent_loop (parent=0x8b15578) at smbd/server.c: 
#30 0x08899ef3 in main (argc=7, argv=0xbfea32f4) at smbd/server.c:1269

More information about the samba-technical mailing list