From a622f80c658bb1d0639e9ebe3a2be7093f15ffc6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 24 Feb 2008 00:13:36 +0100 Subject: BASE-DEFER_OPEN: add torture:sharedelays option to run this test faster metze (This used to be commit 877cc375d0523cb31324a5d611e73d666e7a9a78) --- source4/torture/basic/base.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'source4') diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index aa729ec0df..42d7ddaaa1 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -633,6 +633,13 @@ static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli int retries=4; int i = 0; bool correct = true; + int nsec; + int msec; + double sec; + + nsec = torture_setting_int(tctx, "sharedelay", 1000000); + msec = nsec / 1000; + sec = ((double)nsec) / ((double) 1000000); if (retries <= 0) { torture_comment(tctx, "failed to connect\n"); @@ -657,9 +664,10 @@ static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli } if (NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) { double e = timeval_elapsed(&tv); - if (e < 0.5 || e > 1.5) { - torture_comment(tctx,"Timing incorrect %.2f violation\n", - e); + if (e < (0.5 * sec) || e > (1.5 * sec)) { + torture_comment(tctx,"Timing incorrect %.2f violation 1 sec == %.2f\n", + e, sec); + return false; } } } while (NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)); @@ -671,13 +679,13 @@ static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli torture_comment(tctx, "pid %u open %d\n", (unsigned)getpid(), i); - sleep(10); + msleep(10 * msec); i++; if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) { torture_comment(tctx,"Failed to close %s, error=%s\n", fname, smbcli_errstr(cli->tree)); return false; } - sleep(2); + msleep(2 * msec); } if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) { -- cgit From 77054b42bdfcd077ede8a5c29aead2807f016ecc Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 25 Feb 2008 07:42:38 +0100 Subject: selftest: we pass the BASE-DEFER_OPEN test We just need to pass the same sharedelay time to smbtorture as we use for smbd. metze (This used to be commit 3b78dc7ab2f8e3faffa2eb3ae2462c133e368be3) --- source4/samba4-skip | 2 -- source4/selftest/samba4_tests.sh | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'source4') diff --git a/source4/samba4-skip b/source4/samba4-skip index e3d2b182d1..541738ecc4 100644 --- a/source4/samba4-skip +++ b/source4/samba4-skip @@ -1,4 +1,3 @@ -base.defer_open base.delaywrite raw.composite raw.oplock @@ -18,7 +17,6 @@ base.smb smb2.notify smb2.scan ntvfs.cifs.base.charset -ntvfs.cifs.base.defer_open ntvfs.cifs.base.delaywrite ntvfs.cifs.base.iometer ntvfs.cifs.base.casetable diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index c57ec4d6bd..32386e5b9e 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -216,12 +216,13 @@ done plantest "rpc.echo on ncacn_np over smb2" dc $smb4torture ncacn_np:"\$SERVER[smb2]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN RPC-ECHO "$*" # Tests against the NTVFS POSIX backend +NTVFSARGS="--option=torture:sharedelay=100000" smb2=`$smb4torture --list | grep "^SMB2-" | xargs` raw=`$smb4torture --list | grep "^RAW-" | xargs` base=`$smb4torture --list | grep "^BASE-" | xargs` for t in $base $raw $smb2; do - plansmbtorturetest "$t" dc $ADDARGS //\$SERVER/tmp -U"\$USERNAME"%"\$PASSWORD" + plansmbtorturetest "$t" dc $ADDARGS //\$SERVER/tmp -U"\$USERNAME"%"\$PASSWORD" $NTVFSARGS done rap=`$smb4torture --list | grep "^RAP-" | xargs` @@ -231,7 +232,7 @@ done # Tests against the NTVFS CIFS backend for t in $base $raw; do - plantest "ntvfs.cifs.`normalize_testname $t`" dc $VALGRIND $smb4torture //\$NETBIOSNAME/cifs -U"\$USERNAME"%"\$PASSWORD" $t + plantest "ntvfs.cifs.`normalize_testname $t`" dc $VALGRIND $smb4torture //\$NETBIOSNAME/cifs -U"\$USERNAME"%"\$PASSWORD" $NTVFSARGS $t done # Local tests -- cgit From a64bd41601b9b50075e95ca50510f04cd2bb8454 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 23 Feb 2008 11:51:23 +0100 Subject: RAW-OPLOCK: fix typo (send oplock releases on the correct connection) metze (This used to be commit f6ecf59c7555917374fc9e5430034815fd4cd245) --- source4/torture/raw/oplock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c index 952088e46c..5ece01c505 100644 --- a/source4/torture/raw/oplock.c +++ b/source4/torture/raw/oplock.c @@ -914,7 +914,7 @@ static bool test_raw_oplock_batch10(struct torture_context *tctx, struct smbcli_ CHECK_VAL(break_info.failures, 0); CHECK_VAL(io.ntcreatex.out.oplock_level, 0); - smbcli_oplock_handler(cli2->transport, oplock_handler_ack_to_levelII, cli1->tree); + smbcli_oplock_handler(cli2->transport, oplock_handler_ack_to_levelII, cli2->tree); io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED | NTCREATEX_FLAGS_REQUEST_OPLOCK | -- cgit From 5dc8d3ed8b5a5e263a74f880f6fb1d88d27bd5c6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 23 Feb 2008 11:51:43 +0100 Subject: RAW-OPLOCK: remove unused var (This used to be commit 6820da44828172769d9fdfa161acf762e3937a88) --- source4/torture/raw/oplock.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source4') diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c index 5ece01c505..3edd0c6820 100644 --- a/source4/torture/raw/oplock.c +++ b/source4/torture/raw/oplock.c @@ -1058,7 +1058,7 @@ static bool test_raw_oplock_batch12(struct torture_context *tctx, struct smbcli_ bool ret = true; union smb_open io; union smb_setfileinfo sfi; - uint16_t fnum=0, fnum2=0; + uint16_t fnum=0; if (!torture_setup_dir(cli1, BASEDIR)) { return false; @@ -1118,7 +1118,6 @@ static bool test_raw_oplock_batch12(struct torture_context *tctx, struct smbcli_ CHECK_VAL(break_info.level, 0); smbcli_close(cli1->tree, fnum); - smbcli_close(cli2->tree, fnum2); done: smb_raw_exit(cli1->session); -- cgit From fb6f52261a4cdbc529c04e28b29f82a8cbb9640f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 21 Feb 2008 08:59:21 +0100 Subject: pvfs_wait: 'private' -> 'private_data' and use talloc_get_type() metze (This used to be commit 16a7d0cc37614fc41245fdcdf3b5a4a4a421f31d) --- source4/ntvfs/posix/pvfs_wait.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'source4') diff --git a/source4/ntvfs/posix/pvfs_wait.c b/source4/ntvfs/posix/pvfs_wait.c index 989985a033..838a801567 100644 --- a/source4/ntvfs/posix/pvfs_wait.c +++ b/source4/ntvfs/posix/pvfs_wait.c @@ -31,7 +31,7 @@ struct pvfs_wait { struct pvfs_wait *next, *prev; struct pvfs_state *pvfs; void (*handler)(void *, enum pvfs_wait_notice); - void *private; + void *private_data; int msg_type; struct messaging_context *msg_ctx; struct event_context *ev; @@ -45,20 +45,23 @@ struct pvfs_wait { previous ntvfs handlers in the chain (such as security context) */ NTSTATUS pvfs_async_setup(struct ntvfs_module_context *ntvfs, - struct ntvfs_request *req, void *private) + struct ntvfs_request *req, void *private_data) { - struct pvfs_wait *pwait = private; - pwait->handler(pwait->private, pwait->reason); + struct pvfs_wait *pwait = talloc_get_type(private_data, + struct pvfs_wait); + pwait->handler(pwait->private_data, pwait->reason); return NT_STATUS_OK; } /* receive a completion message for a wait */ -static void pvfs_wait_dispatch(struct messaging_context *msg, void *private, uint32_t msg_type, +static void pvfs_wait_dispatch(struct messaging_context *msg, + void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data) { - struct pvfs_wait *pwait = private; + struct pvfs_wait *pwait = talloc_get_type(private_data, + struct pvfs_wait); struct ntvfs_request *req; void *p = NULL; @@ -70,7 +73,7 @@ static void pvfs_wait_dispatch(struct messaging_context *msg, void *private, uin pp = (void **)data->data; p = *pp; } - if (p == NULL || p != pwait->private) { + if (p == NULL || p != pwait->private_data) { return; } @@ -91,9 +94,11 @@ static void pvfs_wait_dispatch(struct messaging_context *msg, void *private, uin receive a timeout on a message wait */ static void pvfs_wait_timeout(struct event_context *ev, - struct timed_event *te, struct timeval t, void *private) + struct timed_event *te, struct timeval t, + void *private_data) { - struct pvfs_wait *pwait = talloc_get_type(private, struct pvfs_wait); + struct pvfs_wait *pwait = talloc_get_type(private_data, + struct pvfs_wait); struct ntvfs_request *req = pwait->req; pwait->reason = PVFS_WAIT_TIMEOUT; @@ -131,7 +136,7 @@ void *pvfs_wait_message(struct pvfs_state *pvfs, int msg_type, struct timeval end_time, void (*fn)(void *, enum pvfs_wait_notice), - void *private) + void *private_data) { struct pvfs_wait *pwait; @@ -140,7 +145,7 @@ void *pvfs_wait_message(struct pvfs_state *pvfs, return NULL; } - pwait->private = private; + pwait->private_data = private_data; pwait->handler = fn; pwait->msg_ctx = pvfs->ntvfs->ctx->msg_ctx; pwait->ev = pvfs->ntvfs->ctx->event_ctx; -- cgit From a0a0d4a5d0c24729a26a37ff54caa665de9149a2 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 21 Feb 2008 09:02:17 +0100 Subject: pvfs_wait: use struct pvfs_wait * instead of void * metze (This used to be commit 3b70331536d2402814db13a9f1f226a39373313a) --- source4/ntvfs/posix/pvfs_lock.c | 2 +- source4/ntvfs/posix/pvfs_notify.c | 8 +++++--- source4/ntvfs/posix/pvfs_open.c | 2 +- source4/ntvfs/posix/pvfs_wait.c | 12 ++++++------ source4/ntvfs/posix/vfs_posix.h | 2 ++ 5 files changed, 15 insertions(+), 11 deletions(-) (limited to 'source4') diff --git a/source4/ntvfs/posix/pvfs_lock.c b/source4/ntvfs/posix/pvfs_lock.c index b9bb58c71d..df85b2b775 100644 --- a/source4/ntvfs/posix/pvfs_lock.c +++ b/source4/ntvfs/posix/pvfs_lock.c @@ -53,7 +53,7 @@ struct pvfs_pending_lock { struct pvfs_file *f; struct ntvfs_request *req; int pending_lock; - void *wait_handle; + struct pvfs_wait *wait_handle; struct timeval end_time; }; diff --git a/source4/ntvfs/posix/pvfs_notify.c b/source4/ntvfs/posix/pvfs_notify.c index 210f949395..06d2bc8e0c 100644 --- a/source4/ntvfs/posix/pvfs_notify.c +++ b/source4/ntvfs/posix/pvfs_notify.c @@ -268,9 +268,11 @@ NTSTATUS pvfs_notify(struct ntvfs_module_context *ntvfs, /* if the buffer is empty then start waiting */ if (f->notify_buffer->num_changes == 0) { - void *wait_handle = - pvfs_wait_message(pvfs, req, -1, timeval_zero(), - pvfs_notify_end, f->notify_buffer); + struct pvfs_wait *wait_handle; + wait_handle = pvfs_wait_message(pvfs, req, -1, + timeval_zero(), + pvfs_notify_end, + f->notify_buffer); NT_STATUS_HAVE_NO_MEMORY(wait_handle); talloc_steal(req, wait_handle); return NT_STATUS_OK; diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index 8558f0476a..3ccd239523 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -756,7 +756,7 @@ struct pvfs_open_retry { struct ntvfs_module_context *ntvfs; struct ntvfs_request *req; union smb_open *io; - void *wait_handle; + struct pvfs_wait *wait_handle; DATA_BLOB odb_locking_key; }; diff --git a/source4/ntvfs/posix/pvfs_wait.c b/source4/ntvfs/posix/pvfs_wait.c index 838a801567..291250befd 100644 --- a/source4/ntvfs/posix/pvfs_wait.c +++ b/source4/ntvfs/posix/pvfs_wait.c @@ -131,12 +131,12 @@ static int pvfs_wait_destructor(struct pvfs_wait *pwait) if msg_type == -1 then no message is registered, and it is assumed that the caller handles any messaging setup needed */ -void *pvfs_wait_message(struct pvfs_state *pvfs, - struct ntvfs_request *req, - int msg_type, - struct timeval end_time, - void (*fn)(void *, enum pvfs_wait_notice), - void *private_data) +struct pvfs_wait *pvfs_wait_message(struct pvfs_state *pvfs, + struct ntvfs_request *req, + int msg_type, + struct timeval end_time, + void (*fn)(void *, enum pvfs_wait_notice), + void *private_data) { struct pvfs_wait *pwait; diff --git a/source4/ntvfs/posix/vfs_posix.h b/source4/ntvfs/posix/vfs_posix.h index a660da329a..84c456dcfe 100644 --- a/source4/ntvfs/posix/vfs_posix.h +++ b/source4/ntvfs/posix/vfs_posix.h @@ -28,6 +28,8 @@ #include "ntvfs/common/ntvfs_common.h" #include "dsdb/samdb/samdb.h" +struct pvfs_wait; + /* this is the private structure for the posix vfs backend. It is used to hold per-connection (per tree connect) state information */ struct pvfs_state { -- cgit From 1cd2008aa49d38792f273bb28922d33b5b9b0066 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 21 Feb 2008 19:59:13 +0100 Subject: pvfs: pass NULL to pvfs_can_*() when no odb_lock is needed by the caller metze (This used to be commit e585e2306334bd919f567f53d8d08903dfdfb102) --- source4/ntvfs/posix/pvfs_rename.c | 11 ++++++----- source4/ntvfs/posix/pvfs_setfileinfo.c | 4 +--- source4/ntvfs/posix/pvfs_unlink.c | 6 ++---- 3 files changed, 9 insertions(+), 12 deletions(-) (limited to 'source4') diff --git a/source4/ntvfs/posix/pvfs_rename.c b/source4/ntvfs/posix/pvfs_rename.c index ea12f49333..5693e79314 100644 --- a/source4/ntvfs/posix/pvfs_rename.c +++ b/source4/ntvfs/posix/pvfs_rename.c @@ -192,8 +192,8 @@ static NTSTATUS pvfs_rename_one(struct pvfs_state *pvfs, { struct pvfs_filename *name1, *name2; TALLOC_CTX *mem_ctx = talloc_new(req); + struct odb_lock *lck = NULL; NTSTATUS status; - struct odb_lock *lck, *lck2; /* resolve the wildcard pattern for this name */ fname2 = pvfs_resolve_wildcard(mem_ctx, fname1, fname2); @@ -216,6 +216,7 @@ static NTSTATUS pvfs_rename_one(struct pvfs_state *pvfs, status = pvfs_can_rename(pvfs, req, name1, &lck); if (!NT_STATUS_IS_OK(status)) { + talloc_free(lck); goto failed; } @@ -223,7 +224,7 @@ static NTSTATUS pvfs_rename_one(struct pvfs_state *pvfs, status = pvfs_resolve_partial(pvfs, mem_ctx, dir_path, fname2, &name2); if (NT_STATUS_IS_OK(status)) { - status = pvfs_can_delete(pvfs, req, name2, &lck2); + status = pvfs_can_delete(pvfs, req, name2, NULL); if (!NT_STATUS_IS_OK(status)) { goto failed; } @@ -311,7 +312,7 @@ static NTSTATUS pvfs_rename_mv(struct ntvfs_module_context *ntvfs, struct pvfs_state *pvfs = ntvfs->private_data; NTSTATUS status; struct pvfs_filename *name1, *name2; - struct odb_lock *lck; + struct odb_lock *lck = NULL; /* resolve the cifs name to a posix name */ status = pvfs_resolve_name(pvfs, req, ren->rename.in.pattern1, @@ -354,6 +355,7 @@ static NTSTATUS pvfs_rename_mv(struct ntvfs_module_context *ntvfs, status = pvfs_can_rename(pvfs, req, name1, &lck); if (!NT_STATUS_IS_OK(status)) { + talloc_free(lck); return status; } @@ -375,7 +377,6 @@ static NTSTATUS pvfs_rename_nt(struct ntvfs_module_context *ntvfs, struct pvfs_state *pvfs = ntvfs->private_data; NTSTATUS status; struct pvfs_filename *name1, *name2; - struct odb_lock *lck; switch (ren->ntrename.in.flags) { case RENAME_FLAG_RENAME: @@ -421,7 +422,7 @@ static NTSTATUS pvfs_rename_nt(struct ntvfs_module_context *ntvfs, return status; } - status = pvfs_can_rename(pvfs, req, name1, &lck); + status = pvfs_can_rename(pvfs, req, name1, NULL); if (!NT_STATUS_IS_OK(status)) { return status; } diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c index 9c78699edb..fbbb8c2d4b 100644 --- a/source4/ntvfs/posix/pvfs_setfileinfo.c +++ b/source4/ntvfs/posix/pvfs_setfileinfo.c @@ -142,8 +142,6 @@ static NTSTATUS pvfs_setfileinfo_rename(struct pvfs_state *pvfs, /* if the destination exists, then check the rename is allowed */ if (name2->exists) { - struct odb_lock *lck; - if (strcmp(name2->full_name, name->full_name) == 0) { /* rename to same name is null-op */ return NT_STATUS_OK; @@ -153,7 +151,7 @@ static NTSTATUS pvfs_setfileinfo_rename(struct pvfs_state *pvfs, return NT_STATUS_OBJECT_NAME_COLLISION; } - status = pvfs_can_delete(pvfs, req, name2, &lck); + status = pvfs_can_delete(pvfs, req, name2, NULL); if (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION)) { return NT_STATUS_ACCESS_DENIED; } diff --git a/source4/ntvfs/posix/pvfs_unlink.c b/source4/ntvfs/posix/pvfs_unlink.c index ef56d99fb5..d6e60b59d3 100644 --- a/source4/ntvfs/posix/pvfs_unlink.c +++ b/source4/ntvfs/posix/pvfs_unlink.c @@ -33,7 +33,6 @@ static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs, uint16_t attrib) { NTSTATUS status; - struct odb_lock *lck; if (!name->stream_exists) { return NT_STATUS_OBJECT_NAME_NOT_FOUND; @@ -45,7 +44,7 @@ static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs, return status; } - status = pvfs_can_delete(pvfs, req, name, &lck); + status = pvfs_can_delete(pvfs, req, name, NULL); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -64,7 +63,6 @@ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs, { struct pvfs_filename *name; NTSTATUS status; - struct odb_lock *lck; /* get a pvfs_filename object */ status = pvfs_resolve_partial(pvfs, req, @@ -80,7 +78,7 @@ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs, return status; } - status = pvfs_can_delete(pvfs, req, name, &lck); + status = pvfs_can_delete(pvfs, req, name, NULL); if (!NT_STATUS_IS_OK(status)) { talloc_free(name); return status; -- cgit From f56ff422a525fc6fdf04de8e2ce5c5fa4c097629 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 21 Feb 2008 20:01:25 +0100 Subject: pvfs: handle SHARING_VIOLATION and OPLOCK_NOT_GRANTED in pvfs_can_delete/rename() If the caller asks for the odb_lock return it also if we return NT_STATUS_SHARING_VIOLATION or NT_STATUS_OPLOCK_NOT_GRANTED so that the caller can add the pending notification. metze (This used to be commit daab9cb11eb540fae7ec3c024a586f5fd02cfc71) --- source4/ntvfs/posix/pvfs_open.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'source4') diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index 3ccd239523..0d97b3d629 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -1447,7 +1447,19 @@ NTSTATUS pvfs_can_delete(struct pvfs_state *pvfs, status = pvfs_access_check_simple(pvfs, req, name, SEC_STD_DELETE); } - if (!NT_STATUS_IS_OK(status)) { + /* + * if it's a sharing violation or we got no oplock + * only keep the lock if the caller requested access + * to the lock + */ + if (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION) || + NT_STATUS_EQUAL(status, NT_STATUS_OPLOCK_NOT_GRANTED)) { + if (lckp) { + *lckp = lck; + } else { + talloc_free(lck); + } + } else if (!NT_STATUS_IS_OK(status)) { talloc_free(lck); *lckp = lck; } else if (lckp != NULL) { @@ -1487,7 +1499,19 @@ NTSTATUS pvfs_can_rename(struct pvfs_state *pvfs, 0, SEC_STD_DELETE); - if (!NT_STATUS_IS_OK(status)) { + /* + * if it's a sharing violation or we got no oplock + * only keep the lock if the caller requested access + * to the lock + */ + if (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION) || + NT_STATUS_EQUAL(status, NT_STATUS_OPLOCK_NOT_GRANTED)) { + if (lckp) { + *lckp = lck; + } else { + talloc_free(lck); + } + } else if (!NT_STATUS_IS_OK(status)) { talloc_free(lck); *lckp = lck; } else if (lckp != NULL) { -- cgit From 6f077d4017e6df9e070b1c3ea85b7afacf3437cd Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 21 Feb 2008 19:56:36 +0100 Subject: pvfs_open: unify talloc behavior in pvfs_can_delete/rename/stat() And also handle NULL for lckp in the error path without crashing. metze (This used to be commit 04eb1be0c67317067ee0ca70c731fef958cd513c) --- source4/ntvfs/posix/pvfs_open.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'source4') diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index 0d97b3d629..3a8b17ab16 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -1461,8 +1461,10 @@ NTSTATUS pvfs_can_delete(struct pvfs_state *pvfs, } } else if (!NT_STATUS_IS_OK(status)) { talloc_free(lck); - *lckp = lck; - } else if (lckp != NULL) { + if (lckp) { + *lckp = NULL; + } + } else if (lckp) { *lckp = lck; } @@ -1513,8 +1515,10 @@ NTSTATUS pvfs_can_rename(struct pvfs_state *pvfs, } } else if (!NT_STATUS_IS_OK(status)) { talloc_free(lck); - *lckp = lck; - } else if (lckp != NULL) { + if (lckp) { + *lckp = NULL; + } + } else if (lckp) { *lckp = lck; } @@ -1549,6 +1553,10 @@ NTSTATUS pvfs_can_stat(struct pvfs_state *pvfs, NTCREATEX_SHARE_ACCESS_WRITE, 0, 0); + if (!NT_STATUS_IS_OK(status)) { + talloc_free(lck); + } + return status; } -- cgit From 63b15441f4a5f636a079fa5407b2e97a8b99b6e2 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 21 Feb 2008 20:12:46 +0100 Subject: pvfs_unlink: pass down a struct pvfs_filename to pvfs_unlink_one() metze (This used to be commit 43ec7fa2d898ce306557ea9092b6412bcc2f97ec) --- source4/ntvfs/posix/pvfs_unlink.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'source4') diff --git a/source4/ntvfs/posix/pvfs_unlink.c b/source4/ntvfs/posix/pvfs_unlink.c index d6e60b59d3..101dd75de6 100644 --- a/source4/ntvfs/posix/pvfs_unlink.c +++ b/source4/ntvfs/posix/pvfs_unlink.c @@ -58,34 +58,23 @@ static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs, */ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs, struct ntvfs_request *req, - const char *unix_path, - const char *fname, uint32_t attrib) + struct pvfs_filename *name, + uint32_t attrib) { - struct pvfs_filename *name; NTSTATUS status; - /* get a pvfs_filename object */ - status = pvfs_resolve_partial(pvfs, req, - unix_path, fname, &name); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - /* make sure its matches the given attributes */ status = pvfs_match_attrib(pvfs, name, attrib, 0); if (!NT_STATUS_IS_OK(status)) { - talloc_free(name); return status; } status = pvfs_can_delete(pvfs, req, name, NULL); if (!NT_STATUS_IS_OK(status)) { - talloc_free(name); return status; } if (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) { - talloc_free(name); return NT_STATUS_FILE_IS_A_DIRECTORY; } @@ -108,8 +97,6 @@ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs, name->full_name); } - talloc_free(name); - return status; } @@ -156,6 +143,7 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs, } status = NT_STATUS_NO_SUCH_FILE; + talloc_free(name); ofs = 0; @@ -166,10 +154,20 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs, return NT_STATUS_OBJECT_NAME_INVALID; } - status = pvfs_unlink_one(pvfs, req, pvfs_list_unix_path(dir), fname, unl->unlink.in.attrib); + /* get a pvfs_filename object */ + status = pvfs_resolve_partial(pvfs, req, + pvfs_list_unix_path(dir), + fname, &name); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + status = pvfs_unlink_one(pvfs, req, name, unl->unlink.in.attrib); if (NT_STATUS_IS_OK(status)) { total_deleted++; } + + talloc_free(name); } if (total_deleted > 0) { -- cgit From a56bd4fa82bcb5c586f182e8123f2fc41b12e41d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 22 Feb 2008 09:23:53 +0100 Subject: pvfs_unlink: pass down union smb_unlink completely to sub functions metze (This used to be commit 8301189e94be850494482e8c064b2400a5d11157) --- source4/ntvfs/posix/pvfs_unlink.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'source4') diff --git a/source4/ntvfs/posix/pvfs_unlink.c b/source4/ntvfs/posix/pvfs_unlink.c index 101dd75de6..8dbf9ee724 100644 --- a/source4/ntvfs/posix/pvfs_unlink.c +++ b/source4/ntvfs/posix/pvfs_unlink.c @@ -29,8 +29,8 @@ */ static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs, struct ntvfs_request *req, - struct pvfs_filename *name, - uint16_t attrib) + union smb_unlink *unl, + struct pvfs_filename *name) { NTSTATUS status; @@ -39,7 +39,8 @@ static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs, } /* make sure its matches the given attributes */ - status = pvfs_match_attrib(pvfs, name, attrib, 0); + status = pvfs_match_attrib(pvfs, name, + unl->unlink.in.attrib, 0); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -58,13 +59,14 @@ static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs, */ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs, struct ntvfs_request *req, - struct pvfs_filename *name, - uint32_t attrib) + union smb_unlink *unl, + struct pvfs_filename *name) { NTSTATUS status; /* make sure its matches the given attributes */ - status = pvfs_match_attrib(pvfs, name, attrib, 0); + status = pvfs_match_attrib(pvfs, name, + unl->unlink.in.attrib, 0); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -133,7 +135,7 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs, } if (name->stream_name) { - return pvfs_unlink_stream(pvfs, req, name, unl->unlink.in.attrib); + return pvfs_unlink_stream(pvfs, req, unl, name); } /* get list of matching files */ @@ -162,7 +164,7 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs, return status; } - status = pvfs_unlink_one(pvfs, req, name, unl->unlink.in.attrib); + status = pvfs_unlink_one(pvfs, req, unl, name); if (NT_STATUS_IS_OK(status)) { total_deleted++; } -- cgit From d5414cdc63b797a47fcbd1f55df98c7dd850ffa6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 22 Feb 2008 09:28:51 +0100 Subject: pvfs_unlink: move !name->stream_exists into the caller metze (This used to be commit e01554e1617dc3c08a4ed6b4e016fd627f529ef9) --- source4/ntvfs/posix/pvfs_unlink.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4') diff --git a/source4/ntvfs/posix/pvfs_unlink.c b/source4/ntvfs/posix/pvfs_unlink.c index 8dbf9ee724..2b96a5032c 100644 --- a/source4/ntvfs/posix/pvfs_unlink.c +++ b/source4/ntvfs/posix/pvfs_unlink.c @@ -34,10 +34,6 @@ static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs, { NTSTATUS status; - if (!name->stream_exists) { - return NT_STATUS_OBJECT_NAME_NOT_FOUND; - } - /* make sure its matches the given attributes */ status = pvfs_match_attrib(pvfs, name, unl->unlink.in.attrib, 0); @@ -135,6 +131,10 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs, } if (name->stream_name) { + if (!name->stream_exists) { + return NT_STATUS_OBJECT_NAME_NOT_FOUND; + } + return pvfs_unlink_stream(pvfs, req, unl, name); } -- cgit From 0634c12abb634034fcaf842647c2bc09a92bfd68 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 22 Feb 2008 09:30:51 +0100 Subject: pvfs_unlink: add a fast path for the non wildcard case metze (This used to be commit 83e6c99f78990b6b1df520bdee14b9f931ad0420) --- source4/ntvfs/posix/pvfs_unlink.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4') diff --git a/source4/ntvfs/posix/pvfs_unlink.c b/source4/ntvfs/posix/pvfs_unlink.c index 2b96a5032c..72649e646d 100644 --- a/source4/ntvfs/posix/pvfs_unlink.c +++ b/source4/ntvfs/posix/pvfs_unlink.c @@ -138,6 +138,10 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs, return pvfs_unlink_stream(pvfs, req, unl, name); } + if (!name->has_wildcard) { + return pvfs_unlink_one(pvfs, req, unl, name); + } + /* get list of matching files */ status = pvfs_list_start(pvfs, name, req, &dir); if (!NT_STATUS_IS_OK(status)) { -- cgit From 58745900d30cbfa8729ce99e7110cfc5e4a78c2a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 22 Feb 2008 09:37:22 +0100 Subject: pvfs_unlink: splitup the logic into generic and file specific functions metze (This used to be commit 7572afdc2635bdf9afbe1eda3c7498d0b5201db3) --- source4/ntvfs/posix/pvfs_unlink.c | 45 ++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'source4') diff --git a/source4/ntvfs/posix/pvfs_unlink.c b/source4/ntvfs/posix/pvfs_unlink.c index 72649e646d..0763a4e48c 100644 --- a/source4/ntvfs/posix/pvfs_unlink.c +++ b/source4/ntvfs/posix/pvfs_unlink.c @@ -51,27 +51,13 @@ static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs, /* - unlink one file + unlink a file */ -static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs, - struct ntvfs_request *req, - union smb_unlink *unl, - struct pvfs_filename *name) +static NTSTATUS pvfs_unlink_file(struct pvfs_state *pvfs, + struct pvfs_filename *name) { NTSTATUS status; - /* make sure its matches the given attributes */ - status = pvfs_match_attrib(pvfs, name, - unl->unlink.in.attrib, 0); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - - status = pvfs_can_delete(pvfs, req, name, NULL); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - if (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) { return NT_STATUS_FILE_IS_A_DIRECTORY; } @@ -98,6 +84,31 @@ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs, return status; } +/* + unlink one file +*/ +static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs, + struct ntvfs_request *req, + union smb_unlink *unl, + struct pvfs_filename *name) +{ + NTSTATUS status; + + /* make sure its matches the given attributes */ + status = pvfs_match_attrib(pvfs, name, + unl->unlink.in.attrib, 0); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + status = pvfs_can_delete(pvfs, req, name, NULL); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + return pvfs_unlink_file(pvfs, name); +} + /* delete a file - the dirtype specifies the file types to include in the search. The name can contain CIFS wildcards, but rarely does (except with OS/2 clients) -- cgit From 599901c139e99dca26f267439c14119e6c3f2092 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 22 Feb 2008 09:41:41 +0100 Subject: pvfs_unlink: move stream logic into pvfs_unlink_one() metze (This used to be commit 438032e12f3040fbb58488ca537e4d8da39b6124) --- source4/ntvfs/posix/pvfs_unlink.c | 42 ++++++++------------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) (limited to 'source4') diff --git a/source4/ntvfs/posix/pvfs_unlink.c b/source4/ntvfs/posix/pvfs_unlink.c index 0763a4e48c..bda4014bee 100644 --- a/source4/ntvfs/posix/pvfs_unlink.c +++ b/source4/ntvfs/posix/pvfs_unlink.c @@ -24,32 +24,6 @@ #include "system/dir.h" -/* - unlink a stream - */ -static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs, - struct ntvfs_request *req, - union smb_unlink *unl, - struct pvfs_filename *name) -{ - NTSTATUS status; - - /* make sure its matches the given attributes */ - status = pvfs_match_attrib(pvfs, name, - unl->unlink.in.attrib, 0); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - - status = pvfs_can_delete(pvfs, req, name, NULL); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - - return pvfs_stream_delete(pvfs, name, -1); -} - - /* unlink a file */ @@ -106,6 +80,14 @@ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs, return status; } + if (name->stream_name) { + if (!name->stream_exists) { + return NT_STATUS_OBJECT_NAME_NOT_FOUND; + } + + return pvfs_stream_delete(pvfs, name, -1); + } + return pvfs_unlink_file(pvfs, name); } @@ -141,14 +123,6 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs, return NT_STATUS_FILE_IS_A_DIRECTORY; } - if (name->stream_name) { - if (!name->stream_exists) { - return NT_STATUS_OBJECT_NAME_NOT_FOUND; - } - - return pvfs_unlink_stream(pvfs, req, unl, name); - } - if (!name->has_wildcard) { return pvfs_unlink_one(pvfs, req, unl, name); } -- cgit From 27e322bb4d5a25a2a1ebc5df36690590d86e3afd Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 22 Feb 2008 10:18:13 +0100 Subject: opendb: add odb_get_key() function to get the key back from a struct odb_lock metze (This used to be commit 11f35a2a4d383b506ced35ba06120f9531bac70c) --- source4/cluster/ctdb/opendb_ctdb.c | 11 +++++++++++ source4/ntvfs/common/opendb.c | 4 ++++ source4/ntvfs/common/opendb.h | 1 + source4/ntvfs/common/opendb_tdb.c | 7 +++++++ 4 files changed, 23 insertions(+) (limited to 'source4') diff --git a/source4/cluster/ctdb/opendb_ctdb.c b/source4/cluster/ctdb/opendb_ctdb.c index aaab3aa55d..f056e21716 100644 --- a/source4/cluster/ctdb/opendb_ctdb.c +++ b/source4/cluster/ctdb/opendb_ctdb.c @@ -133,6 +133,16 @@ static struct odb_lock *odb_ctdb_lock(TALLOC_CTX *mem_ctx, return lck; } +static DATA_BLOB odb_ctdb_get_key(TALLOC_CTX *mem_ctx, struct odb_lock *lck) +{ + /* + * as this file will went away and isn't used yet, + * copy the implementation from the tdb backend + * --metze + */ + return data_blob_const(NULL, 0); +} + /* determine if two odb_entry structures conflict @@ -610,6 +620,7 @@ static NTSTATUS odb_ctdb_can_open(struct odb_lock *lck, static const struct opendb_ops opendb_ctdb_ops = { .odb_init = odb_ctdb_init, .odb_lock = odb_ctdb_lock, + .odb_get_key = odb_ctdb_get_key, .odb_open_file = odb_ctdb_open_file, .odb_open_file_pending = odb_ctdb_open_file_pending, .odb_close_file = odb_ctdb_close_file, diff --git a/source4/ntvfs/common/opendb.c b/source4/ntvfs/common/opendb.c index 4826ca5c26..f12f23817d 100644 --- a/source4/ntvfs/common/opendb.c +++ b/source4/ntvfs/common/opendb.c @@ -81,6 +81,10 @@ _PUBLIC_ struct odb_lock *odb_lock(TALLOC_CTX *mem_ctx, return ops->odb_lock(mem_ctx, odb, file_key); } +_PUBLIC_ DATA_BLOB odb_get_key(TALLOC_CTX *mem_ctx, struct odb_lock *lck) +{ + return ops->odb_get_key(mem_ctx, lck); +} /* register an open file in the open files database. This implements the share_access diff --git a/source4/ntvfs/common/opendb.h b/source4/ntvfs/common/opendb.h index 231ae3d7de..5472cea418 100644 --- a/source4/ntvfs/common/opendb.h +++ b/source4/ntvfs/common/opendb.h @@ -24,6 +24,7 @@ struct opendb_ops { struct ntvfs_context *ntvfs_ctx); struct odb_lock *(*odb_lock)(TALLOC_CTX *mem_ctx, struct odb_context *odb, DATA_BLOB *file_key); + DATA_BLOB (*odb_get_key)(TALLOC_CTX *mem_ctx, struct odb_lock *lck); NTSTATUS (*odb_open_file)(struct odb_lock *lck, void *file_handle, uint32_t stream_id, uint32_t share_access, uint32_t access_mask, bool delete_on_close, diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index abd9ca708b..469cf28374 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -134,6 +134,12 @@ static struct odb_lock *odb_tdb_lock(TALLOC_CTX *mem_ctx, return lck; } +static DATA_BLOB odb_tdb_get_key(TALLOC_CTX *mem_ctx, struct odb_lock *lck) +{ + return data_blob_talloc(mem_ctx, lck->key.dptr, lck->key.dsize); +} + + /* determine if two odb_entry structures conflict @@ -609,6 +615,7 @@ static NTSTATUS odb_tdb_can_open(struct odb_lock *lck, static const struct opendb_ops opendb_tdb_ops = { .odb_init = odb_tdb_init, .odb_lock = odb_tdb_lock, + .odb_get_key = odb_tdb_get_key, .odb_open_file = odb_tdb_open_file, .odb_open_file_pending = odb_tdb_open_file_pending, .odb_close_file = odb_tdb_close_file, -- cgit From 6cb9c1c61d8087457420a56f5296662417a25bd4 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 21 Feb 2008 12:20:31 +0100 Subject: opendb: send also the oplock break level on MSG_NTVFS_OPLOCK_BREAK metze (This used to be commit 49402007f6e9e02a29792344c088e40d1a9b7acf) --- source4/ntvfs/common/opendb.h | 4 ++++ source4/ntvfs/common/opendb_tdb.c | 28 +++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) (limited to 'source4') diff --git a/source4/ntvfs/common/opendb.h b/source4/ntvfs/common/opendb.h index 5472cea418..ccf6db27a0 100644 --- a/source4/ntvfs/common/opendb.h +++ b/source4/ntvfs/common/opendb.h @@ -43,6 +43,10 @@ struct opendb_ops { uint32_t access_mask); }; +struct opendb_oplock_break { + void *file_handle; + uint8_t level; +}; void odb_set_ops(const struct opendb_ops *new_ops); void odb_tdb_init_ops(void); diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index 469cf28374..25f37f5e26 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -259,12 +259,28 @@ static NTSTATUS odb_push_record(struct odb_lock *lck, struct opendb_file *file) /* send an oplock break to a client */ -static NTSTATUS odb_oplock_break_send(struct odb_context *odb, struct opendb_entry *e) +static NTSTATUS odb_oplock_break_send(struct odb_context *odb, + struct opendb_entry *e, + uint8_t level) { + NTSTATUS status; + struct opendb_oplock_break op_break; + DATA_BLOB blob; + + ZERO_STRUCT(op_break); + /* tell the server handling this open file about the need to send the client a break */ - return messaging_send_ptr(odb->ntvfs_ctx->msg_ctx, e->server, - MSG_NTVFS_OPLOCK_BREAK, e->file_handle); + op_break.file_handle = e->file_handle; + op_break.level = level; + + blob = data_blob_const(&op_break, sizeof(op_break)); + + status = messaging_send(odb->ntvfs_ctx->msg_ctx, e->server, + MSG_NTVFS_OPLOCK_BREAK, &blob); + NT_STATUS_NOT_OK_RETURN(status); + + return NT_STATUS_OK; } /* @@ -318,7 +334,8 @@ static NTSTATUS odb_tdb_open_file(struct odb_lock *lck, void *file_handle, break request and suspending this call until the break is acknowledged or the file is closed */ - odb_oplock_break_send(odb, &file.entries[i]); + odb_oplock_break_send(odb, &file.entries[i], + OPLOCK_BREAK_TO_LEVEL_II/*TODO*/); return NT_STATUS_OPLOCK_NOT_GRANTED; } } @@ -342,7 +359,8 @@ static NTSTATUS odb_tdb_open_file(struct odb_lock *lck, void *file_handle, exclusive oplocks afterwards. */ for (i=0;i Date: Thu, 21 Feb 2008 16:12:27 +0100 Subject: opendb: add odb_update_oplock() call metze (This used to be commit df576d69c6981a4879a0e9447069fcfacb3588db) --- source4/cluster/ctdb/opendb_ctdb.c | 16 +++++++++++++- source4/ntvfs/common/opendb.c | 6 +++++ source4/ntvfs/common/opendb.h | 2 ++ source4/ntvfs/common/opendb_tdb.c | 45 ++++++++++++++++++++++++++++++++++++-- 4 files changed, 66 insertions(+), 3 deletions(-) (limited to 'source4') diff --git a/source4/cluster/ctdb/opendb_ctdb.c b/source4/cluster/ctdb/opendb_ctdb.c index f056e21716..86dc1f50f1 100644 --- a/source4/cluster/ctdb/opendb_ctdb.c +++ b/source4/cluster/ctdb/opendb_ctdb.c @@ -450,6 +450,19 @@ static NTSTATUS odb_ctdb_close_file(struct odb_lock *lck, void *file_handle) return odb_push_record(lck, &file); } +/* + update the oplock level of the client +*/ +static NTSTATUS odb_ctdb_update_oplock(struct odb_lock *lck, void *file_handle, + uint32_t oplock_level) +{ + /* + * as this file will went away and isn't used yet, + * copy the implementation from the tdb backend + * --metze + */ + return NT_STATUS_FOOBAR; +} /* remove a pending opendb entry @@ -628,7 +641,8 @@ static const struct opendb_ops opendb_ctdb_ops = { .odb_rename = odb_ctdb_rename, .odb_set_delete_on_close = odb_ctdb_set_delete_on_close, .odb_get_delete_on_close = odb_ctdb_get_delete_on_close, - .odb_can_open = odb_ctdb_can_open + .odb_can_open = odb_ctdb_can_open, + .odb_update_oplock = odb_ctdb_update_oplock }; diff --git a/source4/ntvfs/common/opendb.c b/source4/ntvfs/common/opendb.c index f12f23817d..4ac10806e1 100644 --- a/source4/ntvfs/common/opendb.c +++ b/source4/ntvfs/common/opendb.c @@ -170,3 +170,9 @@ _PUBLIC_ NTSTATUS odb_can_open(struct odb_lock *lck, { return ops->odb_can_open(lck, share_access, create_options, access_mask); } + +_PUBLIC_ NTSTATUS odb_update_oplock(struct odb_lock *lck, void *file_handle, + uint32_t oplock_level) +{ + return ops->odb_update_oplock(lck, file_handle, oplock_level); +} diff --git a/source4/ntvfs/common/opendb.h b/source4/ntvfs/common/opendb.h index ccf6db27a0..c34a07d6fa 100644 --- a/source4/ntvfs/common/opendb.h +++ b/source4/ntvfs/common/opendb.h @@ -41,6 +41,8 @@ struct opendb_ops { NTSTATUS (*odb_can_open)(struct odb_lock *lck, uint32_t share_access, uint32_t create_options, uint32_t access_mask); + NTSTATUS (*odb_update_oplock)(struct odb_lock *lck, void *file_handle, + uint32_t oplock_level); }; struct opendb_oplock_break { diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index 25f37f5e26..3d4a760e2e 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -2,7 +2,8 @@ Unix SMB/CIFS implementation. Copyright (C) Andrew Tridgell 2004 - + Copyright (C) Stefan Metzmacher 2008 + 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 @@ -463,6 +464,45 @@ static NTSTATUS odb_tdb_close_file(struct odb_lock *lck, void *file_handle) return odb_push_record(lck, &file); } +/* + update the oplock level of the client +*/ +static NTSTATUS odb_tdb_update_oplock(struct odb_lock *lck, void *file_handle, + uint32_t oplock_level) +{ + struct odb_context *odb = lck->odb; + struct opendb_file file; + int i; + NTSTATUS status; + + status = odb_pull_record(lck, &file); + NT_STATUS_NOT_OK_RETURN(status); + + /* find the entry, and update it */ + for (i=0;intvfs_ctx->server_id, &file.entries[i].server)) { + file.entries[i].oplock_level = oplock_level; + break; + } + } + + if (i == file.num_entries) { + return NT_STATUS_UNSUCCESSFUL; + } + + /* send any pending notifications, removing them once sent */ + for (i=0;intvfs_ctx->msg_ctx, + file.pending[i].server, + MSG_PVFS_RETRY_OPEN, + file.pending[i].notify_ptr); + } + file.num_pending = 0; + + return odb_push_record(lck, &file); +} + /* remove a pending opendb entry @@ -641,7 +681,8 @@ static const struct opendb_ops opendb_tdb_ops = { .odb_rename = odb_tdb_rename, .odb_set_delete_on_close = odb_tdb_set_delete_on_close, .odb_get_delete_on_close = odb_tdb_get_delete_on_close, - .odb_can_open = odb_tdb_can_open + .odb_can_open = odb_tdb_can_open, + .odb_update_oplock = odb_tdb_update_oplock }; -- cgit From 0a8b1fd092c9a64c04f6f05d41b3d7ecec7ccc6f Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 25 Feb 2008 14:03:07 -0500 Subject: Update homepages for talloc, tdb and ldb subprojects (This used to be commit 8cb07814bc6627fc8eba228eafd13336e3ca3758) --- source4/lib/ldb/web/index.html | 24 ++++++++++-------------- source4/lib/talloc/web/index.html | 20 ++++++++------------ source4/lib/tdb/web/index.html | 14 ++++++-------- 3 files changed, 24 insertions(+), 34 deletions(-) (limited to 'source4') diff --git a/source4/lib/ldb/web/index.html b/source4/lib/ldb/web/index.html index 76dbbdeafb..26dd344527 100644 --- a/source4/lib/ldb/web/index.html +++ b/source4/lib/ldb/web/index.html @@ -42,9 +42,9 @@ The main features that separate ldb from other solutions are: Currently ldb is completely lacking in programmer or user documentation. This is your opportunity to make a contribution! Start with the public functions declared in ldb.h +href="http://samba.org/ftp/unpacked/ldb/include/ldb.h">ldb.h and the example code in the tools +href="http://samba.org/ftp/unpacked/ldb/tools/">tools directory. Documentation in the same docbook format used by Samba would be preferred. @@ -53,21 +53,17 @@ would be preferred. ldb does not currently have its own mailing list or bug tracking system. For now, please use the samba-technical -mailing list, and the Samba -bugzilla bug tracking system. +mailing list or the ldb +mailing list, and the Samba bugzilla bug tracking system.

Download

-You can download the latest release either via rsync or anonymous -svn. To fetch via svn use the following commands: - -
-  svn co svn://svnanon.samba.org/samba/branches/SAMBA_4_0/source/lib/ldb ldb
-  svn co svn://svnanon.samba.org/samba/branches/SAMBA_4_0/source/lib/tdb tdb
-  svn co svn://svnanon.samba.org/samba/branches/SAMBA_4_0/source/lib/talloc talloc
-  svn co svn://svnanon.samba.org/samba/branches/SAMBA_4_0/source/lib/replace libreplace
-
- +You can download the latest release either via rsync or thtough git.
+
+To fetch via git see the following guide:
+Using Git for Samba Development
+Once you have cloned the tree switch to the v4-0-test branch and cd into the source/lib/ldb directory.
+
To fetch via rsync use these commands:
diff --git a/source4/lib/talloc/web/index.html b/source4/lib/talloc/web/index.html
index 628030ad4c..5deab93665 100644
--- a/source4/lib/talloc/web/index.html
+++ b/source4/lib/talloc/web/index.html
@@ -12,7 +12,7 @@ destructors. It is the core memory allocator used in Samba4, and has
 made a huge difference in many aspects of Samba4 development.

To get started with talloc, I would recommend you read the talloc guide. +href="http://samba.org/ftp/unpacked/talloc/talloc_guide.txt">talloc guide.

Discussion and bug reports

@@ -24,20 +24,16 @@ bugzilla bug tracking system.

Download

-You can download the latest release either via rsync or git. -To fetch via git use the following command: - -
-  git-clone git://git.samba.org/samba.git samba
-  cd samba
-  git checkout -b samba4 origin/v4-0-test
-
- +You can download the latest release either via rsync or git.
+
+To fetch via git see the following guide:
+Using Git for Samba Development
+Once you have cloned the tree switch to the v4-0-test branch and cd into the source/lib/talloc directory.
+
To fetch via rsync use this command:
-  rsync -Pavz samba.org::ftp/unpacked/samba_4_0_test/source/lib/talloc .
-  rsync -Pavz samba.org::ftp/unpacked/samba_4_0_test/source/lib/libreplace .
+  rsync -Pavz samba.org::ftp/unpacked/talloc .
 

diff --git a/source4/lib/tdb/web/index.html b/source4/lib/tdb/web/index.html index 979665ae76..a53da6b8f7 100644 --- a/source4/lib/tdb/web/index.html +++ b/source4/lib/tdb/web/index.html @@ -22,14 +22,12 @@ bugzilla bug tracking system.

Download

-You can download the latest release either via rsync or anonymous -svn. To fetch via svn use the following commands: - -
-  svn co svn://svnanon.samba.org/samba/branches/SAMBA_4_0/source/lib/tdb tdb
-  svn co svn://svnanon.samba.org/samba/branches/SAMBA_4_0/source/lib/replace libreplace
-
- +You can download the latest release either via rsync or git.
+
+To fetch via git see the following guide:
+Using Git for Samba Development
+Once you have cloned the tree switch to the v4-0-test branch and cd into the source/lib/tdb directory.
+
To fetch via rsync use these commands:
-- 
cgit