diff options
author | Stefan Metzmacher <metze@samba.org> | 2020-08-28 15:56:35 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2020-09-03 13:34:11 +0000 |
commit | 8a8b90eba76b94f3d7291ccc86fe1e80d4423ff3 (patch) | |
tree | 447a55bc870448a11e18afd40dfbd4364708d658 /source3/locking | |
parent | 4aa4f12f5333bd4913989ae1f54027e480535eb4 (diff) | |
download | samba-8a8b90eba76b94f3d7291ccc86fe1e80d4423ff3.tar.gz |
s3:share_mode_lock: consistently debug share_mode_entry records
share_mode_entry_do(), share_mode_forall_entries() and
share_entry_forall() print the record before the callback is called
and when it was modified or deleted.
This makes it much easier to debug problems.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14428
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 4d740ac2084a68c6d4836cd83ea5d5f1ee9d37a2)
Diffstat (limited to 'source3/locking')
-rw-r--r-- | source3/locking/share_mode_lock.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index 0c5626f4bd1..a1a7b9793cf 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -2023,6 +2023,11 @@ static bool share_mode_for_one_entry( (int)e.stale); if (e.stale) { + if (DEBUGLEVEL>=10) { + DBG_DEBUG("share_mode_entry:\n"); + NDR_PRINT_DEBUG(share_mode_entry, &e); + } + if (*i < *num_share_modes) { memmove(blob.data, blob.data + SHARE_MODE_ENTRY_SIZE, @@ -2240,8 +2245,18 @@ static bool share_mode_entry_do( goto done; } + if (DEBUGLEVEL>=10) { + DBG_DEBUG("entry[%zu]:\n", idx); + NDR_PRINT_DEBUG(share_mode_entry, &e); + } + fn(&e, ltdb->num_share_entries, &modified, private_data); + DBG_DEBUG("entry[%zu]: modified=%d, e.stale=%d\n", + idx, + (int)modified, + (int)e.stale); + if (!e.stale && !modified) { ret = true; goto done; @@ -2252,9 +2267,8 @@ static bool share_mode_entry_do( if (e.stale) { /* - * Move the reset down one entry + * Move the rest down one entry */ - size_t behind = ltdb->num_share_entries - idx - 1; if (behind != 0) { memmove(e_ptr, @@ -2262,6 +2276,11 @@ static bool share_mode_entry_do( behind * SHARE_MODE_ENTRY_SIZE); } ltdb->num_share_entries -= 1; + + if (DEBUGLEVEL>=10) { + DBG_DEBUG("share_mode_entry:\n"); + NDR_PRINT_DEBUG(share_mode_entry, &e); + } } else { struct share_mode_entry_buf buf; bool ok; |