svn commit: samba r8147 - in trunk/source/smbd: .
vlendec at samba.org
vlendec at samba.org
Mon Jul 4 15:28:59 GMT 2005
Author: vlendec
Date: 2005-07-04 15:28:58 +0000 (Mon, 04 Jul 2005)
New Revision: 8147
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8147
Log:
Hmmmm. This is probably freak out time for Jeremy, but this is what version
control is for .... :-)
A micro-refactoring trying to understand open.c. Stared at this *really* long
and I think I got it right, at least it should do the same as before.
Volker
Modified:
trunk/source/smbd/open.c
Changeset:
Modified: trunk/source/smbd/open.c
===================================================================
--- trunk/source/smbd/open.c 2005-07-04 15:06:05 UTC (rev 8146)
+++ trunk/source/smbd/open.c 2005-07-04 15:28:58 UTC (rev 8147)
@@ -552,6 +552,25 @@
}
}
+static BOOL cause_oplock_break(int request, int existing, uint32 access_mask)
+{
+ if ((access_mask == DELETE_ACCESS) &&
+ (request == NO_OPLOCK)) {
+ /* This is a delete request */
+ return (BATCH_OPLOCK_TYPE(existing) != 0);
+ }
+
+ if (EXCLUSIVE_OPLOCK_TYPE(existing) && (request != NO_OPLOCK)) {
+ return True;
+ }
+
+ if ((existing != NO_OPLOCK) && (request == NO_OPLOCK)) {
+ return True;
+ }
+
+ return False;
+}
+
/****************************************************************************
Deal with open deny mode and oplock break processing.
Invarient: Share mode must be locked on entry and exit.
@@ -605,7 +624,6 @@
*p_all_current_opens_are_level_II = True;
for(i = 0; i < num_share_modes; i++) {
- BOOL cause_oplock_break = False;
share_mode_entry *share_entry = &old_shares[i];
#if defined(DEVELOPER)
@@ -620,20 +638,10 @@
* Check if someone has an oplock on this file. If so
* we must break it before continuing.
*/
-
- /* Was this a delete this file request ? */
- if (!*p_oplock_request && access_mask == DELETE_ACCESS &&
- !BATCH_OPLOCK_TYPE(share_entry->op_type)) {
- /* Don't break the oplock in this case. */
- cause_oplock_break = False;
- } else if((*p_oplock_request &&
- EXCLUSIVE_OPLOCK_TYPE(share_entry->op_type)) ||
- (!*p_oplock_request &&
- (share_entry->op_type != NO_OPLOCK))) {
- cause_oplock_break = True;
- }
- if(cause_oplock_break) {
+ if (cause_oplock_break(*p_oplock_request,
+ share_entry->op_type,
+ access_mask)) {
BOOL opb_ret;
DEBUG(5,("open_mode_check: oplock_request = "
More information about the samba-cvs
mailing list