diff options
author | Jeremy Allison <jra@samba.org> | 2010-05-10 11:09:41 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-05-10 11:09:41 -0700 |
commit | a9a3c83b413cf3f853845c9e9b6069ed3d7c1cde (patch) | |
tree | ab80494cc851147f57e273a63d58efe95b805e8b /source3/smbd | |
parent | 4f25baecc14f977711ea5e3ddc226113e387fba3 (diff) | |
download | samba-a9a3c83b413cf3f853845c9e9b6069ed3d7c1cde.tar.gz samba-a9a3c83b413cf3f853845c9e9b6069ed3d7c1cde.tar.bz2 samba-a9a3c83b413cf3f853845c9e9b6069ed3d7c1cde.zip |
Fix more of the SMB2-LOCK tests. Correctly unlock locks on error.
Jeremy.
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/smb2_lock.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c index ceeba86138..f9717796dd 100644 --- a/source3/smbd/smb2_lock.c +++ b/source3/smbd/smb2_lock.c @@ -38,7 +38,8 @@ struct smbd_smb2_lock_state { struct smbd_lock_element *locks; }; -static void remove_pending_lock(TALLOC_CTX *mem_ctx, struct blocking_lock_record *blr); +static void remove_pending_lock(struct smbd_smb2_lock_state *state, + struct blocking_lock_record *blr); static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, @@ -681,10 +682,12 @@ bool push_blocking_lock_request_smb2( struct byte_range_lock *br_lck, Remove a pending lock record under lock. *****************************************************************/ -static void remove_pending_lock(TALLOC_CTX *mem_ctx, struct blocking_lock_record *blr) +static void remove_pending_lock(struct smbd_smb2_lock_state *state, + struct blocking_lock_record *blr) { + int i; struct byte_range_lock *br_lck = brl_get_locks( - mem_ctx, blr->fsp); + state, blr->fsp); DEBUG(10, ("remove_pending_lock: BLR = %p\n", blr)); @@ -698,6 +701,19 @@ static void remove_pending_lock(TALLOC_CTX *mem_ctx, struct blocking_lock_record blr); TALLOC_FREE(br_lck); } + + /* Remove the locks we already got. */ + + for(i = blr->lock_num - 1; i >= 0; i--) { + struct smbd_lock_element *e = &state->locks[i]; + + do_unlock(smbd_messaging_context(), + blr->fsp, + e->smblctx, + e->count, + e->offset, + WINDOWS_LOCK); + } } /**************************************************************** |