diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/locking/locking.c | 25 | ||||
-rw-r--r-- | source3/param/loadparm.c | 8 | ||||
-rw-r--r-- | source3/smbd/reply.c | 2 |
3 files changed, 21 insertions, 14 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", diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 094eff81c0..d8aef215b8 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -386,7 +386,7 @@ typedef struct BOOL bMap_archive; BOOL bStoreDosAttributes; BOOL bLocking; - BOOL bStrictLocking; + int iStrictLocking; BOOL bPosixLocking; BOOL bShareModes; BOOL bOpLocks; @@ -511,7 +511,7 @@ static service sDefault = { True, /* bMap_archive */ False, /* bStoreDosAttributes */ True, /* bLocking */ - True, /* bStrictLocking */ + True, /* iStrictLocking */ True, /* bPosixLocking */ True, /* bShareModes */ True, /* bOpLocks */ @@ -1075,7 +1075,7 @@ static struct parm_struct parm_table[] = { {"oplock break wait time", P_INTEGER, P_GLOBAL, &Globals.oplock_break_wait_time, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL}, {"oplock contention limit", P_INTEGER, P_LOCAL, &sDefault.iOplockContentionLimit, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL}, {"posix locking", P_BOOL, P_LOCAL, &sDefault.bPosixLocking, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL}, - {"strict locking", P_BOOL, P_LOCAL, &sDefault.bStrictLocking, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL}, + {"strict locking", P_ENUM, P_LOCAL, &sDefault.iStrictLocking, NULL, enum_bool_auto, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL}, {"share modes", P_BOOL, P_LOCAL, &sDefault.bShareModes, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL}, {N_("Ldap Options"), P_SEP, P_SEPARATOR}, @@ -1858,7 +1858,7 @@ FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden) FN_LOCAL_BOOL(lp_map_archive, bMap_archive) FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes) FN_LOCAL_BOOL(lp_locking, bLocking) -FN_LOCAL_BOOL(lp_strict_locking, bStrictLocking) +FN_LOCAL_INTEGER(lp_strict_locking, iStrictLocking) FN_LOCAL_BOOL(lp_posix_locking, bPosixLocking) FN_LOCAL_BOOL(lp_share_modes, bShareModes) FN_LOCAL_BOOL(lp_oplocks, bOpLocks) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 507e4c1c37..825f76fcd5 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -4578,7 +4578,7 @@ int reply_lockingX(connection_struct *conn, char *inbuf,char *outbuf,int length, /* we don't support these - and CANCEL_LOCK makes w2k and XP reboot so I don't really want to be compatible! (tridge) */ - return ERROR_NT(NT_STATUS_NOT_SUPPORTED); + return ERROR_NT(NT_STATUS_UNSUCCESSFUL); } if (locktype & LOCKING_ANDX_CANCEL_LOCK) { |