From MS-FSA 2.1.5.18 "Server Requests an Oplock":
...
* Else If Type is LEVEL_GRANULAR:
* If RequestedOplockLevel is READ_CACHING or (READ_CACHING|HANDLE_CACHING):
* The operation MUST be failed with STATUS_OPLOCK_NOT_GRANTED under either of the
following conditions:
* Open.Stream.ByteRangeLockList is not empty and Open.Stream.AllocationSize
is greater than any ByteRangeLock.LockOffset in
Open.Stream.ByteRangeLockList.
...
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15894
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
+++ /dev/null
-^samba3.smb2.lease.lock2\(fileserver\)
bool file_has_brlocks(files_struct *fsp)
{
struct byte_range_lock *br_lck = NULL;
+ uint i, num_locks;
br_lck = brl_get_locks_readonly(fsp);
if (br_lck == NULL) {
return false;
}
- return (brl_num_locks(br_lck) > 0);
+ num_locks = brl_num_locks(br_lck);
+ if (num_locks == 0) {
+ return false;
+ }
+
+ for (i = 0; i < num_locks; i++) {
+ struct lock_struct *l = &br_lck->lock_data[i];
+
+ if (l->start < fsp->fsp_name->st.st_ex_size) {
+ return true;
+ }
+ }
+ return false;
}