summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-12-11 00:30:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:53:36 -0500
commit934566332835eed5a3b768e07642c569eca37001 (patch)
treea072cc62f2fa68fd2da4fcd7db3f358c7184369b /source3/locking
parent3c45a093c435a106e08746aa3f3db824192340f1 (diff)
downloadsamba-934566332835eed5a3b768e07642c569eca37001.tar.gz
samba-934566332835eed5a3b768e07642c569eca37001.tar.bz2
samba-934566332835eed5a3b768e07642c569eca37001.zip
r4143: Make strict locking an enum. Auto means use oplock optimization.
Jeremy. (This used to be commit 0dd4adeae2042d0ea64398a78b3f48eb0150c133)
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/locking.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 4c6d89571e..e10e8a1fa0 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -69,24 +69,31 @@ BOOL is_locked(files_struct *fsp,connection_struct *conn,
enum brl_type lock_type)
{
int snum = SNUM(conn);
+ int strict_locking = lp_strict_locking(snum);
BOOL ret;
if (count == 0)
return(False);
- if (!lp_locking(snum) || !lp_strict_locking(snum))
+ if (!lp_locking(snum) || !strict_locking)
return(False);
- if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type) && (lock_type == READ_LOCK || lock_type == WRITE_LOCK)) {
- DEBUG(10,("is_locked: optimisation - exclusive oplock on file %s\n", fsp->fsp_name ));
- ret = 0;
- } else if (LEVEL_II_OPLOCK_TYPE(fsp->oplock_type) && (lock_type == READ_LOCK)) {
- DEBUG(10,("is_locked: optimisation - level II oplock on file %s\n", fsp->fsp_name ));
- ret = 0;
+ if (strict_locking == Auto) {
+ if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type) && (lock_type == READ_LOCK || lock_type == WRITE_LOCK)) {
+ DEBUG(10,("is_locked: optimisation - exclusive oplock on file %s\n", fsp->fsp_name ));
+ ret = 0;
+ } else if (LEVEL_II_OPLOCK_TYPE(fsp->oplock_type) && (lock_type == READ_LOCK)) {
+ DEBUG(10,("is_locked: optimisation - level II oplock on file %s\n", fsp->fsp_name ));
+ ret = 0;
+ } else {
+ ret = !brl_locktest(fsp->dev, fsp->inode, fsp->fnum,
+ global_smbpid, sys_getpid(), conn->cnum,
+ offset, count, lock_type);
+ }
} else {
ret = !brl_locktest(fsp->dev, fsp->inode, fsp->fnum,
- global_smbpid, sys_getpid(), conn->cnum,
- offset, count, lock_type);
+ global_smbpid, sys_getpid(), conn->cnum,
+ offset, count, lock_type);
}
DEBUG(10,("is_locked: brl start=%.0f len=%.0f %s for file %s\n",