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

Karolin Seeger kseeger at samba.org
Fri Jul 18 21:26:04 MDT 2014


The branch, v4-1-test has been updated
       via  1a9a02d ldb-samba: fix a memory leak in ldif_canonicalise_objectCategory()
       via  6526cb7 s3: SMB2 : Fix leak of blocking lock records in the database.
       via  8fa384d s3: smb2: Simplify logic in reprocess_blocked_smb2_lock().
       via  ead305e s3: smb2: Remove unused code from remove_pending_lock().
      from  4c32263 selftest/knownfail: ignore samba3.smb2.oplock.exclusive5 failures in v4-1-*

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-1-test


- Log -----------------------------------------------------------------
commit 1a9a02d15a3684023d24b4c237d17a4ff832eff4
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jul 16 16:17:56 2014 +0200

    ldb-samba: fix a memory leak in ldif_canonicalise_objectCategory()
    
    Searches for '(objectCategory=Person)' will leak a ldb_dn structure
    on the ldb_context. These searches are typically used by Zarafa.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10469
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Thu Jul 17 00:51:57 CEST 2014 on sn-devel-104
    
    (cherry picked from commit 8d33cddcb001a5a78aca036161d6223268274211)
    
    Autobuild-User(v4-1-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-1-test): Sat Jul 19 05:25:12 CEST 2014 on sn-devel-104

commit 6526cb7a94a12bf911c58072debb7aec69975dd0
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jun 26 12:08:46 2014 -0700

    s3: SMB2 : Fix leak of blocking lock records in the database.
    
    Based on a fix from Hemanth Thummala <hemanth.thummala at gmail.com>
    Bug #10673 - Increasing response times for byte range unlock requests.
    
    The previous refactoring makes it obvious we need to call
    remove_pending_lock() in all places where we are returning
    from the SMB2 blocking lock call.
    
    https://bugzilla.samba.org/show_bug.cgi?id=10673
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Mon Jun 30 14:59:16 CEST 2014 on sn-devel-104
    
    (cherry picked from commit cee1531e551e5ccd5ccd4a55de226ad686919486)

commit 8fa384d0bd25635ed0c7953a6efc380ba391ebaa
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jun 26 12:01:56 2014 -0700

    s3: smb2: Simplify logic in reprocess_blocked_smb2_lock().
    
    SMB2 blocking locks can only have one lock per request, so
    there can never be any other locks to wait for.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit 1a02a1e6aa15c028a848585d66cecbbdda8015b3)

commit ead305e1ad0ea57dec62075905e97475378b40b9
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jun 25 17:10:45 2014 -0700

    s3: smb2: Remove unused code from remove_pending_lock().
    
    SMB2 blocking locks can only have one lock per request, so
    there can never be any previous locks to remove.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit 508c09c6a019458bb0290fbf284e73c24feddb0e)

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

Summary of changes:
 lib/ldb-samba/ldif_handlers.c |    7 +++-
 source3/smbd/smb2_lock.c      |   69 +++++++++++++++-------------------------
 2 files changed, 32 insertions(+), 44 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb-samba/ldif_handlers.c b/lib/ldb-samba/ldif_handlers.c
index c7385f6..93cce29 100644
--- a/lib/ldb-samba/ldif_handlers.c
+++ b/lib/ldb-samba/ldif_handlers.c
@@ -483,8 +483,13 @@ static int ldif_canonicalise_objectCategory(struct ldb_context *ldb, void *mem_c
 		const char *lDAPDisplayName = talloc_strndup(tmp_ctx, (char *)in->data, in->length);
 		sclass = dsdb_class_by_lDAPDisplayName(schema, lDAPDisplayName);
 		if (sclass) {
-			struct ldb_dn *dn = ldb_dn_new(mem_ctx, ldb,  
+			struct ldb_dn *dn = ldb_dn_new(tmp_ctx, ldb,
 						       sclass->defaultObjectCategory);
+			if (dn == NULL) {
+				talloc_free(tmp_ctx);
+				return LDB_ERR_OPERATIONS_ERROR;
+			}
+
 			*out = data_blob_string_const(ldb_dn_alloc_casefold(mem_ctx, dn));
 			talloc_free(tmp_ctx);
 
diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c
index 2ee7afa..52698f3 100644
--- a/source3/smbd/smb2_lock.c
+++ b/source3/smbd/smb2_lock.c
@@ -664,19 +664,6 @@ static void remove_pending_lock(struct smbd_smb2_lock_state *state,
 				blr);
 		TALLOC_FREE(br_lck);
 	}
-
-	/* Remove the locks we already got. */
-
-	for(i = blr->lock_num - 1; i >= 0; i--) {
-		struct smbd_lock_element *e = &state->locks[i];
-
-		do_unlock(blr->fsp->conn->sconn->msg_ctx,
-			blr->fsp,
-			e->smblctx,
-			e->count,
-			e->offset,
-			WINDOWS_LOCK);
-	}
 }
 
 /****************************************************************
@@ -690,6 +677,8 @@ static void reprocess_blocked_smb2_lock(struct smbd_smb2_request *smb2req,
 	NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
 	struct blocking_lock_record *blr = NULL;
 	struct smbd_smb2_lock_state *state = NULL;
+	struct byte_range_lock *br_lck = NULL;
+	struct smbd_lock_element *e = NULL;
 	files_struct *fsp = NULL;
 
 	if (!smb2req->subreq) {
@@ -703,34 +692,30 @@ static void reprocess_blocked_smb2_lock(struct smbd_smb2_request *smb2req,
 	blr = state->blr;
 	fsp = blr->fsp;
 
-	/* Try and finish off getting all the outstanding locks. */
-
-	for (; blr->lock_num < state->lock_count; blr->lock_num++) {
-		struct byte_range_lock *br_lck = NULL;
-		struct smbd_lock_element *e = &state->locks[blr->lock_num];
-
-		br_lck = do_lock(fsp->conn->sconn->msg_ctx,
-				fsp,
-				e->smblctx,
-				e->count,
-				e->offset,
-				e->brltype,
-				WINDOWS_LOCK,
-				true,
-				&status,
-				&blr->blocking_smblctx,
-				blr);
+	/* We can only have one blocked lock in SMB2. */
+	SMB_ASSERT(state->lock_count == 1);
+	SMB_ASSERT(blr->lock_num == 0);
 
-		TALLOC_FREE(br_lck);
+	/* Try and get the outstanding lock. */
+	e = &state->locks[blr->lock_num];
 
-		if (NT_STATUS_IS_ERR(status)) {
-			break;
-		}
-	}
+	br_lck = do_lock(fsp->conn->sconn->msg_ctx,
+			fsp,
+			e->smblctx,
+			e->count,
+			e->offset,
+			e->brltype,
+			WINDOWS_LOCK,
+			true,
+			&status,
+			&blr->blocking_smblctx,
+			blr);
+
+	TALLOC_FREE(br_lck);
 
-	if(blr->lock_num == state->lock_count) {
+	if (NT_STATUS_IS_OK(status)) {
 		/*
-		 * Success - we got all the locks.
+		 * Success - we got the lock.
 		 */
 
 		DEBUG(3,("reprocess_blocked_smb2_lock SUCCESS file = %s, "
@@ -739,6 +724,7 @@ static void reprocess_blocked_smb2_lock(struct smbd_smb2_request *smb2req,
 			fsp_fnum_dbg(fsp),
 			(int)state->lock_count));
 
+		remove_pending_lock(state, blr);
 		tevent_req_done(smb2req->subreq);
 		return;
 	}
@@ -755,7 +741,7 @@ static void reprocess_blocked_smb2_lock(struct smbd_smb2_request *smb2req,
         }
 
 	/*
-	 * We couldn't get the locks for this record on the list.
+	 * We couldn't get the lock for this record.
 	 * If the time has expired, return a lock error.
 	 */
 
@@ -767,18 +753,15 @@ static void reprocess_blocked_smb2_lock(struct smbd_smb2_request *smb2req,
 	}
 
 	/*
-	 * Still can't get all the locks - keep waiting.
+	 * Still can't get the lock - keep waiting.
 	 */
 
-	DEBUG(10,("reprocess_blocked_smb2_lock: only got %d locks of %d needed "
+	DEBUG(10,("reprocess_blocked_smb2_lock: failed to get lock "
 		"for file %s, %s. Still waiting....\n",
-		(int)blr->lock_num,
-		(int)state->lock_count,
 		fsp_str_dbg(fsp),
 		fsp_fnum_dbg(fsp)));
 
         return;
-
 }
 
 /****************************************************************


-- 
Samba Shared Repository


More information about the samba-cvs mailing list