<feed xmlns='http://www.w3.org/2005/Atom'>
<title>samba.git/source3/locking/locking.c, branch talloc-2.4.4</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/'/>
<entry>
<title>smbd: Fix whitespace</title>
<updated>2025-06-14T08:46:33+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2025-06-07T09:05:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=39ab4a25c26b8a82a28fe1d4755f875a40f2e365'/>
<id>39ab4a25c26b8a82a28fe1d4755f875a40f2e365</id>
<content type='text'>
Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Martin Schwenke &lt;martin@meltin.net&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Martin Schwenke &lt;martin@meltin.net&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>s3/locking: remove now unused private_options from share_mode_entry</title>
<updated>2025-04-09T13:40:36+00:00</updated>
<author>
<name>Ralph Boehme</name>
<email>slow@samba.org</email>
</author>
<published>2025-03-17T11:44:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=1f79af0377be801e6570d2cf87b109a6fa4c69c6'/>
<id>1f79af0377be801e6570d2cf87b109a6fa4c69c6</id>
<content type='text'>
Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Volker Lendecke &lt;vl@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Volker Lendecke &lt;vl@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>s3/locking: store NTCREATEX_FLAG_STREAM_BASEOPEN as share_entry_flag</title>
<updated>2025-04-09T13:40:36+00:00</updated>
<author>
<name>Ralph Boehme</name>
<email>slow@samba.org</email>
</author>
<published>2025-03-17T13:56:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=638a4c2bbb27265bebdaca3b28f494ed5a65d8a3'/>
<id>638a4c2bbb27265bebdaca3b28f494ed5a65d8a3</id>
<content type='text'>
No change in behaviour.

Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Volker Lendecke &lt;vl@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No change in behaviour.

Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Volker Lendecke &lt;vl@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>smbd: use share_mode_do_locked_brl() in strict_lock_check_default()</title>
<updated>2025-04-02T18:05:48+00:00</updated>
<author>
<name>Ralph Boehme</name>
<email>slow@samba.org</email>
</author>
<published>2025-01-30T06:40:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=56bb20c87a733ab8f7efedd881ea0ecaf51b2ba8'/>
<id>56bb20c87a733ab8f7efedd881ea0ecaf51b2ba8</id>
<content type='text'>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15767

Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Stefan Metzmacher &lt;metze@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15767

Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Stefan Metzmacher &lt;metze@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>smbd: check can_lock in strict_lock_check_default()</title>
<updated>2025-04-02T18:05:48+00:00</updated>
<author>
<name>Ralph Boehme</name>
<email>slow@samba.org</email>
</author>
<published>2025-04-02T10:43:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=678f28c1af7c160ffdcb0e4baa0a7d4b9906f2e5'/>
<id>678f28c1af7c160ffdcb0e4baa0a7d4b9906f2e5</id>
<content type='text'>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15767

Pair-Programmed-With: Stefan Metzmacher &lt;metze@samba.org&gt;
Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15767

Pair-Programmed-With: Stefan Metzmacher &lt;metze@samba.org&gt;
Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>s3/locking: prepare brl_locktest() for upgradable read-only locks</title>
<updated>2025-04-02T18:05:48+00:00</updated>
<author>
<name>Ralph Boehme</name>
<email>slow@samba.org</email>
</author>
<published>2025-01-30T16:35:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=8f9387ceb5c94c7db92ab342e33c64b858c301b1'/>
<id>8f9387ceb5c94c7db92ab342e33c64b858c301b1</id>
<content type='text'>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15767

Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Stefan Metzmacher &lt;metze@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15767

Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Stefan Metzmacher &lt;metze@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>smbd: use share_mode_do_locked_brl()</title>
<updated>2025-04-02T18:05:48+00:00</updated>
<author>
<name>Ralph Boehme</name>
<email>slow@samba.org</email>
</author>
<published>2025-01-29T05:13:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=2eef298ff4c5baf15c7d29c65fb021dbed5b0a93'/>
<id>2eef298ff4c5baf15c7d29c65fb021dbed5b0a93</id>
<content type='text'>
Fix a deadlock that can happen if two clients happen to open and byte-range-lock
two different files whos record in locking.tdb and brlock.tdb happen to sit on
the same hashchain.

The deadlock was introduced by commit
680c7907325b433856ac1dd916ab63e671fbe4ab. Before, we used share_mode_do_locked()
in do_lock() which meant we acquired a chainlock on locking.tdb before getting a
chainlock on brlock.tdb via brl_get_locks_for_locking(), so the TDB chainlock
order invariant was always uphold.

The following race between specific client requests lead to the deadlock.

Client A) issues a byte-range-lock request on a file:

A1) glock locking.tdb (via _share_mode_do_locked_vfs_allowed())
A2) chainlock brlock.tdb (via brl_lock())
A3) attempt to chainlock locking.tdb (via share_mode_g_lock_dump())
[1]

Client B) opens a different (!) file:

B1) glock and chainlock locking.tdb (via _share_mode_entry_prepare_lock())
B2) attempt to chainlock brlock.tdb (via file_has_brlocks())
[2]

The glock from A1 is per record and hence doesn't synchronize with the glock
from B1 as it is for a different file and hence a different record, subsequently
A2 and A3 violate the lock order constraint

To avoid the chainlock lock order violation in the second client we modify the
br-lock code to not take the brlock.tdb chainlock from step A2 via
br_get_locks() for the whole time we process the request. Instead we just fetch
the br-locks via br_get_locks_readonly(), so when running into
contend_level2_oplocks_begin_default() to check for leases and looking into
locking.tdb we don't hold a brlock.tdb chainlock.

Or im simpler terms, we only ever take at most one low-level TDB chainlock at a
time:

Byte-range-lock code calls share_mode_do_locked_brl(..., cb_fn, ...):
1) chainlock locking.tdb
2) glock locking.tdb (via share_mode_do_locked_vfs_allowed())
3) chainunlock locking.tdb
4) share_mode_do_locked_brl_fn() -&gt; brl_get_locks_readonly_parse():
   a) chainlock brlock.tdb
   b) parse record and store in-memory copy
   c) chainunlock brlock.tdb
5) run cb_fn()
6) chainlock brlock.tdb:
   a) br_lck-&gt;record = dbwrap_fetch_locked(brlock_db, ...)
   b) store modifed br_lck from 5) via byte_range_lock_flush()
7) chainunlock brlock.tdb
8) chainlock locking.tdb
9) gunlock locking.tdb
10) chainunlock locking.tdb

All access to brlock.tdb is synchronized correctly via glocks on the locking.tdb
record of the file (step 3)), so operations still appear atomic to clients.

As a result of using share_mode_do_locked_brl(), the functions do_[un]lock() -&gt;
brl_[un]lock() now loop over the same br_lck object in memory, avoiding
repeatedly fetching and storing the locks per loop.

[1]
Full SBT:

  #0  0x00007fffa0cecbb0 in __pthread_mutex_lock_full () from /lib64/glibc-hwcaps/power9/libpthread-2.28.so
  #1  0x00007fffa0a73cf8 in chain_mutex_lock (m=&lt;optimized out&gt;, m@entry=0x7fff9ae071b0, waitflag=&lt;optimized out&gt;, waitflag@entry=true) at ../../lib/tdb/common/mutex.c:182
  #2  0x00007fffa0a7432c in tdb_mutex_lock (tdb=0x1543ba120, rw=&lt;optimized out&gt;, off=&lt;optimized out&gt;, len=&lt;optimized out&gt;, waitflag=&lt;optimized out&gt;, pret=0x7fffd7df3858) at ../../lib/tdb/common/mutex.c:234
  #3  0x00007fffa0a6812c in fcntl_lock (waitflag=&lt;optimized out&gt;, len=1, off=376608, rw=0, tdb=0x1543ba120) at ../../lib/tdb/common/lock.c:200
  #4  tdb_brlock (tdb=0x1543ba120, rw_type=&lt;optimized out&gt;, offset=&lt;optimized out&gt;, len=1, flags=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:200
  #5  0x00007fffa0a68af8 in tdb_nest_lock (flags=&lt;optimized out&gt;, ltype=0, offset=&lt;optimized out&gt;, tdb=0x1543ba120) at ../../lib/tdb/common/lock.c:390
  #6  tdb_nest_lock (tdb=0x1543ba120, offset=&lt;optimized out&gt;, ltype=&lt;optimized out&gt;, flags=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:336
  #7  0x00007fffa0a69088 in tdb_lock_list (tdb=0x1543ba120, list=&lt;optimized out&gt;, ltype=&lt;optimized out&gt;, waitflag=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:482
  #8  0x00007fffa0a69198 in tdb_lock (tdb=0x1543ba120, list=&lt;optimized out&gt;, ltype=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:500
  #9  0x00007fffa0a64b50 in tdb_find_lock_hash (tdb=&lt;optimized out&gt;, tdb@entry=0x1543ba120, key=..., hash=&lt;optimized out&gt;, locktype=&lt;optimized out&gt;, locktype@entry=0, rec=&lt;optimized out&gt;, rec@entry=0x7fffd7df3ab0) at ../../lib/tdb/common/tdb.c:165
  #10 0x00007fffa0a64ed0 in tdb_parse_record (tdb=0x1543ba120, key=..., parser=0x7fffa0e74470 &lt;db_ctdb_ltdb_parser&gt;, private_data=0x7fffd7df3b18) at ../../lib/tdb/common/tdb.c:329
  #11 0x00007fffa0e74cbc in db_ctdb_ltdb_parse (db=&lt;optimized out&gt;, private_data=0x7fffd7df3b70, parser=0x7fffa0e76470 &lt;db_ctdb_parse_record_parser_nonpersistent&gt;, key=...) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:170
  #12 db_ctdb_try_parse_local_record (ctx=ctx@entry=0x1543d4580, key=..., state=state@entry=0x7fffd7df3b70) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:1385
  #13 0x00007fffa0e76024 in db_ctdb_parse_record (db=&lt;optimized out&gt;, key=..., parser=0x7fffa1313910 &lt;dbwrap_watched_parse_record_parser&gt;, private_data=0x7fffd7df3c08) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:1425
  #14 0x00007fffa0884760 in dbwrap_parse_record (db=&lt;optimized out&gt;, key=..., parser=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../lib/dbwrap/dbwrap.c:454
  #15 0x00007fffa1313ab4 in dbwrap_watched_parse_record (db=0x1543a7160, key=..., parser=0x7fffa13187d0 &lt;g_lock_dump_fn&gt;, private_data=0x7fffd7df3ce8) at ../../source3/lib/dbwrap/dbwrap_watch.c:783
  #16 0x00007fffa0884760 in dbwrap_parse_record (db=&lt;optimized out&gt;, key=..., parser=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../lib/dbwrap/dbwrap.c:454
  #17 0x00007fffa131c004 in g_lock_dump (ctx=&lt;error reading variable: value has been optimized out&gt;, key=..., fn=0x7fffa14f3d70 &lt;fsp_update_share_mode_flags_fn&gt;, private_data=0x7fffd7df3dd8) at ../../source3/lib/g_lock.c:1653
  #18 0x00007fffa14f434c in share_mode_g_lock_dump (key=..., fn=0x7fffa14f3d70 &lt;fsp_update_share_mode_flags_fn&gt;, private_data=0x7fffd7df3dd8) at ../../source3/locking/share_mode_lock.c:96
  #19 0x00007fffa14f8d44 in fsp_update_share_mode_flags (fsp=0x15433c550) at ../../source3/locking/share_mode_lock.c:1181
  #20 file_has_read_lease (fsp=0x15433c550) at ../../source3/locking/share_mode_lock.c:1207
  #21 0x00007fffa15ccc98 in contend_level2_oplocks_begin_default (type=&lt;optimized out&gt;, fsp=0x15433c550) at ../../source3/smbd/smb2_oplock.c:1282
  #22 smbd_contend_level2_oplocks_begin (fsp=0x15433c550, type=&lt;optimized out&gt;) at ../../source3/smbd/smb2_oplock.c:1338
  #23 0x00007fffa0dd0b54 in contend_level2_oplocks_begin (fsp=&lt;optimized out&gt;, type=&lt;optimized out&gt;) at ../../source3/lib/smbd_shim.c:72
  #24 0x00007fffa14ecfd0 in brl_lock_windows_default (br_lck=0x154421330, plock=0x7fffd7df4250) at ../../source3/locking/brlock.c:457
  #25 0x00007fffa150b70c in vfswrap_brl_lock_windows (handle=&lt;optimized out&gt;, br_lck=&lt;optimized out&gt;, plock=&lt;optimized out&gt;) at ../../source3/modules/vfs_default.c:3424
  #26 0x00007fffa1561910 in smb_vfs_call_brl_lock_windows (handle=&lt;optimized out&gt;, br_lck=&lt;optimized out&gt;, plock=&lt;optimized out&gt;) at ../../source3/smbd/vfs.c:2686
  #27 0x00007fff9c0a7350 in smb_time_audit_brl_lock_windows (handle=&lt;optimized out&gt;, br_lck=0x154421330, plock=0x7fffd7df4250) at ../../source3/modules/vfs_time_audit.c:1740
  #28 0x00007fffa1561910 in smb_vfs_call_brl_lock_windows (handle=&lt;optimized out&gt;, br_lck=&lt;optimized out&gt;, plock=&lt;optimized out&gt;) at ../../source3/smbd/vfs.c:2686
  #29 0x00007fffa14ed410 in brl_lock (br_lck=0x154421330, smblctx=3102281601, pid=..., start=0, size=18446744073709551615, lock_type=&lt;optimized out&gt;, lock_flav=WINDOWS_LOCK, blocker_pid=0x7fffd7df4540, psmblctx=0x7fffd7df4558) at ../../source3/locking/brlock.c:1004
  #30 0x00007fffa14e7b18 in do_lock_fn (lck=&lt;optimized out&gt;, private_data=0x7fffd7df4508) at ../../source3/locking/locking.c:271
  #31 0x00007fffa14fcd94 in _share_mode_do_locked_vfs_allowed (id=..., fn=0x7fffa14e7a60 &lt;do_lock_fn&gt;, private_data=0x7fffd7df4508, location=&lt;optimized out&gt;) at ../../source3/locking/share_mode_lock.c:2927
  #32 0x00007fffa14e918c in do_lock (fsp=0x15433c550, req_mem_ctx=&lt;optimized out&gt;, req_guid=&lt;optimized out&gt;, smblctx=&lt;optimized out&gt;, count=18446744073709551615, offset=0, lock_type=&lt;optimized out&gt;, lock_flav=&lt;optimized out&gt;, pblocker_pid=0x7fffd7df46f0,
      psmblctx=0x7fffd7df46d8) at ../../source3/locking/locking.c:335
  #33 0x00007fffa155381c in smbd_do_locks_try (fsp=0x15433c550, num_locks=&lt;optimized out&gt;, locks=0x1543bc310, blocker_idx=0x7fffd7df46d6, blocking_pid=0x7fffd7df46f0, blocking_smblctx=0x7fffd7df46d8) at ../../source3/smbd/blocking.c:46
  #34 0x00007fffa159dc90 in smbd_smb2_lock_try (req=req@entry=0x1543bc080) at ../../source3/smbd/smb2_lock.c:590
  #35 0x00007fffa159ee8c in smbd_smb2_lock_send (in_locks=&lt;optimized out&gt;, in_lock_count=1, in_lock_sequence=&lt;optimized out&gt;, fsp=0x15433c550, smb2req=0x1543532e0, ev=0x154328120, mem_ctx=0x1543532e0) at ../../source3/smbd/smb2_lock.c:488
  #36 smbd_smb2_request_process_lock (req=0x1543532e0) at ../../source3/smbd/smb2_lock.c:150
  #37 0x00007fffa158a368 in smbd_smb2_request_dispatch (req=0x1543532e0) at ../../source3/smbd/smb2_server.c:3515
  #38 0x00007fffa158c540 in smbd_smb2_io_handler (fde_flags=&lt;optimized out&gt;, xconn=0x154313f30) at ../../source3/smbd/smb2_server.c:5112
  #39 smbd_smb2_connection_handler (ev=&lt;optimized out&gt;, fde=&lt;optimized out&gt;, flags=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../source3/smbd/smb2_server.c:5150
  #40 0x00007fffa1198b2c in tevent_common_invoke_fd_handler (fde=0x1543670f0, flags=&lt;optimized out&gt;, removed=0x0) at ../../lib/tevent/tevent_fd.c:158
  #41 0x00007fffa11a2b9c in epoll_event_loop (tvalp=0x7fffd7df4b28, epoll_ev=0x1543b4e80) at ../../lib/tevent/tevent_epoll.c:730
  #42 epoll_event_loop_once (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent_epoll.c:946
  #43 0x00007fffa11a0090 in std_event_loop_once (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent_standard.c:110
  #44 0x00007fffa119744c in _tevent_loop_once (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent.c:823
  #45 0x00007fffa1197884 in tevent_common_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:950
  #46 0x00007fffa119ffc0 in std_event_loop_wait (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent_standard.c:141
  #47 0x00007fffa1197978 in _tevent_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:971
  #48 0x00007fffa15737fc in smbd_process (ev_ctx=0x154328120, msg_ctx=&lt;optimized out&gt;, sock_fd=&lt;optimized out&gt;, interactive=&lt;optimized out&gt;) at ../../source3/smbd/smb2_process.c:2158
  #49 0x000000011db5c554 in smbd_accept_connection (ev=0x154328120, fde=&lt;optimized out&gt;, flags=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../source3/smbd/server.c:1150
  #50 0x00007fffa1198b2c in tevent_common_invoke_fd_handler (fde=0x1543ac2d0, flags=&lt;optimized out&gt;, removed=0x0) at ../../lib/tevent/tevent_fd.c:158
  #51 0x00007fffa11a2b9c in epoll_event_loop (tvalp=0x7fffd7df4f98, epoll_ev=0x154328350) at ../../lib/tevent/tevent_epoll.c:730
  #52 epoll_event_loop_once (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent_epoll.c:946
  #53 0x00007fffa11a0090 in std_event_loop_once (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent_standard.c:110
  #54 0x00007fffa119744c in _tevent_loop_once (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent.c:823
  #55 0x00007fffa1197884 in tevent_common_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:950
  #56 0x00007fffa119ffc0 in std_event_loop_wait (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent_standard.c:141
  #57 0x00007fffa1197978 in _tevent_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:971
  #58 0x000000011db58c54 in smbd_parent_loop (parent=&lt;optimized out&gt;, ev_ctx=0x154328120) at ../../source3/smbd/server.c:1499
  #59 main (argc=&lt;optimized out&gt;, argv=&lt;optimized out&gt;) at ../../source3/smbd/server.c:2258

[2]
Full SBT:

  #0  0x00007fffa0cecbb0 in __pthread_mutex_lock_full () from /lib64/glibc-hwcaps/power9/libpthread-2.28.so
  #1  0x00007fffa0a73cf8 in chain_mutex_lock (m=&lt;optimized out&gt;, m@entry=0x7fff9b3a71b0, waitflag=&lt;optimized out&gt;, waitflag@entry=true) at ../../lib/tdb/common/mutex.c:182
  #2  0x00007fffa0a7432c in tdb_mutex_lock (tdb=0x1543c6900, rw=&lt;optimized out&gt;, off=&lt;optimized out&gt;, len=&lt;optimized out&gt;, waitflag=&lt;optimized out&gt;, pret=0x7fffd7df2e28) at ../../lib/tdb/common/mutex.c:234
  #3  0x00007fffa0a6812c in fcntl_lock (waitflag=&lt;optimized out&gt;, len=1, off=376608, rw=0, tdb=0x1543c6900) at ../../lib/tdb/common/lock.c:200
  #4  tdb_brlock (tdb=0x1543c6900, rw_type=&lt;optimized out&gt;, offset=&lt;optimized out&gt;, len=1, flags=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:200
  #5  0x00007fffa0a68af8 in tdb_nest_lock (flags=&lt;optimized out&gt;, ltype=0, offset=&lt;optimized out&gt;, tdb=0x1543c6900) at ../../lib/tdb/common/lock.c:390
  #6  tdb_nest_lock (tdb=0x1543c6900, offset=&lt;optimized out&gt;, ltype=&lt;optimized out&gt;, flags=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:336
  #7  0x00007fffa0a69088 in tdb_lock_list (tdb=0x1543c6900, list=&lt;optimized out&gt;, ltype=&lt;optimized out&gt;, waitflag=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:482
  #8  0x00007fffa0a69198 in tdb_lock (tdb=0x1543c6900, list=&lt;optimized out&gt;, ltype=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:500
  #9  0x00007fffa0a64b50 in tdb_find_lock_hash (tdb=&lt;optimized out&gt;, tdb@entry=0x1543c6900, key=..., hash=&lt;optimized out&gt;, locktype=&lt;optimized out&gt;, locktype@entry=0, rec=&lt;optimized out&gt;, rec@entry=0x7fffd7df3080) at ../../lib/tdb/common/tdb.c:165
  #10 0x00007fffa0a64ed0 in tdb_parse_record (tdb=0x1543c6900, key=..., parser=0x7fffa0e74470 &lt;db_ctdb_ltdb_parser&gt;, private_data=0x7fffd7df30e8) at ../../lib/tdb/common/tdb.c:329
  #11 0x00007fffa0e74cbc in db_ctdb_ltdb_parse (db=&lt;optimized out&gt;, private_data=0x7fffd7df3140, parser=0x7fffa0e76470 &lt;db_ctdb_parse_record_parser_nonpersistent&gt;, key=...) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:170
  #12 db_ctdb_try_parse_local_record (ctx=ctx@entry=0x154328fc0, key=..., state=state@entry=0x7fffd7df3140) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:1385
  #13 0x00007fffa0e76024 in db_ctdb_parse_record (db=&lt;optimized out&gt;, key=..., parser=0x7fffa14ec820 &lt;brl_get_locks_readonly_parser&gt;, private_data=0x7fffd7df3218) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:1425
  #14 0x00007fffa0884760 in dbwrap_parse_record (db=&lt;optimized out&gt;, key=..., parser=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../lib/dbwrap/dbwrap.c:454
  #15 0x00007fffa14ef5bc in brl_get_locks_readonly (fsp=0x1543d01e0) at ../../source3/locking/brlock.c:1884
  #16 0x00007fffa1546968 in file_has_brlocks (fsp=0x1543d01e0) at ../../source3/smbd/open.c:2232
  #17 delay_for_oplock (pgranted=&lt;synthetic pointer&gt;, poplock_type=&lt;synthetic pointer&gt;, first_open_attempt=&lt;optimized out&gt;, create_disposition=1, have_sharing_violation=false, lck=0x7fffd7df3ce8, lease=0x0, oplock_request=0, fsp=0x1543d01e0) at ../../source3/smbd/open.c:2749
  #18 handle_share_mode_lease (pgranted=&lt;synthetic pointer&gt;, poplock_type=&lt;synthetic pointer&gt;, first_open_attempt=&lt;optimized out&gt;, lease=0x0, oplock_request=0, share_access=7, access_mask=131201, create_disposition=1, lck=0x7fffd7df3ce8, fsp=0x1543d01e0) at ../../source3/smbd/open.c:2865
  #19 check_and_store_share_mode (first_open_attempt=&lt;optimized out&gt;, lease=0x0, oplock_request=0, share_access=7, access_mask=131201, create_disposition=1, lck=0x7fffd7df3ce8, req=0x154414800, fsp=0x1543d01e0) at ../../source3/smbd/open.c:3333
  #20 open_ntcreate_lock_add_entry (lck=0x7fffd7df3ce8, keep_locked=0x7fffd7df3ad0, private_data=0x7fffd7df3cc8) at ../../source3/smbd/open.c:3688
  #21 0x00007fffa14f6248 in share_mode_entry_prepare_lock_fn (glck=0x7fffd7df35b8, cb_private=0x7fffd7df3a88) at ../../source3/locking/share_mode_lock.c:2978
  #22 0x00007fffa1317680 in g_lock_lock_cb_run_and_store (cb_state=cb_state@entry=0x7fffd7df35b8) at ../../source3/lib/g_lock.c:597
  #23 0x00007fffa1319df8 in g_lock_lock_simple_fn (rec=0x7fffd7df3798, value=..., private_data=0x7fffd7df39a0) at ../../source3/lib/g_lock.c:1212
  #24 0x00007fffa13160e0 in dbwrap_watched_do_locked_fn (backend_rec=&lt;optimized out&gt;, backend_value=..., private_data=0x7fffd7df3768) at ../../source3/lib/dbwrap/dbwrap_watch.c:458
  #25 0x00007fffa0884e48 in dbwrap_do_locked (db=&lt;optimized out&gt;, key=..., fn=0x7fffa1316080 &lt;dbwrap_watched_do_locked_fn&gt;, private_data=0x7fffd7df3768) at ../../lib/dbwrap/dbwrap.c:602
  #26 0x00007fffa1315274 in dbwrap_watched_do_locked (db=0x1543a7160, key=..., fn=0x7fffa1319ca0 &lt;g_lock_lock_simple_fn&gt;, private_data=0x7fffd7df39a0) at ../../source3/lib/dbwrap/dbwrap_watch.c:480
  #27 0x00007fffa0884d60 in dbwrap_do_locked (db=&lt;optimized out&gt;, key=..., fn=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../lib/dbwrap/dbwrap.c:582
  #28 0x00007fffa131b458 in g_lock_lock (ctx=0x1543cc630, key=..., type=&lt;optimized out&gt;, timeout=..., cb_fn=0x7fffa14f6190 &lt;share_mode_entry_prepare_lock_fn&gt;, cb_private=0x7fffd7df3a88) at ../../source3/lib/g_lock.c:1267
  #29 0x00007fffa14fd060 in _share_mode_entry_prepare_lock (prepare_state=0x7fffd7df3cc8, id=..., servicepath=&lt;optimized out&gt;, smb_fname=&lt;optimized out&gt;, old_write_time=&lt;optimized out&gt;, fn=&lt;optimized out&gt;, private_data=0x7fffd7df3cc8, location=0x7fffa165b880 "../../source3/smbd/open.c:4292") at ../../source3/locking/share_mode_lock.c:3033
  #30 0x00007fffa15491e0 in open_file_ntcreate (conn=conn@entry=0x154382050, req=req@entry=0x154414800, access_mask=&lt;optimized out&gt;, access_mask@entry=131201, share_access=share_access@entry=7, create_disposition=create_disposition@entry=1, create_options=create_options@entry=0, new_dos_attributes=&lt;optimized out&gt;, new_dos_attributes@entry=128, oplock_request=oplock_request@entry=0, lease=&lt;optimized out&gt;, lease@entry=0x0, private_flags=&lt;optimized out&gt;, private_flags@entry=0, parent_dir_fname=&lt;optimized out&gt;, smb_fname_atname=&lt;optimized out&gt;, pinfo=&lt;optimized out&gt;, pinfo@entry=0x7fffd7df3f1c, fsp=&lt;optimized out&gt;, fsp@entry=0x1543d01e0) at ../../source3/smbd/open.c:4286
  #31 0x00007fffa154b94c in create_file_unixpath (conn=conn@entry=0x154382050, req=req@entry=0x154414800, dirfsp=dirfsp@entry=0x15439a7f0, smb_fname=smb_fname@entry=0x154416300, access_mask=access_mask@entry=131201, share_access=share_access@entry=7, create_disposition=create_disposition@entry=1, create_options=create_options@entry=0, file_attributes=file_attributes@entry=128, oplock_request=&lt;optimized out&gt;, oplock_request@entry=0, lease=&lt;optimized out&gt;, lease@entry=0x0, allocation_size=allocation_size@entry=0, private_flags=private_flags@entry=0, sd=sd@entry=0x0, ea_list=ea_list@entry=0x0, result=result@entry=0x7fffd7df4168, pinfo=pinfo@entry=0x7fffd7df4160) at ../../source3/smbd/open.c:6290
  #32 0x00007fffa154dfac in create_file_default (conn=0x154382050, req=0x154414800, dirfsp=0x15439a7f0, smb_fname=0x154416300, access_mask=&lt;optimized out&gt;, share_access=&lt;optimized out&gt;, create_disposition=&lt;optimized out&gt;, create_options=&lt;optimized out&gt;, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/smbd/open.c:6609
  #33 0x00007fffa150972c in vfswrap_create_file (handle=&lt;optimized out&gt;, req=&lt;optimized out&gt;, dirfsp=&lt;optimized out&gt;, smb_fname=&lt;optimized out&gt;, access_mask=&lt;optimized out&gt;, share_access=&lt;optimized out&gt;, create_disposition=&lt;optimized out&gt;, create_options=&lt;optimized out&gt;, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/modules/vfs_default.c:776
  #34 0x00007fffa1559cbc in smb_vfs_call_create_file (handle=&lt;optimized out&gt;, req=&lt;optimized out&gt;, dirfsp=&lt;optimized out&gt;, smb_fname=&lt;optimized out&gt;, access_mask=&lt;optimized out&gt;, share_access=&lt;optimized out&gt;, create_disposition=&lt;optimized out&gt;, create_options=&lt;optimized out&gt;, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/smbd/vfs.c:1560
  #35 0x00007fff9c0a9ec4 in smb_time_audit_create_file (handle=0x154426820, req=0x154414800, dirfsp=0x15439a7f0, fname=0x154416300, access_mask=&lt;optimized out&gt;, share_access=&lt;optimized out&gt;, create_disposition=&lt;optimized out&gt;, create_options=&lt;optimized out&gt;, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result_fsp=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/modules/vfs_time_audit.c:634
  #36 0x00007fffa1559cbc in smb_vfs_call_create_file (handle=&lt;optimized out&gt;, req=&lt;optimized out&gt;, dirfsp=&lt;optimized out&gt;, smb_fname=&lt;optimized out&gt;, access_mask=&lt;optimized out&gt;, share_access=&lt;optimized out&gt;, create_disposition=&lt;optimized out&gt;, create_options=&lt;optimized out&gt;, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/smbd/vfs.c:1560
  #37 0x00007fffa1597aa8 in smbd_smb2_create_send (in_context_blobs=..., in_name=0x154413ca0, in_create_options=&lt;optimized out&gt;, in_create_disposition=&lt;optimized out&gt;, in_share_access=&lt;optimized out&gt;, in_file_attributes=&lt;optimized out&gt;, in_desired_access=&lt;optimized out&gt;, in_impersonation_level=&lt;optimized out&gt;, in_oplock_level=&lt;optimized out&gt;, smb2req=0x154413770, ev=0x154328120, mem_ctx=0x154413770) at ../../source3/smbd/smb2_create.c:1115
  #38 smbd_smb2_request_process_create (smb2req=0x154413770) at ../../source3/smbd/smb2_create.c:291
  #39 0x00007fffa158a628 in smbd_smb2_request_dispatch (req=0x154413770) at ../../source3/smbd/smb2_server.c:3485
  #40 0x00007fffa158c540 in smbd_smb2_io_handler (fde_flags=&lt;optimized out&gt;, xconn=0x154313f30) at ../../source3/smbd/smb2_server.c:5112
  #41 smbd_smb2_connection_handler (ev=&lt;optimized out&gt;, fde=&lt;optimized out&gt;, flags=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../source3/smbd/smb2_server.c:5150
  #42 0x00007fffa1198b2c in tevent_common_invoke_fd_handler (fde=0x15435add0, flags=&lt;optimized out&gt;, removed=0x0) at ../../lib/tevent/tevent_fd.c:158
  #43 0x00007fffa11a2b9c in epoll_event_loop (tvalp=0x7fffd7df4b28, epoll_ev=0x1543b4e80) at ../../lib/tevent/tevent_epoll.c:730
  #44 epoll_event_loop_once (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent_epoll.c:946
  #45 0x00007fffa11a0090 in std_event_loop_once (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent_standard.c:110
  #46 0x00007fffa119744c in _tevent_loop_once (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent.c:823
  #47 0x00007fffa1197884 in tevent_common_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:950
  #48 0x00007fffa119ffc0 in std_event_loop_wait (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent_standard.c:141
  #49 0x00007fffa1197978 in _tevent_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:971
  #50 0x00007fffa15737fc in smbd_process (ev_ctx=0x154328120, msg_ctx=&lt;optimized out&gt;, sock_fd=&lt;optimized out&gt;, interactive=&lt;optimized out&gt;) at ../../source3/smbd/smb2_process.c:2158
  #51 0x000000011db5c554 in smbd_accept_connection (ev=0x154328120, fde=&lt;optimized out&gt;, flags=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../source3/smbd/server.c:1150
  #52 0x00007fffa1198b2c in tevent_common_invoke_fd_handler (fde=0x1543ac2d0, flags=&lt;optimized out&gt;, removed=0x0) at ../../lib/tevent/tevent_fd.c:158
  #53 0x00007fffa11a2b9c in epoll_event_loop (tvalp=0x7fffd7df4f98, epoll_ev=0x154328350) at ../../lib/tevent/tevent_epoll.c:730
  #54 epoll_event_loop_once (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent_epoll.c:946
  #55 0x00007fffa11a0090 in std_event_loop_once (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent_standard.c:110
  #56 0x00007fffa119744c in _tevent_loop_once (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent.c:823
  #57 0x00007fffa1197884 in tevent_common_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:950
  #58 0x00007fffa119ffc0 in std_event_loop_wait (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent_standard.c:141
  #59 0x00007fffa1197978 in _tevent_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:971
  #60 0x000000011db58c54 in smbd_parent_loop (parent=&lt;optimized out&gt;, ev_ctx=0x154328120) at ../../source3/smbd/server.c:1499
  #61 main (argc=&lt;optimized out&gt;, argv=&lt;optimized out&gt;) at ../../source3/smbd/server.c:2258

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15767

Pair-Programmed-With: Stefan Metzmacher &lt;metze@samba.org&gt;
Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix a deadlock that can happen if two clients happen to open and byte-range-lock
two different files whos record in locking.tdb and brlock.tdb happen to sit on
the same hashchain.

The deadlock was introduced by commit
680c7907325b433856ac1dd916ab63e671fbe4ab. Before, we used share_mode_do_locked()
in do_lock() which meant we acquired a chainlock on locking.tdb before getting a
chainlock on brlock.tdb via brl_get_locks_for_locking(), so the TDB chainlock
order invariant was always uphold.

The following race between specific client requests lead to the deadlock.

Client A) issues a byte-range-lock request on a file:

A1) glock locking.tdb (via _share_mode_do_locked_vfs_allowed())
A2) chainlock brlock.tdb (via brl_lock())
A3) attempt to chainlock locking.tdb (via share_mode_g_lock_dump())
[1]

Client B) opens a different (!) file:

B1) glock and chainlock locking.tdb (via _share_mode_entry_prepare_lock())
B2) attempt to chainlock brlock.tdb (via file_has_brlocks())
[2]

The glock from A1 is per record and hence doesn't synchronize with the glock
from B1 as it is for a different file and hence a different record, subsequently
A2 and A3 violate the lock order constraint

To avoid the chainlock lock order violation in the second client we modify the
br-lock code to not take the brlock.tdb chainlock from step A2 via
br_get_locks() for the whole time we process the request. Instead we just fetch
the br-locks via br_get_locks_readonly(), so when running into
contend_level2_oplocks_begin_default() to check for leases and looking into
locking.tdb we don't hold a brlock.tdb chainlock.

Or im simpler terms, we only ever take at most one low-level TDB chainlock at a
time:

Byte-range-lock code calls share_mode_do_locked_brl(..., cb_fn, ...):
1) chainlock locking.tdb
2) glock locking.tdb (via share_mode_do_locked_vfs_allowed())
3) chainunlock locking.tdb
4) share_mode_do_locked_brl_fn() -&gt; brl_get_locks_readonly_parse():
   a) chainlock brlock.tdb
   b) parse record and store in-memory copy
   c) chainunlock brlock.tdb
5) run cb_fn()
6) chainlock brlock.tdb:
   a) br_lck-&gt;record = dbwrap_fetch_locked(brlock_db, ...)
   b) store modifed br_lck from 5) via byte_range_lock_flush()
7) chainunlock brlock.tdb
8) chainlock locking.tdb
9) gunlock locking.tdb
10) chainunlock locking.tdb

All access to brlock.tdb is synchronized correctly via glocks on the locking.tdb
record of the file (step 3)), so operations still appear atomic to clients.

As a result of using share_mode_do_locked_brl(), the functions do_[un]lock() -&gt;
brl_[un]lock() now loop over the same br_lck object in memory, avoiding
repeatedly fetching and storing the locks per loop.

[1]
Full SBT:

  #0  0x00007fffa0cecbb0 in __pthread_mutex_lock_full () from /lib64/glibc-hwcaps/power9/libpthread-2.28.so
  #1  0x00007fffa0a73cf8 in chain_mutex_lock (m=&lt;optimized out&gt;, m@entry=0x7fff9ae071b0, waitflag=&lt;optimized out&gt;, waitflag@entry=true) at ../../lib/tdb/common/mutex.c:182
  #2  0x00007fffa0a7432c in tdb_mutex_lock (tdb=0x1543ba120, rw=&lt;optimized out&gt;, off=&lt;optimized out&gt;, len=&lt;optimized out&gt;, waitflag=&lt;optimized out&gt;, pret=0x7fffd7df3858) at ../../lib/tdb/common/mutex.c:234
  #3  0x00007fffa0a6812c in fcntl_lock (waitflag=&lt;optimized out&gt;, len=1, off=376608, rw=0, tdb=0x1543ba120) at ../../lib/tdb/common/lock.c:200
  #4  tdb_brlock (tdb=0x1543ba120, rw_type=&lt;optimized out&gt;, offset=&lt;optimized out&gt;, len=1, flags=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:200
  #5  0x00007fffa0a68af8 in tdb_nest_lock (flags=&lt;optimized out&gt;, ltype=0, offset=&lt;optimized out&gt;, tdb=0x1543ba120) at ../../lib/tdb/common/lock.c:390
  #6  tdb_nest_lock (tdb=0x1543ba120, offset=&lt;optimized out&gt;, ltype=&lt;optimized out&gt;, flags=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:336
  #7  0x00007fffa0a69088 in tdb_lock_list (tdb=0x1543ba120, list=&lt;optimized out&gt;, ltype=&lt;optimized out&gt;, waitflag=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:482
  #8  0x00007fffa0a69198 in tdb_lock (tdb=0x1543ba120, list=&lt;optimized out&gt;, ltype=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:500
  #9  0x00007fffa0a64b50 in tdb_find_lock_hash (tdb=&lt;optimized out&gt;, tdb@entry=0x1543ba120, key=..., hash=&lt;optimized out&gt;, locktype=&lt;optimized out&gt;, locktype@entry=0, rec=&lt;optimized out&gt;, rec@entry=0x7fffd7df3ab0) at ../../lib/tdb/common/tdb.c:165
  #10 0x00007fffa0a64ed0 in tdb_parse_record (tdb=0x1543ba120, key=..., parser=0x7fffa0e74470 &lt;db_ctdb_ltdb_parser&gt;, private_data=0x7fffd7df3b18) at ../../lib/tdb/common/tdb.c:329
  #11 0x00007fffa0e74cbc in db_ctdb_ltdb_parse (db=&lt;optimized out&gt;, private_data=0x7fffd7df3b70, parser=0x7fffa0e76470 &lt;db_ctdb_parse_record_parser_nonpersistent&gt;, key=...) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:170
  #12 db_ctdb_try_parse_local_record (ctx=ctx@entry=0x1543d4580, key=..., state=state@entry=0x7fffd7df3b70) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:1385
  #13 0x00007fffa0e76024 in db_ctdb_parse_record (db=&lt;optimized out&gt;, key=..., parser=0x7fffa1313910 &lt;dbwrap_watched_parse_record_parser&gt;, private_data=0x7fffd7df3c08) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:1425
  #14 0x00007fffa0884760 in dbwrap_parse_record (db=&lt;optimized out&gt;, key=..., parser=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../lib/dbwrap/dbwrap.c:454
  #15 0x00007fffa1313ab4 in dbwrap_watched_parse_record (db=0x1543a7160, key=..., parser=0x7fffa13187d0 &lt;g_lock_dump_fn&gt;, private_data=0x7fffd7df3ce8) at ../../source3/lib/dbwrap/dbwrap_watch.c:783
  #16 0x00007fffa0884760 in dbwrap_parse_record (db=&lt;optimized out&gt;, key=..., parser=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../lib/dbwrap/dbwrap.c:454
  #17 0x00007fffa131c004 in g_lock_dump (ctx=&lt;error reading variable: value has been optimized out&gt;, key=..., fn=0x7fffa14f3d70 &lt;fsp_update_share_mode_flags_fn&gt;, private_data=0x7fffd7df3dd8) at ../../source3/lib/g_lock.c:1653
  #18 0x00007fffa14f434c in share_mode_g_lock_dump (key=..., fn=0x7fffa14f3d70 &lt;fsp_update_share_mode_flags_fn&gt;, private_data=0x7fffd7df3dd8) at ../../source3/locking/share_mode_lock.c:96
  #19 0x00007fffa14f8d44 in fsp_update_share_mode_flags (fsp=0x15433c550) at ../../source3/locking/share_mode_lock.c:1181
  #20 file_has_read_lease (fsp=0x15433c550) at ../../source3/locking/share_mode_lock.c:1207
  #21 0x00007fffa15ccc98 in contend_level2_oplocks_begin_default (type=&lt;optimized out&gt;, fsp=0x15433c550) at ../../source3/smbd/smb2_oplock.c:1282
  #22 smbd_contend_level2_oplocks_begin (fsp=0x15433c550, type=&lt;optimized out&gt;) at ../../source3/smbd/smb2_oplock.c:1338
  #23 0x00007fffa0dd0b54 in contend_level2_oplocks_begin (fsp=&lt;optimized out&gt;, type=&lt;optimized out&gt;) at ../../source3/lib/smbd_shim.c:72
  #24 0x00007fffa14ecfd0 in brl_lock_windows_default (br_lck=0x154421330, plock=0x7fffd7df4250) at ../../source3/locking/brlock.c:457
  #25 0x00007fffa150b70c in vfswrap_brl_lock_windows (handle=&lt;optimized out&gt;, br_lck=&lt;optimized out&gt;, plock=&lt;optimized out&gt;) at ../../source3/modules/vfs_default.c:3424
  #26 0x00007fffa1561910 in smb_vfs_call_brl_lock_windows (handle=&lt;optimized out&gt;, br_lck=&lt;optimized out&gt;, plock=&lt;optimized out&gt;) at ../../source3/smbd/vfs.c:2686
  #27 0x00007fff9c0a7350 in smb_time_audit_brl_lock_windows (handle=&lt;optimized out&gt;, br_lck=0x154421330, plock=0x7fffd7df4250) at ../../source3/modules/vfs_time_audit.c:1740
  #28 0x00007fffa1561910 in smb_vfs_call_brl_lock_windows (handle=&lt;optimized out&gt;, br_lck=&lt;optimized out&gt;, plock=&lt;optimized out&gt;) at ../../source3/smbd/vfs.c:2686
  #29 0x00007fffa14ed410 in brl_lock (br_lck=0x154421330, smblctx=3102281601, pid=..., start=0, size=18446744073709551615, lock_type=&lt;optimized out&gt;, lock_flav=WINDOWS_LOCK, blocker_pid=0x7fffd7df4540, psmblctx=0x7fffd7df4558) at ../../source3/locking/brlock.c:1004
  #30 0x00007fffa14e7b18 in do_lock_fn (lck=&lt;optimized out&gt;, private_data=0x7fffd7df4508) at ../../source3/locking/locking.c:271
  #31 0x00007fffa14fcd94 in _share_mode_do_locked_vfs_allowed (id=..., fn=0x7fffa14e7a60 &lt;do_lock_fn&gt;, private_data=0x7fffd7df4508, location=&lt;optimized out&gt;) at ../../source3/locking/share_mode_lock.c:2927
  #32 0x00007fffa14e918c in do_lock (fsp=0x15433c550, req_mem_ctx=&lt;optimized out&gt;, req_guid=&lt;optimized out&gt;, smblctx=&lt;optimized out&gt;, count=18446744073709551615, offset=0, lock_type=&lt;optimized out&gt;, lock_flav=&lt;optimized out&gt;, pblocker_pid=0x7fffd7df46f0,
      psmblctx=0x7fffd7df46d8) at ../../source3/locking/locking.c:335
  #33 0x00007fffa155381c in smbd_do_locks_try (fsp=0x15433c550, num_locks=&lt;optimized out&gt;, locks=0x1543bc310, blocker_idx=0x7fffd7df46d6, blocking_pid=0x7fffd7df46f0, blocking_smblctx=0x7fffd7df46d8) at ../../source3/smbd/blocking.c:46
  #34 0x00007fffa159dc90 in smbd_smb2_lock_try (req=req@entry=0x1543bc080) at ../../source3/smbd/smb2_lock.c:590
  #35 0x00007fffa159ee8c in smbd_smb2_lock_send (in_locks=&lt;optimized out&gt;, in_lock_count=1, in_lock_sequence=&lt;optimized out&gt;, fsp=0x15433c550, smb2req=0x1543532e0, ev=0x154328120, mem_ctx=0x1543532e0) at ../../source3/smbd/smb2_lock.c:488
  #36 smbd_smb2_request_process_lock (req=0x1543532e0) at ../../source3/smbd/smb2_lock.c:150
  #37 0x00007fffa158a368 in smbd_smb2_request_dispatch (req=0x1543532e0) at ../../source3/smbd/smb2_server.c:3515
  #38 0x00007fffa158c540 in smbd_smb2_io_handler (fde_flags=&lt;optimized out&gt;, xconn=0x154313f30) at ../../source3/smbd/smb2_server.c:5112
  #39 smbd_smb2_connection_handler (ev=&lt;optimized out&gt;, fde=&lt;optimized out&gt;, flags=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../source3/smbd/smb2_server.c:5150
  #40 0x00007fffa1198b2c in tevent_common_invoke_fd_handler (fde=0x1543670f0, flags=&lt;optimized out&gt;, removed=0x0) at ../../lib/tevent/tevent_fd.c:158
  #41 0x00007fffa11a2b9c in epoll_event_loop (tvalp=0x7fffd7df4b28, epoll_ev=0x1543b4e80) at ../../lib/tevent/tevent_epoll.c:730
  #42 epoll_event_loop_once (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent_epoll.c:946
  #43 0x00007fffa11a0090 in std_event_loop_once (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent_standard.c:110
  #44 0x00007fffa119744c in _tevent_loop_once (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent.c:823
  #45 0x00007fffa1197884 in tevent_common_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:950
  #46 0x00007fffa119ffc0 in std_event_loop_wait (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent_standard.c:141
  #47 0x00007fffa1197978 in _tevent_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:971
  #48 0x00007fffa15737fc in smbd_process (ev_ctx=0x154328120, msg_ctx=&lt;optimized out&gt;, sock_fd=&lt;optimized out&gt;, interactive=&lt;optimized out&gt;) at ../../source3/smbd/smb2_process.c:2158
  #49 0x000000011db5c554 in smbd_accept_connection (ev=0x154328120, fde=&lt;optimized out&gt;, flags=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../source3/smbd/server.c:1150
  #50 0x00007fffa1198b2c in tevent_common_invoke_fd_handler (fde=0x1543ac2d0, flags=&lt;optimized out&gt;, removed=0x0) at ../../lib/tevent/tevent_fd.c:158
  #51 0x00007fffa11a2b9c in epoll_event_loop (tvalp=0x7fffd7df4f98, epoll_ev=0x154328350) at ../../lib/tevent/tevent_epoll.c:730
  #52 epoll_event_loop_once (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent_epoll.c:946
  #53 0x00007fffa11a0090 in std_event_loop_once (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent_standard.c:110
  #54 0x00007fffa119744c in _tevent_loop_once (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent.c:823
  #55 0x00007fffa1197884 in tevent_common_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:950
  #56 0x00007fffa119ffc0 in std_event_loop_wait (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent_standard.c:141
  #57 0x00007fffa1197978 in _tevent_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:971
  #58 0x000000011db58c54 in smbd_parent_loop (parent=&lt;optimized out&gt;, ev_ctx=0x154328120) at ../../source3/smbd/server.c:1499
  #59 main (argc=&lt;optimized out&gt;, argv=&lt;optimized out&gt;) at ../../source3/smbd/server.c:2258

[2]
Full SBT:

  #0  0x00007fffa0cecbb0 in __pthread_mutex_lock_full () from /lib64/glibc-hwcaps/power9/libpthread-2.28.so
  #1  0x00007fffa0a73cf8 in chain_mutex_lock (m=&lt;optimized out&gt;, m@entry=0x7fff9b3a71b0, waitflag=&lt;optimized out&gt;, waitflag@entry=true) at ../../lib/tdb/common/mutex.c:182
  #2  0x00007fffa0a7432c in tdb_mutex_lock (tdb=0x1543c6900, rw=&lt;optimized out&gt;, off=&lt;optimized out&gt;, len=&lt;optimized out&gt;, waitflag=&lt;optimized out&gt;, pret=0x7fffd7df2e28) at ../../lib/tdb/common/mutex.c:234
  #3  0x00007fffa0a6812c in fcntl_lock (waitflag=&lt;optimized out&gt;, len=1, off=376608, rw=0, tdb=0x1543c6900) at ../../lib/tdb/common/lock.c:200
  #4  tdb_brlock (tdb=0x1543c6900, rw_type=&lt;optimized out&gt;, offset=&lt;optimized out&gt;, len=1, flags=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:200
  #5  0x00007fffa0a68af8 in tdb_nest_lock (flags=&lt;optimized out&gt;, ltype=0, offset=&lt;optimized out&gt;, tdb=0x1543c6900) at ../../lib/tdb/common/lock.c:390
  #6  tdb_nest_lock (tdb=0x1543c6900, offset=&lt;optimized out&gt;, ltype=&lt;optimized out&gt;, flags=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:336
  #7  0x00007fffa0a69088 in tdb_lock_list (tdb=0x1543c6900, list=&lt;optimized out&gt;, ltype=&lt;optimized out&gt;, waitflag=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:482
  #8  0x00007fffa0a69198 in tdb_lock (tdb=0x1543c6900, list=&lt;optimized out&gt;, ltype=&lt;optimized out&gt;) at ../../lib/tdb/common/lock.c:500
  #9  0x00007fffa0a64b50 in tdb_find_lock_hash (tdb=&lt;optimized out&gt;, tdb@entry=0x1543c6900, key=..., hash=&lt;optimized out&gt;, locktype=&lt;optimized out&gt;, locktype@entry=0, rec=&lt;optimized out&gt;, rec@entry=0x7fffd7df3080) at ../../lib/tdb/common/tdb.c:165
  #10 0x00007fffa0a64ed0 in tdb_parse_record (tdb=0x1543c6900, key=..., parser=0x7fffa0e74470 &lt;db_ctdb_ltdb_parser&gt;, private_data=0x7fffd7df30e8) at ../../lib/tdb/common/tdb.c:329
  #11 0x00007fffa0e74cbc in db_ctdb_ltdb_parse (db=&lt;optimized out&gt;, private_data=0x7fffd7df3140, parser=0x7fffa0e76470 &lt;db_ctdb_parse_record_parser_nonpersistent&gt;, key=...) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:170
  #12 db_ctdb_try_parse_local_record (ctx=ctx@entry=0x154328fc0, key=..., state=state@entry=0x7fffd7df3140) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:1385
  #13 0x00007fffa0e76024 in db_ctdb_parse_record (db=&lt;optimized out&gt;, key=..., parser=0x7fffa14ec820 &lt;brl_get_locks_readonly_parser&gt;, private_data=0x7fffd7df3218) at ../../source3/lib/dbwrap/dbwrap_ctdb.c:1425
  #14 0x00007fffa0884760 in dbwrap_parse_record (db=&lt;optimized out&gt;, key=..., parser=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../lib/dbwrap/dbwrap.c:454
  #15 0x00007fffa14ef5bc in brl_get_locks_readonly (fsp=0x1543d01e0) at ../../source3/locking/brlock.c:1884
  #16 0x00007fffa1546968 in file_has_brlocks (fsp=0x1543d01e0) at ../../source3/smbd/open.c:2232
  #17 delay_for_oplock (pgranted=&lt;synthetic pointer&gt;, poplock_type=&lt;synthetic pointer&gt;, first_open_attempt=&lt;optimized out&gt;, create_disposition=1, have_sharing_violation=false, lck=0x7fffd7df3ce8, lease=0x0, oplock_request=0, fsp=0x1543d01e0) at ../../source3/smbd/open.c:2749
  #18 handle_share_mode_lease (pgranted=&lt;synthetic pointer&gt;, poplock_type=&lt;synthetic pointer&gt;, first_open_attempt=&lt;optimized out&gt;, lease=0x0, oplock_request=0, share_access=7, access_mask=131201, create_disposition=1, lck=0x7fffd7df3ce8, fsp=0x1543d01e0) at ../../source3/smbd/open.c:2865
  #19 check_and_store_share_mode (first_open_attempt=&lt;optimized out&gt;, lease=0x0, oplock_request=0, share_access=7, access_mask=131201, create_disposition=1, lck=0x7fffd7df3ce8, req=0x154414800, fsp=0x1543d01e0) at ../../source3/smbd/open.c:3333
  #20 open_ntcreate_lock_add_entry (lck=0x7fffd7df3ce8, keep_locked=0x7fffd7df3ad0, private_data=0x7fffd7df3cc8) at ../../source3/smbd/open.c:3688
  #21 0x00007fffa14f6248 in share_mode_entry_prepare_lock_fn (glck=0x7fffd7df35b8, cb_private=0x7fffd7df3a88) at ../../source3/locking/share_mode_lock.c:2978
  #22 0x00007fffa1317680 in g_lock_lock_cb_run_and_store (cb_state=cb_state@entry=0x7fffd7df35b8) at ../../source3/lib/g_lock.c:597
  #23 0x00007fffa1319df8 in g_lock_lock_simple_fn (rec=0x7fffd7df3798, value=..., private_data=0x7fffd7df39a0) at ../../source3/lib/g_lock.c:1212
  #24 0x00007fffa13160e0 in dbwrap_watched_do_locked_fn (backend_rec=&lt;optimized out&gt;, backend_value=..., private_data=0x7fffd7df3768) at ../../source3/lib/dbwrap/dbwrap_watch.c:458
  #25 0x00007fffa0884e48 in dbwrap_do_locked (db=&lt;optimized out&gt;, key=..., fn=0x7fffa1316080 &lt;dbwrap_watched_do_locked_fn&gt;, private_data=0x7fffd7df3768) at ../../lib/dbwrap/dbwrap.c:602
  #26 0x00007fffa1315274 in dbwrap_watched_do_locked (db=0x1543a7160, key=..., fn=0x7fffa1319ca0 &lt;g_lock_lock_simple_fn&gt;, private_data=0x7fffd7df39a0) at ../../source3/lib/dbwrap/dbwrap_watch.c:480
  #27 0x00007fffa0884d60 in dbwrap_do_locked (db=&lt;optimized out&gt;, key=..., fn=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../lib/dbwrap/dbwrap.c:582
  #28 0x00007fffa131b458 in g_lock_lock (ctx=0x1543cc630, key=..., type=&lt;optimized out&gt;, timeout=..., cb_fn=0x7fffa14f6190 &lt;share_mode_entry_prepare_lock_fn&gt;, cb_private=0x7fffd7df3a88) at ../../source3/lib/g_lock.c:1267
  #29 0x00007fffa14fd060 in _share_mode_entry_prepare_lock (prepare_state=0x7fffd7df3cc8, id=..., servicepath=&lt;optimized out&gt;, smb_fname=&lt;optimized out&gt;, old_write_time=&lt;optimized out&gt;, fn=&lt;optimized out&gt;, private_data=0x7fffd7df3cc8, location=0x7fffa165b880 "../../source3/smbd/open.c:4292") at ../../source3/locking/share_mode_lock.c:3033
  #30 0x00007fffa15491e0 in open_file_ntcreate (conn=conn@entry=0x154382050, req=req@entry=0x154414800, access_mask=&lt;optimized out&gt;, access_mask@entry=131201, share_access=share_access@entry=7, create_disposition=create_disposition@entry=1, create_options=create_options@entry=0, new_dos_attributes=&lt;optimized out&gt;, new_dos_attributes@entry=128, oplock_request=oplock_request@entry=0, lease=&lt;optimized out&gt;, lease@entry=0x0, private_flags=&lt;optimized out&gt;, private_flags@entry=0, parent_dir_fname=&lt;optimized out&gt;, smb_fname_atname=&lt;optimized out&gt;, pinfo=&lt;optimized out&gt;, pinfo@entry=0x7fffd7df3f1c, fsp=&lt;optimized out&gt;, fsp@entry=0x1543d01e0) at ../../source3/smbd/open.c:4286
  #31 0x00007fffa154b94c in create_file_unixpath (conn=conn@entry=0x154382050, req=req@entry=0x154414800, dirfsp=dirfsp@entry=0x15439a7f0, smb_fname=smb_fname@entry=0x154416300, access_mask=access_mask@entry=131201, share_access=share_access@entry=7, create_disposition=create_disposition@entry=1, create_options=create_options@entry=0, file_attributes=file_attributes@entry=128, oplock_request=&lt;optimized out&gt;, oplock_request@entry=0, lease=&lt;optimized out&gt;, lease@entry=0x0, allocation_size=allocation_size@entry=0, private_flags=private_flags@entry=0, sd=sd@entry=0x0, ea_list=ea_list@entry=0x0, result=result@entry=0x7fffd7df4168, pinfo=pinfo@entry=0x7fffd7df4160) at ../../source3/smbd/open.c:6290
  #32 0x00007fffa154dfac in create_file_default (conn=0x154382050, req=0x154414800, dirfsp=0x15439a7f0, smb_fname=0x154416300, access_mask=&lt;optimized out&gt;, share_access=&lt;optimized out&gt;, create_disposition=&lt;optimized out&gt;, create_options=&lt;optimized out&gt;, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/smbd/open.c:6609
  #33 0x00007fffa150972c in vfswrap_create_file (handle=&lt;optimized out&gt;, req=&lt;optimized out&gt;, dirfsp=&lt;optimized out&gt;, smb_fname=&lt;optimized out&gt;, access_mask=&lt;optimized out&gt;, share_access=&lt;optimized out&gt;, create_disposition=&lt;optimized out&gt;, create_options=&lt;optimized out&gt;, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/modules/vfs_default.c:776
  #34 0x00007fffa1559cbc in smb_vfs_call_create_file (handle=&lt;optimized out&gt;, req=&lt;optimized out&gt;, dirfsp=&lt;optimized out&gt;, smb_fname=&lt;optimized out&gt;, access_mask=&lt;optimized out&gt;, share_access=&lt;optimized out&gt;, create_disposition=&lt;optimized out&gt;, create_options=&lt;optimized out&gt;, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/smbd/vfs.c:1560
  #35 0x00007fff9c0a9ec4 in smb_time_audit_create_file (handle=0x154426820, req=0x154414800, dirfsp=0x15439a7f0, fname=0x154416300, access_mask=&lt;optimized out&gt;, share_access=&lt;optimized out&gt;, create_disposition=&lt;optimized out&gt;, create_options=&lt;optimized out&gt;, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result_fsp=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/modules/vfs_time_audit.c:634
  #36 0x00007fffa1559cbc in smb_vfs_call_create_file (handle=&lt;optimized out&gt;, req=&lt;optimized out&gt;, dirfsp=&lt;optimized out&gt;, smb_fname=&lt;optimized out&gt;, access_mask=&lt;optimized out&gt;, share_access=&lt;optimized out&gt;, create_disposition=&lt;optimized out&gt;, create_options=&lt;optimized out&gt;, file_attributes=128, oplock_request=0, lease=0x0, allocation_size=0, private_flags=0, sd=0x0, ea_list=0x0, result=0x1544144e8, pinfo=0x1544144fc, in_context_blobs=0x7fffd7df4798, out_context_blobs=0x154414710) at ../../source3/smbd/vfs.c:1560
  #37 0x00007fffa1597aa8 in smbd_smb2_create_send (in_context_blobs=..., in_name=0x154413ca0, in_create_options=&lt;optimized out&gt;, in_create_disposition=&lt;optimized out&gt;, in_share_access=&lt;optimized out&gt;, in_file_attributes=&lt;optimized out&gt;, in_desired_access=&lt;optimized out&gt;, in_impersonation_level=&lt;optimized out&gt;, in_oplock_level=&lt;optimized out&gt;, smb2req=0x154413770, ev=0x154328120, mem_ctx=0x154413770) at ../../source3/smbd/smb2_create.c:1115
  #38 smbd_smb2_request_process_create (smb2req=0x154413770) at ../../source3/smbd/smb2_create.c:291
  #39 0x00007fffa158a628 in smbd_smb2_request_dispatch (req=0x154413770) at ../../source3/smbd/smb2_server.c:3485
  #40 0x00007fffa158c540 in smbd_smb2_io_handler (fde_flags=&lt;optimized out&gt;, xconn=0x154313f30) at ../../source3/smbd/smb2_server.c:5112
  #41 smbd_smb2_connection_handler (ev=&lt;optimized out&gt;, fde=&lt;optimized out&gt;, flags=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../source3/smbd/smb2_server.c:5150
  #42 0x00007fffa1198b2c in tevent_common_invoke_fd_handler (fde=0x15435add0, flags=&lt;optimized out&gt;, removed=0x0) at ../../lib/tevent/tevent_fd.c:158
  #43 0x00007fffa11a2b9c in epoll_event_loop (tvalp=0x7fffd7df4b28, epoll_ev=0x1543b4e80) at ../../lib/tevent/tevent_epoll.c:730
  #44 epoll_event_loop_once (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent_epoll.c:946
  #45 0x00007fffa11a0090 in std_event_loop_once (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent_standard.c:110
  #46 0x00007fffa119744c in _tevent_loop_once (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent.c:823
  #47 0x00007fffa1197884 in tevent_common_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:950
  #48 0x00007fffa119ffc0 in std_event_loop_wait (ev=0x154328120, location=0x7fffa1668db8 "../../source3/smbd/smb2_process.c:2158") at ../../lib/tevent/tevent_standard.c:141
  #49 0x00007fffa1197978 in _tevent_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:971
  #50 0x00007fffa15737fc in smbd_process (ev_ctx=0x154328120, msg_ctx=&lt;optimized out&gt;, sock_fd=&lt;optimized out&gt;, interactive=&lt;optimized out&gt;) at ../../source3/smbd/smb2_process.c:2158
  #51 0x000000011db5c554 in smbd_accept_connection (ev=0x154328120, fde=&lt;optimized out&gt;, flags=&lt;optimized out&gt;, private_data=&lt;optimized out&gt;) at ../../source3/smbd/server.c:1150
  #52 0x00007fffa1198b2c in tevent_common_invoke_fd_handler (fde=0x1543ac2d0, flags=&lt;optimized out&gt;, removed=0x0) at ../../lib/tevent/tevent_fd.c:158
  #53 0x00007fffa11a2b9c in epoll_event_loop (tvalp=0x7fffd7df4f98, epoll_ev=0x154328350) at ../../lib/tevent/tevent_epoll.c:730
  #54 epoll_event_loop_once (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent_epoll.c:946
  #55 0x00007fffa11a0090 in std_event_loop_once (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent_standard.c:110
  #56 0x00007fffa119744c in _tevent_loop_once (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent.c:823
  #57 0x00007fffa1197884 in tevent_common_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:950
  #58 0x00007fffa119ffc0 in std_event_loop_wait (ev=0x154328120, location=0x11db60b50 "../../source3/smbd/server.c:1499") at ../../lib/tevent/tevent_standard.c:141
  #59 0x00007fffa1197978 in _tevent_loop_wait (ev=&lt;optimized out&gt;, location=&lt;optimized out&gt;) at ../../lib/tevent/tevent.c:971
  #60 0x000000011db58c54 in smbd_parent_loop (parent=&lt;optimized out&gt;, ev_ctx=0x154328120) at ../../source3/smbd/server.c:1499
  #61 main (argc=&lt;optimized out&gt;, argv=&lt;optimized out&gt;) at ../../source3/smbd/server.c:2258

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15767

Pair-Programmed-With: Stefan Metzmacher &lt;metze@samba.org&gt;
Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>s3/brlock: don't increment current_lock_count if do_lock_fn() failed</title>
<updated>2025-04-02T18:05:48+00:00</updated>
<author>
<name>Ralph Boehme</name>
<email>slow@samba.org</email>
</author>
<published>2025-01-08T14:43:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=3a0c6e99de4377f44bc29766b6ceb79040caed9f'/>
<id>3a0c6e99de4377f44bc29766b6ceb79040caed9f</id>
<content type='text'>
Also only assign psmblctx and pblocker_pid if the lock request failed.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15767

Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Stefan Metzmacher &lt;metze@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Also only assign psmblctx and pblocker_pid if the lock request failed.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15767

Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Stefan Metzmacher &lt;metze@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>smbd: implement modern write time update logic</title>
<updated>2025-03-27T06:37:31+00:00</updated>
<author>
<name>Ralph Boehme</name>
<email>slow@samba.org</email>
</author>
<published>2025-03-10T15:31:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=b6c8d5d82917b2601b566039dbfc6cad045c917a'/>
<id>b6c8d5d82917b2601b566039dbfc6cad045c917a</id>
<content type='text'>
The gist of this is:

1. A write or other modifications as per MS-FSA "2.1.4.17 Algorithm for Noting
that a File Has Been Modified" immediately update the file times, there's no
delayed update.

2. Setting a timestamp on a handle only disables further timestamp updates via
that handle. Modifications via other handles must still update the timestamps.

This can not be implemented by storing the sticky writetime in the
share_mode_data record for performance reasons, as from 2 it follows that the
record would have to be checked and updated for every write on all handles.

Instead, writes on handles with sticky writetime in effect, record the current
timestamp before the modification and reset the filesystem timestamp to the
recorded value after doing the modification.

For reference, these are the relevant pieces from MS-FSA:

2.1.1.6 Abstract Date Model: Per Open

- UserSetModificationTime: A Boolean that is TRUE if a user has explicitly set
File.LastModificationTime through this Open.

- UserSetChangeTime: A Boolean that is TRUE if a user has explicitly set
File.LastChangeTime through this Open.

- UserSetAccessTime: A Boolean that is TRUE if a user has explicitly set
File.LastAccessTime through this Open.

2.1.4.17 Algorithm for Noting That a File Has Been Modified

The inputs for this algorithm are as follows:
- Open: The Open through which the file was modified.

The pseudocode for the algorithm is as follows:

The object store SHOULD&lt;43&gt;:

- If Open.UserSetModificationTime is FALSE, set Open.File.LastModificationTime
to the current system time.

- If Open.UserSetChangeTime is FALSE, set Open.File.LastChangeTime to the
current system time.

- If Open.UserSetAccessTime is FALSE, set Open.File.LastAccessTime to the
current system time.

- Set Open.File.FileAttributes.FILE_ATTRIBUTE_ARCHIVE to TRUE.

This then gets used for eg writes:

2.1.5.4 Server Requests a Write

...

- The object store MUST note that the file has been modified as specified in
section 2.1.4.17 with Open equal to Open.

...

Note the following differences between Windows behaviour and current
MS-FSA, these are documentation bugs that will be fixed in later
releases as discussed here:

https://lists.samba.org/archive/cifs-protocol/2025-March/004453.html

* When processing FileEndOfFileInformation timestamps must be updated
if new size equals current size

* When processing FileAllocationInformation timestamps must be updated
if new size equals current size

* When processing FileAllocationInformation,
  If (the new allocation size is less than the existing allocation)
    Set the modification time (which will also updates the change time)
  Else
    Update the LastChangeTime

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594

Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;

Autobuild-User(master): Ralph Böhme &lt;slow@samba.org&gt;
Autobuild-Date(master): Thu Mar 27 06:37:31 UTC 2025 on atb-devel-224
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The gist of this is:

1. A write or other modifications as per MS-FSA "2.1.4.17 Algorithm for Noting
that a File Has Been Modified" immediately update the file times, there's no
delayed update.

2. Setting a timestamp on a handle only disables further timestamp updates via
that handle. Modifications via other handles must still update the timestamps.

This can not be implemented by storing the sticky writetime in the
share_mode_data record for performance reason