1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

Ensure we've failed a lock with a lock denied message before automatically

pushing it onto the blocking queue.
Jeremy.
This commit is contained in:
Jeremy Allison -
parent c93b40f43d
commit 237e36124c
2 changed files with 12 additions and 9 deletions

View File

@ -80,17 +80,20 @@
#define FNUM_OK(fsp,c) (OPEN_FSP(fsp) && (c)==(fsp)->conn)
#define CHECK_FSP(fsp,conn) if (!FNUM_OK(fsp,conn)) \
return(ERROR_DOS(ERRDOS,ERRbadfid)); \
else if((fsp)->fd == -1) \
return(ERROR_DOS(ERRDOS,ERRbadaccess))
return(ERROR_DOS(ERRDOS,ERRbadfid)); \
else if((fsp)->fd == -1) \
return(ERROR_DOS(ERRDOS,ERRbadaccess))
#define CHECK_READ(fsp) if (!(fsp)->can_read) \
return(ERROR_DOS(ERRDOS,ERRbadaccess))
return(ERROR_DOS(ERRDOS,ERRbadaccess))
#define CHECK_WRITE(fsp) if (!(fsp)->can_write) \
return(ERROR_DOS(ERRDOS,ERRbadaccess))
return(ERROR_DOS(ERRDOS,ERRbadaccess))
#define CHECK_ERROR(fsp) if (HAS_CACHED_ERROR(fsp)) \
return(CACHED_ERROR(fsp))
return(CACHED_ERROR(fsp))
#define ERROR_WAS_LOCK_DENIED(status) (NT_STATUS_EQUAL((status), NT_STATUS_LOCK_NOT_GRANTED) || \
NT_STATUS_EQUAL((status), NT_STATUS_FILE_LOCK_CONFLICT) )
/* translates a connection number into a service number */
#define SNUM(conn) ((conn)?(conn)->service:-1)

View File

@ -1603,7 +1603,7 @@ int reply_lockread(connection_struct *conn, char *inbuf,char *outbuf, int length
(SMB_BIG_UINT)numtoread, (SMB_BIG_UINT)startpos, WRITE_LOCK);
if (NT_STATUS_V(status)) {
if (lp_blocking_locks(SNUM(conn))) {
if (lp_blocking_locks(SNUM(conn)) && ERROR_WAS_LOCK_DENIED(status)) {
/*
* A blocking lock was requested. Package up
* this smb into a queued request and push it
@ -2425,7 +2425,7 @@ int reply_lock(connection_struct *conn,
status = do_lock_spin(fsp, conn, SVAL(inbuf,smb_pid), count, offset, WRITE_LOCK);
if (NT_STATUS_V(status)) {
if (lp_blocking_locks(SNUM(conn))) {
if (lp_blocking_locks(SNUM(conn)) && ERROR_WAS_LOCK_DENIED(status)) {
/*
* A blocking lock was requested. Package up
* this smb into a queued request and push it
@ -3860,7 +3860,7 @@ no oplock granted on this file (%s).\n", fsp->fnum, fsp->fsp_name));
status = do_lock_spin(fsp,conn,lock_pid, count,offset,
((locktype & 1) ? READ_LOCK : WRITE_LOCK));
if (NT_STATUS_V(status)) {
if ((lock_timeout != 0) && lp_blocking_locks(SNUM(conn))) {
if ((lock_timeout != 0) && lp_blocking_locks(SNUM(conn)) && ERROR_WAS_LOCK_DENIED(status)) {
/*
* A blocking lock was requested. Package up
* this smb into a queued request and push it