[SCM] Samba Shared Repository - branch v4-5-test updated

Karolin Seeger kseeger at samba.org
Tue May 9 12:35:02 UTC 2017


The branch, v4-5-test has been updated
       via  8d11ac4 samba-tool: let 'samba-tool user syncpasswords' report deletions immediately
       via  165cdf3 s3/smbd: update exclusive oplock optimisation to the lease area
       via  bce6578 s3/smbd: update exclusive oplock optimisation to the lease area
       via  88360c7 s3/locking: helper functions for lease types
       via  935fab0 s3/locking: add const to fsp_lease_type
      from  5542648 s3: smbd: inotify_map_mask_to_filter incorrectly indexes an array.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-5-test


- Log -----------------------------------------------------------------
commit 8d11ac4fb82dc67cbef4da27db03fa823a93be1b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Apr 25 13:25:57 2017 +0200

    samba-tool: let 'samba-tool user syncpasswords' report deletions immediately
    
    We need to use the show-recycled control in addition to the
    notification control in order to get notifications about deletions.
    
    There's no real problem as the next modification will report the deletion.
    But it might be delayed a few minutes.
    
    Note that show-recycled is a superset of show-deleted, so we only need one.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12767
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit afa15e6128473d3e4006f7cdc3762ab4c1cba05a)
    
    Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-5-test): Tue May  9 14:34:10 CEST 2017 on sn-devel-144

commit 165cdf380e6bed00c7e93eec27b0fbd48972ad4e
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 4 11:52:16 2017 +0200

    s3/smbd: update exclusive oplock optimisation to the lease area
    
    Update an optimisation in update_num_read_oplocks() that checks for
    exclusive oplocks to the lease area.
    
    The idea of the optimisation is to avoid expensive db queries in
    brlock.tdb if we *know* we're the only open.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=12766
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Sat May  6 22:58:47 CEST 2017 on sn-devel-144
    
    (cherry picked from commit a50343779a8a92d6f53095b36506b1d47ef68513)

commit bce657829f3dbd095ae1d8bab2683cd682428886
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Apr 20 21:37:37 2017 +0200

    s3/smbd: update exclusive oplock optimisation to the lease area
    
    This is similar to 9533a55ee5ffe430589dcea845851b84876ef656 but this
    time in the contend_level2_oplocks_begin_default() function.
    
    The idea of the optimisation is to avoid expensive db queries in
    locking.tdb if we *know* we're the only open.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=12766
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 0a4a08ad1cef3b7d6fd47df3a93c2c89dd287ee8)

commit 88360c7a8553261159ad81d64c96c79c6aacecac
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 4 11:50:56 2017 +0200

    s3/locking: helper functions for lease types
    
    Add some helper functions that will be used to update a bunch of checks
    for exclusive oplocks to the lease area.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=12766
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit f631e95e2de857ea98204609a71e6db00993994b)

commit 935fab0d03c7c648129e564b1f80fd357e7a72dc
Author: Ralph Boehme <slow at samba.org>
Date:   Thu May 4 11:50:01 2017 +0200

    s3/locking: add const to fsp_lease_type
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=12766
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 952701dce09b1ee89a0f6a450ac244fd6451955b)

-----------------------------------------------------------------------

Summary of changes:
 python/samba/netcmd/user.py   |  2 +-
 source3/locking/leases_util.c | 19 ++++++++++++++++++-
 source3/locking/proto.h       |  4 +++-
 source3/smbd/oplock.c         | 15 ++++++++++-----
 4 files changed, 32 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py
index 2cceea8..4f1bce8 100644
--- a/python/samba/netcmd/user.py
+++ b/python/samba/netcmd/user.py
@@ -1848,7 +1848,7 @@ samba-tool user syncpasswords --terminate \\
 
         def sync_loop(wait):
             notify_attrs = ["name", "uSNCreated", "uSNChanged", "objectClass"]
-            notify_controls = ["notification:1"]
+            notify_controls = ["notification:1", "show_recycled:1"]
             notify_handle = self.samdb.search_iterator(expression="objectClass=*",
                                                        scope=ldb.SCOPE_SUBTREE,
                                                        attrs=notify_attrs,
diff --git a/source3/locking/leases_util.c b/source3/locking/leases_util.c
index cb307c8..af1e837 100644
--- a/source3/locking/leases_util.c
+++ b/source3/locking/leases_util.c
@@ -46,10 +46,27 @@ uint32_t map_oplock_to_lease_type(uint16_t op_type)
 	return ret;
 }
 
-uint32_t fsp_lease_type(struct files_struct *fsp)
+uint32_t fsp_lease_type(const struct files_struct *fsp)
 {
 	if (fsp->oplock_type == LEASE_OPLOCK) {
 		return fsp->lease->lease.lease_state;
 	}
 	return map_oplock_to_lease_type(fsp->oplock_type);
 }
+
+uint32_t lease_type_is_exclusive(uint32_t lease_type)
+{
+	if ((lease_type & (SMB2_LEASE_READ | SMB2_LEASE_WRITE)) ==
+	    (SMB2_LEASE_READ | SMB2_LEASE_WRITE)) {
+		return true;
+	}
+
+	return false;
+}
+
+bool fsp_lease_type_is_exclusive(const struct files_struct *fsp)
+{
+	uint32_t lease_type = fsp_lease_type(fsp);
+
+	return lease_type_is_exclusive(lease_type);
+}
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index 17cb1cd..461f89a 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -250,6 +250,8 @@ bool release_posix_lock_posix_flavour(files_struct *fsp,
 
 /* The following definitions come from locking/leases_util.c */
 uint32_t map_oplock_to_lease_type(uint16_t op_type);
-uint32_t fsp_lease_type(struct files_struct *fsp);
+uint32_t fsp_lease_type(const struct files_struct *fsp);
+uint32_t lease_type_is_exclusive(uint32_t lease_type);
+bool fsp_lease_type_is_exclusive(const struct files_struct *fsp);
 
 #endif /* _LOCKING_PROTO_H_ */
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 57b53f8..ff7c037 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -165,13 +165,18 @@ bool update_num_read_oplocks(files_struct *fsp, struct share_mode_lock *lck)
 	uint32_t num_read_oplocks = 0;
 	uint32_t i;
 
-	if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
+	if (fsp_lease_type_is_exclusive(fsp)) {
 		/*
-		 * If we're the only one, we don't need a brlock entry
+		 * If we're fully exclusive, we don't need a brlock entry
 		 */
 		remove_stale_share_mode_entries(d);
-		SMB_ASSERT(d->num_share_modes == 1);
-		SMB_ASSERT(EXCLUSIVE_OPLOCK_TYPE(d->share_modes[0].op_type));
+
+		for (i=0; i<d->num_share_modes; i++) {
+			struct share_mode_entry *e = &d->share_modes[i];
+			uint32_t e_lease_type = get_lease_type(d, e);
+
+			SMB_ASSERT(lease_type_is_exclusive(e_lease_type));
+		}
 		return true;
 	}
 
@@ -1043,7 +1048,7 @@ static void contend_level2_oplocks_begin_default(files_struct *fsp,
 	 * the shared memory area whilst doing this.
 	 */
 
-	if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
+	if (fsp_lease_type_is_exclusive(fsp)) {
 		/*
 		 * There can't be any level2 oplocks, we're alone.
 		 */


-- 
Samba Shared Repository



More information about the samba-cvs mailing list