diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-05-02 15:58:54 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:16:27 -0500 |
commit | 3716deee4cd487a040db5616b76d500c9bf051be (patch) | |
tree | 194dccdf30c5934dcdfce3adcfbec8779537dec3 /source4 | |
parent | fc5c075cff223d36f25b79650c3f739e8d79a801 (diff) | |
download | samba-3716deee4cd487a040db5616b76d500c9bf051be.tar.gz samba-3716deee4cd487a040db5616b76d500c9bf051be.tar.bz2 samba-3716deee4cd487a040db5616b76d500c9bf051be.zip |
r6579: improved the handling of lock timeouts and cancels in the pvfs locking
code. On lock cancel don't retry the lock.
(This used to be commit dffeb3c3d44d1b837a6036c47eb809ce1bd53b22)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/ntvfs/posix/pvfs_lock.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/source4/ntvfs/posix/pvfs_lock.c b/source4/ntvfs/posix/pvfs_lock.c index 6ad654f505..8015fc46c4 100644 --- a/source4/ntvfs/posix/pvfs_lock.c +++ b/source4/ntvfs/posix/pvfs_lock.c @@ -104,7 +104,6 @@ static void pvfs_pending_lock_continue(void *private, enum pvfs_wait_notice reas int i; BOOL timed_out; - /* we consider a cancel to be a timeout */ timed_out = (reason != PVFS_WAIT_EVENT); locks = lck->lockx.in.locks + lck->lockx.in.ulock_cnt; @@ -117,16 +116,21 @@ static void pvfs_pending_lock_continue(void *private, enum pvfs_wait_notice reas DLIST_REMOVE(f->pending_list, pending); - status = brl_lock(pvfs->brl_context, - &f->handle->brl_locking_key, - req->smbpid, - f->fnum, - locks[pending->pending_lock].offset, - locks[pending->pending_lock].count, - rw, NULL); - + /* we don't retry on a cancel */ + if (reason == PVFS_WAIT_CANCEL) { + status = NT_STATUS_CANCELLED; + } else { + status = brl_lock(pvfs->brl_context, + &f->handle->brl_locking_key, + req->smbpid, + f->fnum, + locks[pending->pending_lock].offset, + locks[pending->pending_lock].count, + rw, NULL); + } if (NT_STATUS_IS_OK(status)) { f->lock_count++; + timed_out = False; } /* if we have failed and timed out, or succeeded, then we @@ -153,14 +157,10 @@ static void pvfs_pending_lock_continue(void *private, enum pvfs_wait_notice reas } /* if we haven't timed out yet, then we can do more pending locks */ - if (timed_out) { - pending = NULL; + if (rw == READ_LOCK) { + rw = PENDING_READ_LOCK; } else { - if (rw == READ_LOCK) { - rw = PENDING_READ_LOCK; - } else { - rw = PENDING_WRITE_LOCK; - } + rw = PENDING_WRITE_LOCK; } /* we've now got the pending lock. try and get the rest, which might |