summaryrefslogtreecommitdiff
path: root/source3/smbd/oplock.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-01-23 10:08:44 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-27 15:28:10 +0100
commit52f6a4436f9da439fc687894b329898833af7ff8 (patch)
tree7d42835050b9876ae520fa4e02a9f697052bb79c /source3/smbd/oplock.c
parent4a2271349503933776f9d2791edfcb874a2c7261 (diff)
downloadsamba-52f6a4436f9da439fc687894b329898833af7ff8.tar.gz
samba-52f6a4436f9da439fc687894b329898833af7ff8.tar.bz2
samba-52f6a4436f9da439fc687894b329898833af7ff8.zip
s3:smbd: make kernel oplocks event driven
And use signal events for Linux oplocks. metze
Diffstat (limited to 'source3/smbd/oplock.c')
-rw-r--r--source3/smbd/oplock.c64
1 files changed, 13 insertions, 51 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index e4b5016538..788d2f7238 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -32,61 +32,23 @@ int32 get_number_of_exclusive_open_oplocks(void)
return exclusive_oplocks_open;
}
-/****************************************************************************
- Return True if an oplock message is pending.
-****************************************************************************/
-
-bool oplock_message_waiting(void)
-{
- if (koplocks && koplocks->ops->msg_waiting(koplocks)) {
- return True;
- }
-
- return False;
-}
-
-/****************************************************************************
- Find out if there are any kernel oplock messages waiting and process them
- if so. pfds is the fd_set from the main select loop (which contains any
- kernel oplock fd if that's what the system uses (IRIX). If may be NULL if
- we're calling this in a shutting down state.
-****************************************************************************/
-
-void process_kernel_oplocks(struct messaging_context *msg_ctx)
+/*
+ * helper function used by the kernel oplock backends to post the break message
+ */
+void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp)
{
- /*
- * We need to check for kernel oplocks before going into the select
- * here, as the EINTR generated by the linux kernel oplock may have
- * already been eaten. JRA.
- */
-
- if (!koplocks) {
- return;
- }
+ uint8_t msg[MSG_SMB_KERNEL_BREAK_SIZE];
- while (koplocks->ops->msg_waiting(koplocks)) {
- files_struct *fsp;
- char msg[MSG_SMB_KERNEL_BREAK_SIZE];
+ /* Put the kernel break info into the message. */
+ push_file_id_16((char *)msg, &fsp->file_id);
+ SIVAL(msg,16,fsp->fh->gen_id);
- fsp = koplocks->ops->receive_message(koplocks);
+ /* Don't need to be root here as we're only ever
+ sending to ourselves. */
- if (fsp == NULL) {
- DEBUG(3, ("Kernel oplock message announced, but none "
- "received\n"));
- return;
- }
-
- /* Put the kernel break info into the message. */
- push_file_id_16(msg, &fsp->file_id);
- SIVAL(msg,16,fsp->fh->gen_id);
-
- /* Don't need to be root here as we're only ever
- sending to ourselves. */
-
- messaging_send_buf(msg_ctx, procid_self(),
- MSG_SMB_KERNEL_BREAK,
- (uint8 *)&msg, MSG_SMB_KERNEL_BREAK_SIZE);
- }
+ messaging_send_buf(msg_ctx, procid_self(),
+ MSG_SMB_KERNEL_BREAK,
+ msg, MSG_SMB_KERNEL_BREAK_SIZE);
}
/****************************************************************************