summaryrefslogtreecommitdiff
path: root/source3/smbd/oplock.c
diff options
context:
space:
mode:
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);
}
/****************************************************************************