mirror of
https://github.com/samba-team/samba.git
synced 2025-03-01 04:58:35 +03:00
r4143: Make strict locking an enum. Auto means use oplock optimization.
Jeremy. (This used to be commit 0dd4adeae2042d0ea64398a78b3f48eb0150c133)
This commit is contained in:
parent
3c45a093c4
commit
9345663328
@ -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",
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user