summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-02-21 16:12:27 +0100
committerStefan Metzmacher <metze@samba.org>2008-02-25 11:51:17 +0100
commit71943b209b181e1e4a65ab477b83780add7051ae (patch)
treec4b3b43ece167545c81bb287156500e6a6eb1200
parent6cb9c1c61d8087457420a56f5296662417a25bd4 (diff)
downloadsamba-71943b209b181e1e4a65ab477b83780add7051ae.tar.gz
samba-71943b209b181e1e4a65ab477b83780add7051ae.tar.bz2
samba-71943b209b181e1e4a65ab477b83780add7051ae.zip
opendb: add odb_update_oplock() call
metze (This used to be commit df576d69c6981a4879a0e9447069fcfacb3588db)
-rw-r--r--source4/cluster/ctdb/opendb_ctdb.c16
-rw-r--r--source4/ntvfs/common/opendb.c6
-rw-r--r--source4/ntvfs/common/opendb.h2
-rw-r--r--source4/ntvfs/common/opendb_tdb.c45
4 files changed, 66 insertions, 3 deletions
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;i<file.num_entries;i++) {
+ if (file_handle == file.entries[i].file_handle &&
+ cluster_id_equal(&odb->ntvfs_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;i<file.num_pending;i++) {
+ messaging_send_ptr(odb->ntvfs_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
};