summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2012-06-07 16:27:24 +0200
committerStefan Metzmacher <metze@samba.org>2012-06-15 03:28:13 +0200
commit7aa9ad5bb9ce33c7e664582b5014917e84153314 (patch)
treea2681e4f679cb9d9077f60b7dd72e5fce33f0210
parent82a96d243214a748fa38bd10894309c3f6e6a20b (diff)
downloadsamba-7aa9ad5bb9ce33c7e664582b5014917e84153314.tar.gz
samba-7aa9ad5bb9ce33c7e664582b5014917e84153314.tar.bz2
samba-7aa9ad5bb9ce33c7e664582b5014917e84153314.zip
s3:files: reorder file_free() a bit
Pair-Programmed-With: Volker Lendecke <vl@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
-rw-r--r--source3/smbd/files.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 25749c2714..c3a7465feb 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -502,18 +502,7 @@ void file_sync_all(connection_struct *conn)
void file_free(struct smb_request *req, files_struct *fsp)
{
struct smbd_server_connection *sconn = fsp->conn->sconn;
-
- DLIST_REMOVE(sconn->files, fsp);
- SMB_ASSERT(sconn->num_files > 0);
- sconn->num_files--;
-
- TALLOC_FREE(fsp->fake_file_handle);
-
- if (fsp->fh->ref_count == 1) {
- TALLOC_FREE(fsp->fh);
- } else {
- fsp->fh->ref_count--;
- }
+ int fnum = fsp->fnum;
if (fsp->notify) {
struct notify_context *notify_ctx =
@@ -528,10 +517,6 @@ void file_free(struct smb_request *req, files_struct *fsp)
if (sconn->file_bmap != NULL) {
bitmap_clear(sconn->file_bmap, fsp->fnum - FILE_HANDLE_OFFSET);
}
- DEBUG(5,("freed files structure %d (%u used)\n",
- fsp->fnum, (unsigned int)sconn->num_files));
-
- fsp->conn->num_files_open--;
if ((req != NULL) && (fsp == req->chain_fsp)) {
req->chain_fsp = NULL;
@@ -553,12 +538,29 @@ void file_free(struct smb_request *req, files_struct *fsp)
/* Drop all remaining extensions. */
vfs_remove_all_fsp_extensions(fsp);
+ DLIST_REMOVE(sconn->files, fsp);
+ SMB_ASSERT(sconn->num_files > 0);
+ sconn->num_files--;
+
+ TALLOC_FREE(fsp->fake_file_handle);
+
+ if (fsp->fh->ref_count == 1) {
+ TALLOC_FREE(fsp->fh);
+ } else {
+ fsp->fh->ref_count--;
+ }
+
+ fsp->conn->num_files_open--;
+
/* this is paranoia, just in case someone tries to reuse the
information */
ZERO_STRUCTP(fsp);
/* fsp->fsp_name is a talloc child and is free'd automatically. */
TALLOC_FREE(fsp);
+
+ DEBUG(5,("freed files structure %d (%u used)\n",
+ fnum, (unsigned int)sconn->num_files));
}
/****************************************************************************