[SCM] Samba Shared Repository - branch master updated
Rusty Russell
rusty at samba.org
Sat Mar 23 02:40:01 MDT 2013
The branch, master has been updated
via 068e0e2 ntdb: don't call open hook when re-opening an existing database.
via fd6d036 vfs_btrfs: fix compile on 32-bit platforms.
from 12ebb1b smbd: Tune "dir" a bit.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 068e0e2b38fb109eb1d1306c6d74bfa86ec0c4b8
Author: Rusty Russell <rusty at rustcorp.com.au>
Date: Sat Mar 23 17:27:57 2013 +1030
ntdb: don't call open hook when re-opening an existing database.
In particular, the Samba dbwrap wrapper can do this for schannel_store,
with the openhook set to clear the database if it can get the lock
(which, being in the same process, it can).
Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
Autobuild-User(master): Rusty Russell <rusty at rustcorp.com.au>
Autobuild-Date(master): Sat Mar 23 09:39:50 CET 2013 on sn-devel-104
commit fd6d0361d6fef5f8175967ddbae4a2b1d79dfcad
Author: Rusty Russell <rusty at rustcorp.com.au>
Date: Sat Mar 23 17:26:57 2013 +1030
vfs_btrfs: fix compile on 32-bit platforms.
uint64_t are not unsigned longs on 32-bit platforms:
[3265/3996] Compiling source3/modules/vfs_btrfs.c
../source3/modules/vfs_btrfs.c: In function ‘btrfs_copy_chunk_send’:
../source3/modules/vfs_btrfs.c:118:3: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Werror=format]
../source3/modules/vfs_btrfs.c:118:3: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int64_t’ [-Werror=format]
../source3/modules/vfs_btrfs.c:118:3: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint64_t’ [-Werror=format]
../source3/modules/vfs_btrfs.c:118:3: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 7 has type ‘uint64_t’ [-Werror=format]
../source3/modules/vfs_btrfs.c: In function ‘btrfs_copy_chunk_recv’:
../source3/modules/vfs_btrfs.c:180:2: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘off_t’ [-Werror=format]
cc1: some warnings being treated as errors
Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
-----------------------------------------------------------------------
Summary of changes:
lib/ntdb/open.c | 22 +++++++++++-----------
lib/ntdb/test/api-83-openhook.c | 13 +++++++++++--
source3/modules/vfs_btrfs.c | 9 +++++----
3 files changed, 27 insertions(+), 17 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/ntdb/open.c b/lib/ntdb/open.c
index abec117..2a265af 100644
--- a/lib/ntdb/open.c
+++ b/lib/ntdb/open.c
@@ -679,6 +679,17 @@ _PUBLIC_ struct ntdb_context *ntdb_open(const char *name, int ntdb_flags,
ntdb->file->device = st.st_dev;
ntdb->file->inode = st.st_ino;
+
+ /* call their open hook if they gave us one. */
+ if (ntdb->openhook) {
+ ecode = ntdb->openhook(ntdb->file->fd, ntdb->openhook_data);
+ if (ecode != NTDB_SUCCESS) {
+ ntdb_logerr(ntdb, ecode, NTDB_LOG_ERROR,
+ "ntdb_open: open hook failed");
+ goto fail;
+ }
+ open_flags |= O_CREAT;
+ }
} else {
/* ensure there is only one process initialising at once */
ecode = ntdb_lock_open(ntdb, openlock,
@@ -689,17 +700,6 @@ _PUBLIC_ struct ntdb_context *ntdb_open(const char *name, int ntdb_flags,
}
}
- /* call their open hook if they gave us one. */
- if (ntdb->openhook) {
- ecode = ntdb->openhook(ntdb->file->fd, ntdb->openhook_data);
- if (ecode != NTDB_SUCCESS) {
- ntdb_logerr(ntdb, ecode, NTDB_LOG_ERROR,
- "ntdb_open: open hook failed");
- goto fail;
- }
- open_flags |= O_CREAT;
- }
-
/* If they used O_TRUNC, read will return 0. */
rlen = pread(ntdb->file->fd, &hdr, sizeof(hdr), 0);
if (rlen == 0 && (open_flags & O_CREAT)) {
diff --git a/lib/ntdb/test/api-83-openhook.c b/lib/ntdb/test/api-83-openhook.c
index 31c789e..3816eef 100644
--- a/lib/ntdb/test/api-83-openhook.c
+++ b/lib/ntdb/test/api-83-openhook.c
@@ -44,7 +44,7 @@ static enum NTDB_ERROR clear_if_first(int fd, void *arg)
int main(int argc, char *argv[])
{
unsigned int i;
- struct ntdb_context *ntdb;
+ struct ntdb_context *ntdb, *ntdb2;
struct agent *agent;
union ntdb_attribute cif;
NTDB_DATA key = ntdb_mkdata(KEY_STR, strlen(KEY_STR));
@@ -57,7 +57,7 @@ int main(int argc, char *argv[])
cif.openhook.data = clear_if_first;
agent = prepare_external_agent();
- plan_tests(sizeof(flags) / sizeof(flags[0]) * 13);
+ plan_tests(sizeof(flags) / sizeof(flags[0]) * 16);
for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
/* Create it */
ntdb = ntdb_open("run-83-openhook.ntdb", flags[i]|MAYBE_NOSYNC,
@@ -83,6 +83,15 @@ int main(int argc, char *argv[])
/* Still exists for us too. */
ok1(ntdb_exists(ntdb, key));
+ /* Nested open should not erase db. */
+ ntdb2 = ntdb_open("run-83-openhook.ntdb", flags[i]|MAYBE_NOSYNC,
+ O_RDWR, 0, &cif);
+ ok1(ntdb_exists(ntdb2, key));
+ ok1(ntdb_exists(ntdb, key));
+ ntdb_close(ntdb2);
+
+ ok1(ntdb_exists(ntdb, key));
+
/* Close it, now agent should clear it. */
ntdb_close(ntdb);
diff --git a/source3/modules/vfs_btrfs.c b/source3/modules/vfs_btrfs.c
index 660bc68..eed5456 100644
--- a/source3/modules/vfs_btrfs.c
+++ b/source3/modules/vfs_btrfs.c
@@ -117,9 +117,9 @@ static struct tevent_req *btrfs_copy_chunk_send(struct vfs_handle_struct *handle
*/
DEBUG(5, ("BTRFS_IOC_CLONE_RANGE failed: %s, length %lu, "
"src fd: %ld off: %lu, dest fd: %d off: %lu\n",
- strerror(errno), cr_args.src_length,
- cr_args.src_fd, cr_args.src_offset,
- dest_fsp->fh->fd, cr_args.dest_offset));
+ strerror(errno), (long)cr_args.src_length,
+ (long)cr_args.src_fd, (long)cr_args.src_offset,
+ dest_fsp->fh->fd, (long)cr_args.dest_offset));
cc_state->subreq = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle,
cc_state, ev,
src_fsp,
@@ -177,7 +177,8 @@ static NTSTATUS btrfs_copy_chunk_recv(struct vfs_handle_struct *handle,
return status;
}
- DEBUG(10, ("server side copy chunk copied %lu\n", cc_state->copied));
+ DEBUG(10, ("server side copy chunk copied %lu\n",
+ (long)cc_state->copied));
*copied = cc_state->copied;
tevent_req_received(req);
return NT_STATUS_OK;
--
Samba Shared Repository
More information about the samba-cvs
mailing list