[PATCHES] Add 'net tdb' command to allow debugging of contended records in locking.tdb
vl at samba.org
vl at samba.org
Tue Apr 25 11:09:14 UTC 2017
Hi, Christof!
On Thu, Apr 13, 2017 at 01:00:19PM -0700, Christof Schmitt via samba-technical wrote:
> One problem in cluster environments can be contended access to the same
> file, in which case ctdb has to transfer the locking.tdb record across
> nodes for every open and close of that file.
Attached find two patches that you might want to take into
consideration. I haven't run a full autobuild on the patches, but if
you find my two to-SQUASH patches acceptable, Reviewed-By: me.
Volker
-------------- next part --------------
From d910a2704aed7d389ce22f651c87d03e7ed41f1c Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 25 Apr 2017 13:04:38 +0200
Subject: [PATCH 1/2] SQ: "-e" is not valid in a posix shell according to susv4
susv4 recommends printf as a replacement
---
source3/script/tests/test_net_tdb.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/script/tests/test_net_tdb.sh b/source3/script/tests/test_net_tdb.sh
index 801b076..731cad3 100755
--- a/source3/script/tests/test_net_tdb.sh
+++ b/source3/script/tests/test_net_tdb.sh
@@ -34,7 +34,7 @@ incdir=`dirname $0`/../../../testprogs/blackbox
touch $LOCALPATH/$FILENAME
-echo -e "open ${FILENAME}\n"'!sleep 10' | \
+printf "open %s\n"'!sleep 10'"\n" ${FILENAME} | \
$SMBCLIENT //$SERVER/$SHARE -U$USER%$PASS &
SMBCLIENTPID=$!
--
2.1.4
From 3fdfbce4e56c732b8333366ee5985f9360f241db Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 25 Apr 2017 13:05:39 +0200
Subject: [PATCH 2/2] SQ: Avoid a crash in "net tdb dump" if locking_init fails
---
source3/utils/net_tdb.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/source3/utils/net_tdb.c b/source3/utils/net_tdb.c
index 410e4bb..a03cc0e 100644
--- a/source3/utils/net_tdb.c
+++ b/source3/utils/net_tdb.c
@@ -47,6 +47,7 @@ static int net_tdb_locking_fetch(TALLOC_CTX *mem_ctx, const char *hexkey,
{
DATA_BLOB blob;
struct file_id id;
+ bool ok;
blob = strhex_to_data_blob(mem_ctx, hexkey);
if (blob.length != sizeof(struct file_id)) {
@@ -56,7 +57,11 @@ static int net_tdb_locking_fetch(TALLOC_CTX *mem_ctx, const char *hexkey,
id = *(struct file_id *)blob.data;
- locking_init_readonly();
+ ok = locking_init_readonly();
+ if (!ok) {
+ d_printf("locking_init_readonly failed\n");
+ return -1;
+ }
*lock = fetch_share_mode_unlocked(mem_ctx, id);
--
2.1.4
More information about the samba-technical
mailing list