From e5e799aeb6b57ade1dd9c1a1d2c3aab1ad08d6df Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 7 Mar 2008 18:23:34 +0100 Subject: opendb: force odb_can_open() before odb_open_file() Now there's only odb_can_open() which handles the share_access rules. And odb_open_file() only adds the new opendb_entry into the database and calculates the granted oplock level. metze (This used to be commit db0853ae4fead34ef382bbfcfe2f46453ab8b73b) --- source4/cluster/ctdb/opendb_ctdb.c | 100 +++---------------------------------- 1 file changed, 7 insertions(+), 93 deletions(-) (limited to 'source4/cluster') diff --git a/source4/cluster/ctdb/opendb_ctdb.c b/source4/cluster/ctdb/opendb_ctdb.c index fe48f98760..a7b8ddf760 100644 --- a/source4/cluster/ctdb/opendb_ctdb.c +++ b/source4/cluster/ctdb/opendb_ctdb.c @@ -261,6 +261,7 @@ static NTSTATUS odb_push_record(struct odb_lock *lck, struct opendb_file *file) return NT_STATUS_OK; } +#if 0 /* send an oplock break to a client */ @@ -271,6 +272,7 @@ static NTSTATUS odb_oplock_break_send(struct odb_context *odb, struct opendb_ent return messaging_send_ptr(odb->ntvfs_ctx->msg_ctx, e->server, MSG_NTVFS_OPLOCK_BREAK, e->file_handle); } +#endif /* register an open file in the open files database. This implements the share_access @@ -281,104 +283,16 @@ static NTSTATUS odb_oplock_break_send(struct odb_context *odb, struct opendb_ent */ static NTSTATUS odb_ctdb_open_file(struct odb_lock *lck, void *file_handle, const char *path, - uint32_t stream_id, uint32_t share_access, - uint32_t access_mask, bool delete_on_close, - uint32_t open_disposition, bool break_to_none, bool allow_level_II_oplock, uint32_t oplock_level, uint32_t *oplock_granted) { - struct odb_context *odb = lck->odb; - struct opendb_entry e; - int i; - struct opendb_file file; - NTSTATUS status; - - if (odb->oplocks == false) { - oplock_level = OPLOCK_NONE; - } - - status = odb_pull_record(lck, &file); - if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) { - /* initialise a blank structure */ - ZERO_STRUCT(file); - file.path = path; - } else { - NT_STATUS_NOT_OK_RETURN(status); - } - - /* see if it conflicts */ - e.server = odb->ntvfs_ctx->server_id; - e.file_handle = file_handle; - e.stream_id = stream_id; - e.share_access = share_access; - e.access_mask = access_mask; - e.delete_on_close = delete_on_close; - e.oplock_level = OPLOCK_NONE; - - /* see if anyone has an oplock, which we need to break */ - for (i=0;i