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

Karolin Seeger kseeger at samba.org
Mon Oct 12 22:01:04 UTC 2015


The branch, v4-2-test has been updated
       via  dd39bd2 vfs_fruit: return value of ad_pack in vfs_fruit.c
       via  95b17d5 tdb: Fix bug 11381, deadlock
       via  0349f95 vfs_commit: set the fd on open before calling SMB_VFS_FSTAT
       via  ba280e6 s3:ctdbd_conn: make sure we destroy tevent_fd before closing the socket
      from  5bc3a2f kerberos: make sure we only use prompter type when available.

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


- Log -----------------------------------------------------------------
commit dd39bd23f52de21aa582e678c3f82bfe5b75b4c3
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Sep 27 12:11:31 2015 +0200

    vfs_fruit: return value of ad_pack in vfs_fruit.c
    
    ad_pack() in vfs_fruit.c returns false on failure and 0 on success -
    i.e. return value is interpreted as success even when it fails.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11543
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>
    
    Autobuild-User(master): Uri Simchoni <uri at samba.org>
    Autobuild-Date(master): Tue Oct  6 16:14:42 CEST 2015 on sn-devel-104
    
    (cherry picked from commit 5d7eaf959a0f11be878f698305fcb8908d7ba047)
    
    Autobuild-User(v4-2-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-2-test): Tue Oct 13 00:00:36 CEST 2015 on sn-devel-104

commit 95b17d59d16c119bcc674decf176ab583bb5ce2a
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jul 6 13:13:36 2015 +0200

    tdb: Fix bug 11381, deadlock
    
    This fixes a deadlock in tdb that is a bad interaction between tdb_lockall
    and tdb_traverse. This deadlock condition has been around even before
    tdb mutexes, it's just that the kernel fcntl EDEADLK detection protected
    us from this ABBA lock condition to become a real deadlock stalling
    processes. With tdb mutexes, this deadlock protection is gone, so we do
    lock dead.
    
    This patch glosses over this particular ABBA condition, making tdb with
    mutexes behave the same as tdb without mutexes. Admittedly this is no
    real fix, but it works around a real user's problem.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11381
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 1061a9cafda7d73ebcd2f74e69e74f4adc485d5d)

commit 0349f95f2fa2616f4f8c2e141c54f0e4583b5499
Author: Uri Simchoni <uri at samba.org>
Date:   Wed Oct 7 22:44:11 2015 +0300

    vfs_commit: set the fd on open before calling SMB_VFS_FSTAT
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11547
    
    Signed-off-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Oct  8 02:56:41 CEST 2015 on sn-devel-104
    
    (cherry picked from commit 5709dece4860f205e31309e31ec4e3e938d9f6a5)

commit ba280e61939dfe8c1dc0344a5687931e12ca4b66
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Oct 5 15:57:42 2015 +0200

    s3:ctdbd_conn: make sure we destroy tevent_fd before closing the socket
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: G√ľnther Deschner <gd at samba.org>
    (cherry picked from commit 70dbba96e311449575f571db68710584fc991234)

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

Summary of changes:
 lib/tdb/common/traverse.c    | 14 +++++++++++++-
 source3/lib/ctdbd_conn.c     |  6 +++++-
 source3/modules/vfs_commit.c | 11 ++++++++++-
 source3/modules/vfs_fruit.c  | 14 ++++++++------
 4 files changed, 36 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tdb/common/traverse.c b/lib/tdb/common/traverse.c
index 618670f..e18e3c3 100644
--- a/lib/tdb/common/traverse.c
+++ b/lib/tdb/common/traverse.c
@@ -245,13 +245,25 @@ _PUBLIC_ int tdb_traverse(struct tdb_context *tdb,
 		 tdb_traverse_func fn, void *private_data)
 {
 	struct tdb_traverse_lock tl = { NULL, 0, 0, F_WRLCK };
+	enum tdb_lock_flags lock_flags;
 	int ret;
 
 	if (tdb->read_only || tdb->traverse_read) {
 		return tdb_traverse_read(tdb, fn, private_data);
 	}
 
-	if (tdb_transaction_lock(tdb, F_WRLCK, TDB_LOCK_WAIT)) {
+	lock_flags = TDB_LOCK_WAIT;
+
+	if (tdb->allrecord_lock.count != 0) {
+		/*
+		 * This avoids a deadlock between tdb_lockall() and
+		 * tdb_traverse(). See
+		 * https://bugzilla.samba.org/show_bug.cgi?id=11381
+		 */
+		lock_flags = TDB_LOCK_NOWAIT;
+	}
+
+	if (tdb_transaction_lock(tdb, F_WRLCK, lock_flags)) {
 		return -1;
 	}
 
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index a26f410..94a3cde 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -498,7 +498,11 @@ static NTSTATUS ctdb_read_req(struct ctdbd_connection *conn, uint32_t reqid,
 
 static int ctdbd_connection_destructor(struct ctdbd_connection *c)
 {
-	close(c->fd);
+	TALLOC_FREE(c->fde);
+	if (c->fd != -1) {
+		close(c->fd);
+		c->fd = -1;
+	}
 	return 0;
 }
 /*
diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c
index a6bc2a4..f1e2743 100644
--- a/source3/modules/vfs_commit.c
+++ b/source3/modules/vfs_commit.c
@@ -230,7 +230,16 @@ static int commit_open(
         /* EOF commit modes require us to know the initial file size. */
         if (c && (c->on_eof != EOF_NONE)) {
                 SMB_STRUCT_STAT st;
-                if (SMB_VFS_FSTAT(fsp, &st) == -1) {
+		/*
+		 * Setting the fd of the FSP is a hack
+		 * but also practiced elsewhere -
+		 * needed for calling the VFS.
+		 */
+		fsp->fh->fd = fd;
+		if (SMB_VFS_FSTAT(fsp, &st) == -1) {
+			int saved_errno = errno;
+			SMB_VFS_CLOSE(fsp);
+			errno = saved_errno;
                         return -1;
                 }
 		c->eof = st.st_ex_size;
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index f60ec5e..461311c 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -566,7 +566,7 @@ static bool ad_pack(struct adouble *ad)
 	}
 	RSSVAL(ad->ad_data, ADEDOFF_NENTRIES, nent);
 
-	return 0;
+	return true;
 }
 
 /**
@@ -947,8 +947,9 @@ static ssize_t ad_header_read_rsrc(struct adouble *ad, const char *path)
 			/*
 			 * Can't use ad_write() because we might not have a fsp
 			 */
-			rc = ad_pack(ad);
-			if (rc != 0) {
+			ok = ad_pack(ad);
+			if (!ok) {
+				rc = -1;
 				goto exit;
 			}
 			/* FIXME: direct sys_pwrite(), don't have an fsp */
@@ -1209,10 +1210,11 @@ static int ad_write(struct adouble *ad, const char *path)
 {
 	int rc = 0;
 	ssize_t len;
+	bool ok;
 
-	rc = ad_pack(ad);
-	if (rc != 0) {
-		goto exit;
+	ok = ad_pack(ad);
+	if (!ok) {
+		return -1;
 	}
 
 	switch (ad->ad_type) {


-- 
Samba Shared Repository



More information about the samba-cvs mailing list