<feed xmlns='http://www.w3.org/2005/Atom'>
<title>samba.git/source3/locking, branch talloc-2.4.0</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>lib: Use tdb_data_dbg() where appropriate</title>
<updated>2023-01-10T00:28:37+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2023-01-04T08:52:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=88191630d2060ead9698c791e0d708d6e97ab83e'/>
<id>88191630d2060ead9698c791e0d708d6e97ab83e</id>
<content type='text'>
This changes the talloc hierarchy for a few callers, but as
talloc_tos() was initially designed exactly for this purpose (printing
SIDs in DEBUG), it should be okay.

Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This changes the talloc hierarchy for a few callers, but as
talloc_tos() was initially designed exactly for this purpose (printing
SIDs in DEBUG), it should be okay.

Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>smbd/locking: make use of the same tdb hash_size and flags for all SMB related tdb's</title>
<updated>2022-12-19T16:40:15+00:00</updated>
<author>
<name>Stefan Metzmacher</name>
<email>metze@samba.org</email>
</author>
<published>2019-06-17T14:36:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=87fddbad78d9a9f6fe922efb7a87ded01996d6ec'/>
<id>87fddbad78d9a9f6fe922efb7a87ded01996d6ec</id>
<content type='text'>
It's good to have a consistent set of hash_size/flags for all aspects of
an open file handle. Currently we're using 4 databases:
smbXsrv_open_global.tdb, leases.tdb, locking.tdb and brlock.tdb.

While at it also crank up the hashsize if the smbXsrv_tcon and smbXsrv_session
TDBs. The default TDB hash size is insanely small and disk space is cheap these
days, by going with the much larger hash size we get O(1) lookup instead of O(n)
for moderate to large loads with a few thousand objects.

Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Ralph Boehme &lt;slow@samba.org&gt;

Autobuild-User(master): Stefan Metzmacher &lt;metze@samba.org&gt;
Autobuild-Date(master): Mon Dec 19 16:40:15 UTC 2022 on sn-devel-184
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It's good to have a consistent set of hash_size/flags for all aspects of
an open file handle. Currently we're using 4 databases:
smbXsrv_open_global.tdb, leases.tdb, locking.tdb and brlock.tdb.

While at it also crank up the hashsize if the smbXsrv_tcon and smbXsrv_session
TDBs. The default TDB hash size is insanely small and disk space is cheap these
days, by going with the much larger hash size we get O(1) lookup instead of O(n)
for moderate to large loads with a few thousand objects.

Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Ralph Boehme &lt;slow@samba.org&gt;

Autobuild-User(master): Stefan Metzmacher &lt;metze@samba.org&gt;
Autobuild-Date(master): Mon Dec 19 16:40:15 UTC 2022 on sn-devel-184
</pre>
</div>
</content>
</entry>
<entry>
<title>smbd: Remove source3/smbd/statcache.c</title>
<updated>2022-12-14T22:54:29+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2022-12-14T12:58:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=c12518a9b6275602fd654a0dc47903d10843e91e'/>
<id>c12518a9b6275602fd654a0dc47903d10843e91e</id>
<content type='text'>
After I found that nobody calls stat_cache_add() anymore, there was no
reason to keep the rest of statcache.c.

Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
After I found that nobody calls stat_cache_add() anymore, there was no
reason to keep the rest of statcache.c.

Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>s3:locking: split out del_share_mode_open_id()</title>
<updated>2022-12-09T23:11:38+00:00</updated>
<author>
<name>Stefan Metzmacher</name>
<email>metze@samba.org</email>
</author>
<published>2019-10-11T15:42:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=8ccbbbd4ba4de405ce5bbf839e3aa0236aaf274b'/>
<id>8ccbbbd4ba4de405ce5bbf839e3aa0236aaf274b</id>
<content type='text'>
Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>s3/locking: Revert "s3:locking: Remove dead code"</title>
<updated>2022-12-09T23:11:38+00:00</updated>
<author>
<name>Ralph Boehme</name>
<email>slow@samba.org</email>
</author>
<published>2022-04-07T09:10:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=19a017496d65ba15d83ada8b9c98bf8d5f658e24'/>
<id>19a017496d65ba15d83ada8b9c98bf8d5f658e24</id>
<content type='text'>
This reverts commit de493a3e3b5b8d54f62c45072e27f2fefd4af43a:

    s3:locking: Remove dead code

    Found by Coverity.

    Signed-off-by: Andreas Schneider &lt;asn@samba.org&gt;
    Reviewed-by: Isaac Boukris &lt;iboukris@samba.org&gt;

dbwrap_do_locked() correctly returns saved_errno which is a possible
errno returned by close() inside fd_close_posix_fn().

Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit de493a3e3b5b8d54f62c45072e27f2fefd4af43a:

    s3:locking: Remove dead code

    Found by Coverity.

    Signed-off-by: Andreas Schneider &lt;asn@samba.org&gt;
    Reviewed-by: Isaac Boukris &lt;iboukris@samba.org&gt;

dbwrap_do_locked() correctly returns saved_errno which is a possible
errno returned by close() inside fd_close_posix_fn().

Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>s3:locking: re-add saved_errno handling to fd_close_posix()</title>
<updated>2022-12-09T23:11:37+00:00</updated>
<author>
<name>Stefan Metzmacher</name>
<email>metze@samba.org</email>
</author>
<published>2019-10-11T15:57:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=a9c6a329a255d678b62f617649ffcb436e532d01'/>
<id>a9c6a329a255d678b62f617649ffcb436e532d01</id>
<content type='text'>
Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>s3:locking: relax __SHARE_MODE_LOCK_SPACE check for 32bit platforms</title>
<updated>2022-11-24T11:01:37+00:00</updated>
<author>
<name>Stefan Metzmacher</name>
<email>metze@samba.org</email>
</author>
<published>2022-11-22T09:47:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=4c2e1d6259c4c06fce5d1333553b611ffd8f0ef4'/>
<id>4c2e1d6259c4c06fce5d1333553b611ffd8f0ef4</id>
<content type='text'>
sizeof(struct share_mode_lock) is only 28 bytes instead of 32 bytes
on 32bit systems...

Signed-off-by: Stefan Metzmacher &lt;metze@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>
sizeof(struct share_mode_lock) is only 28 bytes instead of 32 bytes
on 32bit systems...

Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Volker Lendecke &lt;vl@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>s3:locking: remove unused get_share_mode_lock()</title>
<updated>2022-09-20T01:34:55+00:00</updated>
<author>
<name>Stefan Metzmacher</name>
<email>metze@samba.org</email>
</author>
<published>2022-08-31T13:51:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=3b6255b5b902a062744912a6a3a82f7fb7279b23'/>
<id>3b6255b5b902a062744912a6a3a82f7fb7279b23</id>
<content type='text'>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125

Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;

Autobuild-User(master): Jeremy Allison &lt;jra@samba.org&gt;
Autobuild-Date(master): Tue Sep 20 01:34:55 UTC 2022 on sn-devel-184
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125

Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;

Autobuild-User(master): Jeremy Allison &lt;jra@samba.org&gt;
Autobuild-Date(master): Tue Sep 20 01:34:55 UTC 2022 on sn-devel-184
</pre>
</div>
</content>
</entry>
<entry>
<title>s3:locking: add share_mode_entry_prepare_{lock,unlock}() infrastructure</title>
<updated>2022-09-20T00:34:35+00:00</updated>
<author>
<name>Stefan Metzmacher</name>
<email>metze@samba.org</email>
</author>
<published>2022-08-29T11:44:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=775dc007d211b8153fbc5741f52dc77f92d9c314'/>
<id>775dc007d211b8153fbc5741f52dc77f92d9c314</id>
<content type='text'>
When adding or deleting share mode entries elements, we typically
have a pattern like this:

1. get the g_lock via get_[existing_]share_mode_lock()
2. do some checking of the existing record
3. add/delete a share_mode_entry to the record
4. do some vfs operations still protected by the g_lock
5. (optional) cleanup of the record on failure
6. release the g_lock

We can optimize this to:

- Run 1-3. under a tdb chainlock
- Only protect vfs operations with the g_lock
  if a new file was created/will be deleted
- Regrab the g_lock for a cleanup.

The new share_mode_entry_prepare_lock()
allows the caller to run a function within a tdb chainlock
similar to share_mode_do_locked_vfs_denied() where vfs calls are denied
and the execution is done within a tdb chainlock.

But the callback function is allowed to decide if it wants to
keep the lock at the g_lock layer on return.

The decision is kept in struct share_mode_entry_prepare_state,
which is then passed to share_mode_entry_prepare_unlock()
with an optional callback to do some cleanup under the
still existing g_lock or a regrabed g_lock.

In the ideal case the callback function passed to
share_mode_entry_prepare_lock() is able to decide that
it can drop the g_lock and the share_mode_entry_prepare_unlock().
gets a NULL callback as there's nothing to cleanup.
In this case share_mode_entry_prepare_unlock() is a noop.

This will allow us to avoid fallbacks to the dbwrap_watch based
waiting for the g_lock in the SMB2 Create and Close code paths.

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

Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When adding or deleting share mode entries elements, we typically
have a pattern like this:

1. get the g_lock via get_[existing_]share_mode_lock()
2. do some checking of the existing record
3. add/delete a share_mode_entry to the record
4. do some vfs operations still protected by the g_lock
5. (optional) cleanup of the record on failure
6. release the g_lock

We can optimize this to:

- Run 1-3. under a tdb chainlock
- Only protect vfs operations with the g_lock
  if a new file was created/will be deleted
- Regrab the g_lock for a cleanup.

The new share_mode_entry_prepare_lock()
allows the caller to run a function within a tdb chainlock
similar to share_mode_do_locked_vfs_denied() where vfs calls are denied
and the execution is done within a tdb chainlock.

But the callback function is allowed to decide if it wants to
keep the lock at the g_lock layer on return.

The decision is kept in struct share_mode_entry_prepare_state,
which is then passed to share_mode_entry_prepare_unlock()
with an optional callback to do some cleanup under the
still existing g_lock or a regrabed g_lock.

In the ideal case the callback function passed to
share_mode_entry_prepare_lock() is able to decide that
it can drop the g_lock and the share_mode_entry_prepare_unlock().
gets a NULL callback as there's nothing to cleanup.
In this case share_mode_entry_prepare_unlock() is a noop.

This will allow us to avoid fallbacks to the dbwrap_watch based
waiting for the g_lock in the SMB2 Create and Close code paths.

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

Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>s3:locking: optimize share_mode_do_locked_vfs_denied() with g_lock_lock callback</title>
<updated>2022-09-20T00:34:35+00:00</updated>
<author>
<name>Stefan Metzmacher</name>
<email>metze@samba.org</email>
</author>
<published>2022-08-29T10:50:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=cba169252ea270bb725ec06aff71d841492099f5'/>
<id>cba169252ea270bb725ec06aff71d841492099f5</id>
<content type='text'>
It means that in callers function will run under a single tdb chainlock,
which means callers from the outside will never see the record being
locked at g_lock level, as the g_lock is only held in memory.
within the single tdb chainlock. As a result we'll very unlikely hit
the case where we need to wait for a g_lock using the dbwrap_watch
logic.

Review with: git show -w

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

Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It means that in callers function will run under a single tdb chainlock,
which means callers from the outside will never see the record being
locked at g_lock level, as the g_lock is only held in memory.
within the single tdb chainlock. As a result we'll very unlikely hit
the case where we need to wait for a g_lock using the dbwrap_watch
logic.

Review with: git show -w

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

Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
