[SCM] Samba Shared Repository - branch master updated

Christian Ambach ambi at samba.org
Thu Aug 16 11:45:02 MDT 2012


The branch, master has been updated
       via  cbe2510 s3-g_lock: Make g_lock_lock more robust
       via  b83cd05 s3-msg: For msg_channel, correct the talloc hierarchy
       via  8e50ff0 s3-msg: Rename msg_channel_init_destructor
       via  c2b29de s3-autoconf: Fix deps for dbwrap_torture
       via  494003f s3-g_lock: Properly free "rec" on retry to avoid deadlock
       via  7c56d80 s3:brlock: give traverse_fn a proper name
       via  6e39011 s3:vfs_gpfs: make sure parameters are set correctly for leases
       via  a8b5830 s3:vfs_gpfs: Fix compile error in gpfs module
      from  56fc7bc libcli/smb: support broken OS/2 error responses bug #9096

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit cbe25105c7fc51b178bf4df217812ccf48c472a1
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 10 17:00:38 2012 +0200

    s3-g_lock: Make g_lock_lock more robust
    
    If for some reason the cleanup of dbwrap_watch_send does not work
    properly, we might starve indefinitely. Make the lock routine more
    robust by retrying every 5-10 seconds. g_lock_trylock will clean up
    orphaned entries.
    
    Signed-off-by: Christian Ambach <ambi at samba.org>
    
    Autobuild-User(master): Christian Ambach <ambi at samba.org>
    Autobuild-Date(master): Thu Aug 16 19:44:00 CEST 2012 on sn-devel-104

commit b83cd05ce1ff3357428cbc789ac4dbd08aa706ec
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 10 15:24:23 2012 +0200

    s3-msg: For msg_channel, correct the talloc hierarchy
    
    talloc_free() of a channel must free all immediate requests that have
    piled up
    
    Signed-off-by: Christian Ambach <ambi at samba.org>

commit 8e50ff02f1e0b1b95418d80ab61ffeb474de13eb
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 10 14:54:37 2012 +0200

    s3-msg: Rename msg_channel_init_destructor
    
    Signed-off-by: Christian Ambach <ambi at samba.org>

commit c2b29de2b1b0456cb21c64bf394149c652837c69
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 10 14:29:44 2012 +0200

    s3-autoconf: Fix deps for dbwrap_torture
    
    Signed-off-by: Christian Ambach <ambi at samba.org>

commit 494003fb67ea433b1da07898a3bf6c5e0c3152ce
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 10 13:42:51 2012 +0200

    s3-g_lock: Properly free "rec" on retry to avoid deadlock
    
    Signed-off-by: Christian Ambach <ambi at samba.org>

commit 7c56d80bee60895391fdec3f8f3f11d38a492190
Author: Christian Ambach <ambi at samba.org>
Date:   Wed Aug 8 17:46:59 2012 +0200

    s3:brlock: give traverse_fn a proper name

commit 6e3901194bbd74e2f5e7a0f0928c52da92e729c1
Author: Christian Ambach <ambi at samba.org>
Date:   Tue Aug 7 18:42:39 2012 +0200

    s3:vfs_gpfs: make sure parameters are set correctly for leases
    
    gpfs:leases requires kernel oplocks = yes and level2 oplocks = no
    to work properly
    
    make sure those are set correctly for a share

commit a8b583089bfa2d4f7f9f4d0aba0f0640ef1ad959
Author: Christof Schmitt <christof.schmitt at us.ibm.com>
Date:   Mon Oct 24 16:52:50 2011 -0700

    s3:vfs_gpfs: Fix compile error in gpfs module
    
    Fix this compile error by adding fcntl.h as a include that defines F_RDLCK
    and F_WRLCK:
    
    modules/gpfs.c: In function ‘set_gpfs_lease’:
    modules/gpfs.c:102: error: ‘F_RDLCK’ undeclared (first use in this function)
    modules/gpfs.c:102: error: (Each undeclared identifier is reported only once
    modules/gpfs.c:102: error: for each function it appears in.)
    modules/gpfs.c:105: error: ‘F_WRLCK’ undeclared (first use in this function)

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

Summary of changes:
 source3/Makefile.in        |    2 +-
 source3/lib/g_lock.c       |   25 +++++++++++++++++++++++++
 source3/lib/msg_channel.c  |    8 ++++----
 source3/locking/brlock.c   |    4 ++--
 source3/modules/gpfs.c     |    1 +
 source3/modules/vfs_gpfs.c |   25 +++++++++++++++++++++++++
 6 files changed, 58 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index 38e8bb1..b8b055a 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -3018,7 +3018,7 @@ bin/dbwrap_tool: $(DBWRAP_TOOL_OBJ) $(LIBTALLOC) $(LIBTDB)
 install-dbwrap_tool:: bin/dbwrap_tool
 	@$(SHELL) script/installbin.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) $(BINDIR) $<
 
-bin/dbwrap_torture: $(DBWRAP_TORTURE_OBJ) $(LIBTALLOC) $(LIBTDB)
+bin/dbwrap_torture: $(DBWRAP_TORTURE_OBJ) $(LIBTALLOC) $(LIBTDB) $(POPT_LIBS)
 	@echo "Linking $@"
 	@$(CC) -o $@ $(DBWRAP_TORTURE_OBJ)\
 		$(LDFLAGS) $(DYNEXP) $(LIBS) \
diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index d505b6b..4535b35 100644
--- a/source3/lib/g_lock.c
+++ b/source3/lib/g_lock.c
@@ -227,6 +227,12 @@ struct tevent_req *g_lock_lock_send(TALLOC_CTX *mem_ctx,
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
 	}
+	if (!tevent_req_set_endtime(
+		    subreq, state->ev,
+		    timeval_current_ofs(5 + sys_random() % 5, 0))) {
+		tevent_req_oom(req);
+		return tevent_req_post(req, ev);
+	}
 	tevent_req_set_callback(subreq, g_lock_lock_retry, req);
 	return req;
 }
@@ -243,6 +249,18 @@ static void g_lock_lock_retry(struct tevent_req *subreq)
 
 	status = dbwrap_record_watch_recv(subreq, talloc_tos(), &rec);
 	TALLOC_FREE(subreq);
+
+	if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
+		rec = dbwrap_fetch_locked(
+			state->ctx->db, talloc_tos(),
+			string_term_tdb_data(state->name));
+		if (rec == NULL) {
+			status = map_nt_error_from_unix(errno);
+		} else {
+			status = NT_STATUS_OK;
+		}
+	}
+
 	if (tevent_req_nterror(req, status)) {
 		return;
 	}
@@ -259,9 +277,16 @@ static void g_lock_lock_retry(struct tevent_req *subreq)
 	}
 	subreq = dbwrap_record_watch_send(state, state->ev, rec,
 					  state->ctx->msg);
+	TALLOC_FREE(rec);
 	if (tevent_req_nomem(subreq, req)) {
 		return;
 	}
+	if (!tevent_req_set_endtime(
+		    subreq, state->ev,
+		    timeval_current_ofs(5 + sys_random() % 5, 0))) {
+		tevent_req_oom(req);
+		return;
+	}
 	tevent_req_set_callback(subreq, g_lock_lock_retry, req);
 	return;
 
diff --git a/source3/lib/msg_channel.c b/source3/lib/msg_channel.c
index 6b3295f..c68c11e 100644
--- a/source3/lib/msg_channel.c
+++ b/source3/lib/msg_channel.c
@@ -44,7 +44,7 @@ static void msg_channel_init_got_msg(struct messaging_context *msg,
 static void msg_channel_trigger(struct tevent_context *ev,
 				struct tevent_immediate *im,
 				void *priv);
-static int msg_channel_init_destructor(struct msg_channel *s);
+static int msg_channel_destructor(struct msg_channel *s);
 
 struct tevent_req *msg_channel_init_send(TALLOC_CTX *mem_ctx,
 				    struct tevent_context *ev,
@@ -105,11 +105,11 @@ static void msg_channel_init_got_ctdb(struct tevent_req *subreq)
 		tevent_req_error(req, map_errno_from_nt_status(status));
 		return;
 	}
-	talloc_set_destructor(s, msg_channel_init_destructor);
+	talloc_set_destructor(s, msg_channel_destructor);
 	tevent_req_done(req);
 }
 
-static int msg_channel_init_destructor(struct msg_channel *s)
+static int msg_channel_destructor(struct msg_channel *s)
 {
 	messaging_deregister(s->msg, s->msg_type, s);
 	return 0;
@@ -196,7 +196,7 @@ static void msg_channel_init_got_msg(struct messaging_context *msg,
 		return;
 	}
 
-	im = tevent_create_immediate(s->ev);
+	im = tevent_create_immediate(s);
 	if (im == NULL) {
 		goto fail;
 	}
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index efde599..e9c073b 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -1587,7 +1587,7 @@ struct brl_forall_cb {
  on each lock.
 ****************************************************************************/
 
-static int traverse_fn(struct db_record *rec, void *state)
+static int brl_traverse_fn(struct db_record *rec, void *state)
 {
 	struct brl_forall_cb *cb = (struct brl_forall_cb *)state;
 	struct lock_struct *locks;
@@ -1666,7 +1666,7 @@ int brl_forall(void (*fn)(struct file_id id, struct server_id pid,
 	}
 	cb.fn = fn;
 	cb.private_data = private_data;
-	status = dbwrap_traverse(brlock_db, traverse_fn, &cb, &count);
+	status = dbwrap_traverse(brlock_db, brl_traverse_fn, &cb, &count);
 
 	if (!NT_STATUS_IS_OK(status)) {
 		return -1;
diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c
index 2cbf0b5..db60256 100644
--- a/source3/modules/gpfs.c
+++ b/source3/modules/gpfs.c
@@ -21,6 +21,7 @@
 #include "system/filesys.h"
 #include "smbd/smbd.h"
 
+#include <fcntl.h>
 #include "libcli/security/security.h"
 #include "gpfs_fcntl.h"
 #include "gpfs_gpl.h"
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 874d00d..a988c09 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -1505,6 +1505,31 @@ static int vfs_gpfs_connect(struct vfs_handle_struct *handle,
 				NULL, struct gpfs_config_data,
 				return -1);
 
+	if (config->leases) {
+		/*
+		 * GPFS lease code is based on kernel oplock code
+		 * so make sure it is turned on
+		 */
+		if (!lp_kernel_oplocks(SNUM(handle->conn))) {
+			DEBUG(5, ("Enabling kernel oplocks for "
+				  "gpfs:leases to work\n"));
+			lp_do_parameter(SNUM(handle->conn), "kernel oplocks",
+					"true");
+		}
+
+		/*
+		 * as the kernel does not properly support Level II oplocks
+		 * and GPFS leases code is based on kernel infrastructure, we
+		 * need to turn off Level II oplocks if gpfs:leases is enabled
+		 */
+		if (lp_level2_oplocks(SNUM(handle->conn))) {
+			DEBUG(5, ("gpfs:leases are enabled, disabling "
+				  "Level II oplocks\n"));
+			lp_do_parameter(SNUM(handle->conn), "level2 oplocks",
+					"false");
+		}
+	}
+
 	return 0;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list