[SCM] Samba Shared Repository - branch v4-5-test updated
Karolin Seeger
kseeger at samba.org
Thu Mar 23 16:09:02 UTC 2017
The branch, v4-5-test has been updated
via 8e8ebe5 Changes to make the Solaris C compiler happy.
via 968e3e2 Fix for Solaris C compiler.
via 19b6c87 ctdb-readonly: Avoid a tight loop waiting for revoke to complete
via 85e3446 s3:vfs_expand_msdfs: Do not open the remote address as a file
via 9533a55 s3: locking: Update oplock optimization for the leases era !
via cd86895 s3: locking: Move two leases functions into a new file.
from d537977 VERSION: Up to Samba 4.5.8.
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-5-test
- Log -----------------------------------------------------------------
commit 8e8ebe544730d76e9d15ff9512d514c854b51d29
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 16 09:17:51 2017 -0700
Changes to make the Solaris C compiler happy.
Fix Bug 12693 dbwrap_watch.c syntax error before or at: }
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12693
Signed-off-by: Tom schulz <schulz at adi.com>
Reviewed-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 2780a56d0bb7848e017314a033ef22ee944d8b05)
Autobuild-User(v4-5-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-5-test): Thu Mar 23 17:08:09 CET 2017 on sn-devel-144
commit 968e3e2fbf1020e4c44ac123f74c379373c76650
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 16 09:10:52 2017 -0700
Fix for Solaris C compiler.
Inspired by comment 4 in bug 12559.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12559
Signed-off-by: Tom Schulz <schulz at adi.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
(cherry picked from commit 59229276bcf5e2b7fa0ddf3ceb6fd3adccc01f9a)
commit 19b6c872bbe8bbc68aeee77e1123ce16d3577538
Author: Amitay Isaacs <amitay at gmail.com>
Date: Tue Mar 14 16:12:55 2017 +1100
ctdb-readonly: Avoid a tight loop waiting for revoke to complete
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12697
During revoking readonly delegations, if one of the nodes disappears, then
there is no point re-trying revoking readonly delegation. The database
needs to be recovered before the revoke operation can succeed. So retry
only after a grace period.
Signed-off-by: Amitay Isaacs <amitay at gmail.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Autobuild-User(master): Martin Schwenke <martins at samba.org>
Autobuild-Date(master): Fri Mar 17 14:05:57 CET 2017 on sn-devel-144
(cherry picked from commit ad758cb869ac83534993caa212abc9fe9905ec68)
commit 85e3446176786d0ec21138fe71de641e1401b1ae
Author: Andreas Schneider <asn at samba.org>
Date: Tue Mar 14 16:12:20 2017 +0100
s3:vfs_expand_msdfs: Do not open the remote address as a file
The arguments get passed in the wrong order to read_target_host().
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12687
Signed-off-by: Andreas Schneider <asn at samba.org>
(cherry picked from commit 1115f152de9ec25bc9e5e499874b4a7c92c888c0)
commit 9533a55ee5ffe430589dcea845851b84876ef656
Author: Jeremy Allison <jra at samba.org>
Date: Tue Mar 14 13:34:07 2017 -0700
s3: locking: Update oplock optimization for the leases era !
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12628
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Wed Mar 15 20:04:32 CET 2017 on sn-devel-144
(cherry picked from commit 1c4b15aa5f6707e7bcfc21435e26929fb7f45c0f)
commit cd86895e16ab66e003a51df8e80dcfb136654fd5
Author: Jeremy Allison <jra at samba.org>
Date: Tue Mar 14 13:23:13 2017 -0700
s3: locking: Move two leases functions into a new file.
map_oplock_to_lease_type(), fsp_lease_type().
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12628
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(back ported from commit 125c78ad0b8f9caaef1ba2f1aeb5ec593375fccd)
-----------------------------------------------------------------------
Summary of changes:
ctdb/server/ctdb_call.c | 8 +++---
source3/include/tldap.h | 6 +++++
source3/lib/dbwrap/dbwrap_watch.c | 2 +-
source3/locking/leases_util.c | 55 ++++++++++++++++++++++++++++++++++++++
source3/locking/locking.c | 22 ++++++++-------
source3/locking/proto.h | 4 +++
source3/modules/vfs_expand_msdfs.c | 3 +--
source3/smbd/files.c | 8 ------
source3/smbd/oplock.c | 22 ---------------
source3/smbd/proto.h | 2 --
source3/wscript_build | 6 +++++
11 files changed, 91 insertions(+), 47 deletions(-)
create mode 100644 source3/locking/leases_util.c
Changeset truncated at 500 lines:
diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c
index 3478419..f9c2922 100644
--- a/ctdb/server/ctdb_call.c
+++ b/ctdb/server/ctdb_call.c
@@ -1599,7 +1599,6 @@ static int deferred_call_destructor(struct revokechild_deferred_call *deferred_c
{
struct ctdb_context *ctdb = deferred_call->ctdb;
struct revokechild_requeue_handle *requeue_handle = talloc(ctdb, struct revokechild_requeue_handle);
- struct ctdb_req_call_old *c = (struct ctdb_req_call_old *)deferred_call->hdr;
requeue_handle->ctdb = ctdb;
requeue_handle->hdr = deferred_call->hdr;
@@ -1607,9 +1606,12 @@ static int deferred_call_destructor(struct revokechild_deferred_call *deferred_c
requeue_handle->ctx = deferred_call->ctx;
talloc_steal(requeue_handle, requeue_handle->hdr);
- /* when revoking, any READONLY requests have 1 second grace to let read/write finish first */
+ /* Always delay revoke requests. Either wait for the read/write
+ * operation to complete, or if revoking failed wait for recovery to
+ * complete
+ */
tevent_add_timer(ctdb->ev, requeue_handle,
- timeval_current_ofs(c->flags & CTDB_WANT_READONLY ? 1 : 0, 0),
+ timeval_current_ofs(1, 0),
deferred_call_requeue, requeue_handle);
return 0;
diff --git a/source3/include/tldap.h b/source3/include/tldap.h
index 74279a4..23e3f1b 100644
--- a/source3/include/tldap.h
+++ b/source3/include/tldap.h
@@ -47,9 +47,15 @@ struct tldap_mod {
DATA_BLOB *values;
};
+#if defined(HAVE_IMMEDIATE_STRUCTURES)
typedef struct { uint8_t rc; } TLDAPRC;
#define TLDAP_RC(x) ((TLDAPRC){.rc = x})
#define TLDAP_RC_V(x) ((x).rc)
+#else
+typedef uint8_t TLDAPRC;
+#define TLDAP_RC(x) (x)
+#define TLDAP_RC_V(x) (x)
+#endif
#define TLDAP_RC_EQUAL(x,y) (TLDAP_RC_V(x)==TLDAP_RC_V(y))
#define TLDAP_RC_IS_SUCCESS(x) TLDAP_RC_EQUAL(x,TLDAP_SUCCESS)
diff --git a/source3/lib/dbwrap/dbwrap_watch.c b/source3/lib/dbwrap/dbwrap_watch.c
index acc0f1a..6b91f4a 100644
--- a/source3/lib/dbwrap/dbwrap_watch.c
+++ b/source3/lib/dbwrap/dbwrap_watch.c
@@ -278,7 +278,7 @@ static struct db_record *dbwrap_watched_fetch_locked(
num_watchers = dbwrap_watched_parse(subrec_value, NULL, 0, NULL, NULL);
if (num_watchers == -1) {
/* Fresh or invalid record */
- rec->value = (TDB_DATA) {};
+ rec->value = (TDB_DATA) { 0 };
return rec;
}
diff --git a/source3/locking/leases_util.c b/source3/locking/leases_util.c
new file mode 100644
index 0000000..cb307c8
--- /dev/null
+++ b/source3/locking/leases_util.c
@@ -0,0 +1,55 @@
+/*
+ Unix SMB/CIFS implementation.
+ Lease utility functions
+
+ Copyright (C) Jeremy Allison 2017.
+ Copyright (C) Stefan (metze) Metzmacher 2017.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#define DBGC_CLASS DBGC_LOCKING
+#include "includes.h"
+#include "../librpc/gen_ndr/open_files.h"
+#include "locking/proto.h"
+
+uint32_t map_oplock_to_lease_type(uint16_t op_type)
+{
+ uint32_t ret;
+
+ switch(op_type) {
+ case BATCH_OPLOCK:
+ case BATCH_OPLOCK|EXCLUSIVE_OPLOCK:
+ ret = SMB2_LEASE_READ|SMB2_LEASE_WRITE|SMB2_LEASE_HANDLE;
+ break;
+ case EXCLUSIVE_OPLOCK:
+ ret = SMB2_LEASE_READ|SMB2_LEASE_WRITE;
+ break;
+ case LEVEL_II_OPLOCK:
+ ret = SMB2_LEASE_READ;
+ break;
+ default:
+ ret = SMB2_LEASE_NONE;
+ break;
+ }
+ return ret;
+}
+
+uint32_t fsp_lease_type(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);
+}
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 5a97460..e6d3918 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -118,17 +118,21 @@ bool strict_lock_default(files_struct *fsp, struct lock_struct *plock)
}
if (strict_locking == Auto) {
- if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type) &&
- (plock->lock_type == READ_LOCK ||
- plock->lock_type == WRITE_LOCK)) {
- DEBUG(10, ("is_locked: optimisation - exclusive oplock "
- "on file %s\n", fsp_str_dbg(fsp)));
+ uint32_t lease_type = fsp_lease_type(fsp);
+
+ if ((lease_type & SMB2_LEASE_READ) &&
+ (plock->lock_type == READ_LOCK))
+ {
+ DBG_DEBUG("optimisation - read lease on file %s\n",
+ fsp_str_dbg(fsp));
return true;
}
- if ((fsp->oplock_type == LEVEL_II_OPLOCK) &&
- (plock->lock_type == READ_LOCK)) {
- DEBUG(10, ("is_locked: optimisation - level II oplock "
- "on file %s\n", fsp_str_dbg(fsp)));
+
+ if ((lease_type & SMB2_LEASE_WRITE) &&
+ (plock->lock_type == WRITE_LOCK))
+ {
+ DBG_DEBUG("optimisation - write lease on file %s\n",
+ fsp_str_dbg(fsp));
return true;
}
}
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index 13499cf..17cb1cd 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -248,4 +248,8 @@ bool release_posix_lock_posix_flavour(files_struct *fsp,
const struct lock_struct *plocks,
int num_locks);
+/* 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);
+
#endif /* _LOCKING_PROTO_H_ */
diff --git a/source3/modules/vfs_expand_msdfs.c b/source3/modules/vfs_expand_msdfs.c
index eaf96e0..1aef24c 100644
--- a/source3/modules/vfs_expand_msdfs.c
+++ b/source3/modules/vfs_expand_msdfs.c
@@ -147,8 +147,7 @@ static char *expand_msdfs_target(TALLOC_CTX *ctx,
return NULL;
}
- targethost = read_target_host(
- ctx, raddr, mapfilename);
+ targethost = read_target_host(ctx, mapfilename, raddr);
if (targethost == NULL) {
DEBUG(1, ("Could not expand target host from file %s\n",
mapfilename));
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 1ef1bc9..6d0f05b 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -785,14 +785,6 @@ const struct GUID *fsp_client_guid(const files_struct *fsp)
return &fsp->conn->sconn->client->connections->smb2.client.guid;
}
-uint32_t fsp_lease_type(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);
-}
-
size_t fsp_fullbasepath(struct files_struct *fsp, char *buf, size_t buflen)
{
int len;
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 6d7d17f..57b53f8 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -149,28 +149,6 @@ static void downgrade_file_oplock(files_struct *fsp)
TALLOC_FREE(fsp->oplock_timeout);
}
-uint32_t map_oplock_to_lease_type(uint16_t op_type)
-{
- uint32_t ret;
-
- switch(op_type) {
- case BATCH_OPLOCK:
- case BATCH_OPLOCK|EXCLUSIVE_OPLOCK:
- ret = SMB2_LEASE_READ|SMB2_LEASE_WRITE|SMB2_LEASE_HANDLE;
- break;
- case EXCLUSIVE_OPLOCK:
- ret = SMB2_LEASE_READ|SMB2_LEASE_WRITE;
- break;
- case LEVEL_II_OPLOCK:
- ret = SMB2_LEASE_READ;
- break;
- default:
- ret = SMB2_LEASE_NONE;
- break;
- }
- return ret;
-}
-
uint32_t get_lease_type(const struct share_mode_data *d,
const struct share_mode_entry *e)
{
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 9301c78..277dc6e 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -409,7 +409,6 @@ NTSTATUS file_name_hash(connection_struct *conn,
NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
const struct smb_filename *smb_fname_in);
const struct GUID *fsp_client_guid(const files_struct *fsp);
-uint32_t fsp_lease_type(struct files_struct *fsp);
size_t fsp_fullbasepath(struct files_struct *fsp, char *buf, size_t buflen);
/* The following definitions come from smbd/ipc.c */
@@ -703,7 +702,6 @@ NTSTATUS get_relative_fid_filename(connection_struct *conn,
/* The following definitions come from smbd/oplock.c */
-uint32_t map_oplock_to_lease_type(uint16_t op_type);
uint32_t get_lease_type(const struct share_mode_data *d,
const struct share_mode_entry *e);
bool update_num_read_oplocks(files_struct *fsp, struct share_mode_lock *lck);
diff --git a/source3/wscript_build b/source3/wscript_build
index 2918975..9a196a2 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -629,6 +629,7 @@ bld.SAMBA3_LIBRARY('smbd_base',
RPC_SERVICE
NDR_SMBXSRV
LEASES_DB
+ LEASES_UTIL
LIBASYS
sysquotas
NDR_SMB_ACL
@@ -650,6 +651,7 @@ bld.SAMBA3_SUBSYSTEM('LOCKING',
tdb
talloc
LEASES_DB
+ LEASES_UTIL
NDR_OPEN_FILES
FNAME_UTIL''')
@@ -657,6 +659,10 @@ bld.SAMBA3_SUBSYSTEM('LEASES_DB',
source='locking/leases_db.c',
deps='NDR_LEASES_DB')
+bld.SAMBA3_SUBSYSTEM('LEASES_UTIL',
+ source='locking/leases_util.c',
+ deps='NDR_OPEN_FILES')
+
if bld.CONFIG_GET("WITH_PROFILE"):
bld.SAMBA3_SUBSYSTEM('PROFILE',
source='profile/profile.c',
--
Samba Shared Repository
More information about the samba-cvs
mailing list