Changeset 232 for branches/samba-3.2.x/source/smbd/oplock.c
- Timestamp:
- May 27, 2009, 9:09:42 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.2.x/source/smbd/oplock.c
r137 r232 105 105 bool set_file_oplock(files_struct *fsp, int oplock_type) 106 106 { 107 if (koplocks && !koplocks->set_oplock(fsp, oplock_type)) { 107 if ((fsp->oplock_type != NO_OPLOCK) && 108 (fsp->oplock_type != FAKE_LEVEL_II_OPLOCK) && 109 koplocks && 110 !koplocks->set_oplock(fsp, oplock_type)) { 108 111 return False; 109 112 } … … 113 116 if (oplock_type == LEVEL_II_OPLOCK) { 114 117 level_II_oplocks_open++; 115 } else {118 } else if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) { 116 119 exclusive_oplocks_open++; 117 120 } … … 146 149 SMB_ASSERT(exclusive_oplocks_open>=0); 147 150 SMB_ASSERT(level_II_oplocks_open>=0); 148 149 fsp->oplock_type = NO_OPLOCK; 151 152 if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) { 153 /* This doesn't matter for close. */ 154 fsp->oplock_type = FAKE_LEVEL_II_OPLOCK; 155 } else { 156 fsp->oplock_type = NO_OPLOCK; 157 } 150 158 fsp->sent_oplock_break = NO_BREAK_SENT; 151 159 152 160 flush_write_cache(fsp, OPLOCK_RELEASE_FLUSH); 153 161 … … 436 444 SMB_ASSERT(fsp->oplock_type == LEVEL_II_OPLOCK); 437 445 446 DEBUG(10,("process_oplock_async_level2_break_message: sending break to " 447 "none message for fid %d, file %s\n", 448 fsp->fnum, 449 fsp->fsp_name)); 450 438 451 /* Now send a break to none message to our client. */ 439 452 … … 809 822 share_mode_entry_to_message(msg, share_entry); 810 823 811 messaging_send_buf(smbd_messaging_context(), share_entry->pid, 812 MSG_SMB_ASYNC_LEVEL2_BREAK, 813 (uint8 *)msg, 814 MSG_SMB_SHARE_MODE_ENTRY_SIZE); 824 /* 825 * Deal with a race condition when breaking level2 826 * oplocks. Don't send all the messages and release 827 * the lock, this allows someone else to come in and 828 * get a level2 lock before any of the messages are 829 * processed, and thus miss getting a break message. 830 * Ensure at least one entry (the one we're breaking) 831 * is processed immediately under the lock and becomes 832 * set as NO_OPLOCK to stop any waiter getting a level2. 833 * Bugid #5980. 834 */ 835 836 if (procid_is_me(&share_entry->pid)) { 837 DATA_BLOB blob = data_blob_const(msg, 838 MSG_SMB_SHARE_MODE_ENTRY_SIZE); 839 process_oplock_async_level2_break_message(smbd_messaging_context(), 840 NULL, 841 MSG_SMB_ASYNC_LEVEL2_BREAK, 842 share_entry->pid, 843 &blob); 844 } else { 845 messaging_send_buf(smbd_messaging_context(), 846 share_entry->pid, 847 MSG_SMB_ASYNC_LEVEL2_BREAK, 848 (uint8 *)msg, 849 MSG_SMB_SHARE_MODE_ENTRY_SIZE); 850 } 815 851 } 816 852
Note:
See TracChangeset
for help on using the changeset viewer.