diff options
Diffstat (limited to 'source3/smbd/blocking.c')
-rw-r--r-- | source3/smbd/blocking.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c index 9d411711cb..6623c6df64 100644 --- a/source3/smbd/blocking.c +++ b/source3/smbd/blocking.c @@ -531,33 +531,13 @@ file %s fnum = %d\n", blr->com_type, fsp->fsp_name, fsp->fnum )); } /**************************************************************************** - Return the number of seconds to the next blocking locks timeout, or default_timeout + Return True if the blocking lock queue has entries. *****************************************************************************/ -unsigned blocking_locks_timeout(unsigned default_timeout) -{ - unsigned timeout = default_timeout; - time_t t; - blocking_lock_record *blr = (blocking_lock_record *)ubi_slFirst(&blocking_lock_queue); - - /* note that we avoid the time() syscall if there are no blocking locks */ - if (!blr) { - return timeout; - } - - t = time(NULL); - - while (blr) { - if (timeout > (blr->expire_time - t)) { - timeout = blr->expire_time - t; - } - blr = (blocking_lock_record *)ubi_slNext(blr); - } - - if (timeout < 1) { - timeout = 1; - } - return timeout; +BOOL blocking_locks_pending(void) +{ + blocking_lock_record *blr = (blocking_lock_record *)ubi_slFirst( &blocking_lock_queue ); + return (blr == NULL ? False : True); } /**************************************************************************** @@ -596,7 +576,7 @@ void process_blocking_lock_queue(time_t t) DEBUG(5,("process_blocking_lock_queue: examining pending lock fnum = %d for file %s\n", fsp->fnum, fsp->fsp_name )); - if((blr->expire_time != -1) && (blr->expire_time <= t)) { + if((blr->expire_time != -1) && (blr->expire_time > t)) { /* * Lock expired - throw away all previously * obtained locks and return lock error. @@ -604,7 +584,7 @@ void process_blocking_lock_queue(time_t t) DEBUG(5,("process_blocking_lock_queue: pending lock fnum = %d for file %s timed out.\n", fsp->fnum, fsp->fsp_name )); - blocking_lock_reply_error(blr,NT_STATUS_FILE_LOCK_CONFLICT); + blocking_lock_reply_error(blr,NT_STATUS_ACCESS_DENIED); free_blocking_lock_record((blocking_lock_record *)ubi_slRemNext( &blocking_lock_queue, prev)); blr = (blocking_lock_record *)(prev ? ubi_slNext(prev) : ubi_slFirst(&blocking_lock_queue)); continue; |