diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-02-22 17:26:40 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-02-26 09:29:40 +0100 |
commit | e5547201af12a7890b88585fd394f4ac59022b83 (patch) | |
tree | 1e4185dab01ac52e54fed9cb4eb7e5021d94cedf | |
parent | f94008e45a15666439766488edf84b21a86111ee (diff) | |
download | samba-e5547201af12a7890b88585fd394f4ac59022b83.tar.gz samba-e5547201af12a7890b88585fd394f4ac59022b83.tar.bz2 samba-e5547201af12a7890b88585fd394f4ac59022b83.zip |
opendb_tdb: grant level2 oplocks
metze
(This used to be commit 57f1b9d11cfcac3b5fdee1ad9e4ba81d0859c8dc)
-rw-r--r-- | source4/ntvfs/common/opendb_tdb.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index dd2fb138d6..3310532406 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -367,18 +367,32 @@ static NTSTATUS odb_tdb_open_file(struct odb_lock *lck, void *file_handle, } /* - possibly grant an exclusive or batch oplock if this is the only client - with the file open. We don't yet grant levelII oplocks. + possibly grant an exclusive, batch or level2 oplock */ - if (oplock_granted != NULL) { - if ((oplock_level == OPLOCK_BATCH || - oplock_level == OPLOCK_EXCLUSIVE) && - file.num_entries == 0) { - (*oplock_granted) = oplock_level; + if (oplock_granted) { + if (oplock_level == OPLOCK_EXCLUSIVE) { + if (file.num_entries == 0) { + e.oplock_level = OPLOCK_EXCLUSIVE; + *oplock_granted = EXCLUSIVE_OPLOCK_RETURN; + } else { + e.oplock_level = OPLOCK_NONE; + *oplock_granted = NO_OPLOCK_RETURN; + } + } else if (oplock_level == OPLOCK_BATCH) { + if (file.num_entries == 0) { + e.oplock_level = OPLOCK_BATCH; + *oplock_granted = BATCH_OPLOCK_RETURN; + } else { + e.oplock_level = OPLOCK_LEVEL_II; + *oplock_granted = LEVEL_II_OPLOCK_RETURN; + } + } else if (oplock_level == OPLOCK_LEVEL_II) { + e.oplock_level = OPLOCK_LEVEL_II; + *oplock_granted = LEVEL_II_OPLOCK_RETURN; } else { - (*oplock_granted) = OPLOCK_NONE; + e.oplock_level = OPLOCK_NONE; + *oplock_granted = NO_OPLOCK_RETURN; } - e.oplock_level = (*oplock_granted); } /* it doesn't conflict, so add it to the end */ |