smbd: Simplify share_mode_lock.c
authorVolker Lendecke <vl@samba.org>
Thu, 27 Jun 2019 12:40:08 +0000 (14:40 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 4 Jul 2019 14:03:29 +0000 (14:03 +0000)
commitaabc97ebc92f6b0977910a3125182e44ac4fdec9
tree4f01f67eac018dbfbd5aadc5fb94ba946132f9d7
parent3b7b979ee987e3561caec35b277abe74c996fa9c
smbd: Simplify share_mode_lock.c

Do explicit refcounting instead of talloc_reference(). A later patch
will introduce a share_mode_do_locked() routine that can be nested
arbitrarily with get_share_mode_lock(). To do sanity checks for proper
nesting, share_mode_do_locked needs to be aware of the reference
counts for "static_share_mode_lock".

Why is share_mode_memcache_delete() gone? In parse_share_modes() we
already move the data out of the cache, share_mode_lock_destructor()
we don't even bother re-adding the share_mode_data to the cache if
it does not have share entries, because the next opener will invent a
new seqnum anyway.

Also: Less talloc_reference(), less lines of code.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/locking/share_mode_lock.c