summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-02-03 11:56:35 -0800
committerTim Prouty <tprouty@samba.org>2009-02-09 23:47:45 -0800
commitc6f1f055fdeee29ad7c5b2ae9909e8f1b1a7daec (patch)
tree1fc919526e3c6988ede50457ad72b098d42c1be9 /source3/include
parent9c1310fa6ae1a67dc0fea3bf549d805ff167e78f (diff)
downloadsamba-c6f1f055fdeee29ad7c5b2ae9909e8f1b1a7daec.tar.gz
samba-c6f1f055fdeee29ad7c5b2ae9909e8f1b1a7daec.tar.bz2
samba-c6f1f055fdeee29ad7c5b2ae9909e8f1b1a7daec.zip
s3 oplocks: Make the level2 oplock contention API more granular
This replaces release_level2_oplocks_on_change with contend_level2_oplock_begin/end in order to contend level2 oplocks throughout an operation rather than just at the begining. This is necessary for some kernel oplock implementations, and also lays the groundwork for better correctness in Samba's standard level2 oplock handling. The next step for non-kernel oplocks is to add additional state to the share mode lock struct that prevents any new opens from granting oplocks while a contending operation is in progress. All operations that contend level 2 oplocks are now correctly spanned except for aio and synchronous writes. The two write paths both have non-trivial error paths that need extra care to get right. RAW-OPLOCK and the rest of 'make test' are still passing with this change.
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/proto.h10
-rw-r--r--source3/include/smb.h14
2 files changed, 23 insertions, 1 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 1a1f8bef69..ceea97bf56 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -6899,7 +6899,15 @@ void release_file_oplock(files_struct *fsp);
bool remove_oplock(files_struct *fsp);
bool downgrade_oplock(files_struct *fsp);
void reply_to_oplock_break_requests(files_struct *fsp);
-void release_level_2_oplocks_on_change(files_struct *fsp);
+void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id src,
+ DATA_BLOB *data);
+void contend_level2_oplocks_begin(files_struct *fsp,
+ enum level2_contention_type type);
+void contend_level2_oplocks_end(files_struct *fsp,
+ enum level2_contention_type type);
void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e);
void message_to_share_mode_entry(struct share_mode_entry *e, char *msg);
bool init_oplocks(struct messaging_context *msg_ctx);
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 96cd3b7d85..557489f211 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -1695,6 +1695,16 @@ struct kernel_oplocks {
void *private_data;
};
+enum level2_contention_type {
+ LEVEL2_CONTEND_ALLOC_SHRINK,
+ LEVEL2_CONTEND_ALLOC_GROW,
+ LEVEL2_CONTEND_SET_FILE_LEN,
+ LEVEL2_CONTEND_FILL_SPARSE,
+ LEVEL2_CONTEND_WRITE,
+ LEVEL2_CONTEND_WINDOWS_BRL,
+ LEVEL2_CONTEND_POSIX_BRL
+};
+
/* if a kernel does support oplocks then a structure of the following
typee is used to describe how to interact with the kernel */
struct kernel_oplocks_ops {
@@ -1702,6 +1712,10 @@ struct kernel_oplocks_ops {
files_struct *fsp, int oplock_type);
void (*release_oplock)(struct kernel_oplocks *ctx,
files_struct *fsp, int oplock_type);
+ void (*contend_level2_oplocks_begin)(files_struct *fsp,
+ enum level2_contention_type type);
+ void (*contend_level2_oplocks_end)(files_struct *fsp,
+ enum level2_contention_type type);
};
#include "smb_macros.h"