diff options
author | Jeremy Allison <jra@samba.org> | 2007-06-22 17:19:08 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:23:33 -0500 |
commit | 08a9de8927bbca982be4e566e56748045defc1c7 (patch) | |
tree | cfc00ff05a047dbe7209ab3c874a36b7526074c9 /source3 | |
parent | 32a3c30627fad859bc7fa218cc40e7b056bac30d (diff) | |
download | samba-08a9de8927bbca982be4e566e56748045defc1c7.tar.gz samba-08a9de8927bbca982be4e566e56748045defc1c7.tar.bz2 samba-08a9de8927bbca982be4e566e56748045defc1c7.zip |
r23589: Ensure we will always release any timeout handler
on fsp close or removal of oplock. Mulitple removals
are safe.
Jeremy.
(This used to be commit 6de0970704b3eff2b71e6bf499c6dda45d4d5e2d)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/files.c | 3 | ||||
-rw-r--r-- | source3/smbd/oplock.c | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 590916011b..9994b50d15 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -439,6 +439,9 @@ void file_free(files_struct *fsp) TALLOC_FREE(fsp->notify); } + /* Ensure this event will never fire. */ + TALLOC_FREE(fsp->oplock_timeout); + bitmap_clear(file_bmap, fsp->fnum - FILE_HANDLE_OFFSET); files_used--; diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index ddb05d8b92..39fc847d6f 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -152,6 +152,8 @@ void release_file_oplock(files_struct *fsp) fsp->sent_oplock_break = NO_BREAK_SENT; flush_write_cache(fsp, OPLOCK_RELEASE_FLUSH); + + TALLOC_FREE(fsp->oplock_timeout); } /**************************************************************************** @@ -341,12 +343,8 @@ static void oplock_timeout_handler(struct event_context *ctx, { files_struct *fsp = (files_struct *)private_data; - /* Ensure we always remove this event. */ - if (fsp->oplock_timeout != NULL) { - /* Remove the timed event handler. */ - TALLOC_FREE(fsp->oplock_timeout); - fsp->oplock_timeout = NULL; - } + /* Remove the timed event handler. */ + TALLOC_FREE(fsp->oplock_timeout); DEBUG(0, ("Oplock break failed for file %s -- replying anyway\n", fsp->fsp_name)); global_client_failed_oplock_break = True; remove_oplock(fsp); |