s3: Remove smbd_server_conn from files_forall
authorVolker Lendecke <vl@samba.org>
Mon, 27 Sep 2010 01:53:00 +0000 (03:53 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 28 Sep 2010 05:36:16 +0000 (07:36 +0200)
source3/include/proto.h
source3/modules/vfs_aio_fork.c
source3/smbd/files.c
source3/smbd/server_exit.c

index 2319020ad29ff601af8a17d153fcaf31ff1008a0..af25db66a1e02090dfe2406eeac908ed3fcda0b0 100644 (file)
@@ -4756,6 +4756,7 @@ void file_close_pid(struct smbd_server_connection *sconn, uint16 smbpid,
 void file_init(void);
 void file_close_user(struct smbd_server_connection *sconn, int vuid);
 struct files_struct *files_forall(
+       struct smbd_server_connection *sconn,
        struct files_struct *(*fn)(struct files_struct *fsp,
                                   void *private_data),
        void *private_data);
index 02b1394216cef6964f07e5eb8a51a28471e11f12..90d06b10c166e2da2ebb4a446fd75f034a6a1de7 100644 (file)
@@ -442,7 +442,8 @@ static struct files_struct *close_fsp_fd(struct files_struct *fsp,
        return NULL;
 }
 
-static NTSTATUS create_aio_child(struct aio_child_list *children,
+static NTSTATUS create_aio_child(struct smbd_server_connection *sconn,
+                                struct aio_child_list *children,
                                 size_t map_size,
                                 struct aio_child **presult)
 {
@@ -480,7 +481,7 @@ static NTSTATUS create_aio_child(struct aio_child_list *children,
        if (result->pid == 0) {
                close(fdpair[0]);
                result->sockfd = fdpair[1];
-               files_forall(close_fsp_fd, NULL);
+               files_forall(sconn, close_fsp_fd, NULL);
                aio_child_loop(result->sockfd, result->map);
        }
 
@@ -538,7 +539,8 @@ static NTSTATUS get_idle_child(struct vfs_handle_struct *handle,
        if (child == NULL) {
                DEBUG(10, ("no idle child found, creating new one\n"));
 
-               status = create_aio_child(children, 128*1024, &child);
+               status = create_aio_child(handle->conn->sconn, children,
+                                         128*1024, &child);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(10, ("create_aio_child failed: %s\n",
                                   nt_errstr(status)));
index a50bd950a5e9f72c2d8227f283fb63ca97d3cd72..5293529411b390245f7dc454492d501fc75dddea 100644 (file)
@@ -226,13 +226,14 @@ void file_close_user(struct smbd_server_connection *sconn, int vuid)
  */
 
 struct files_struct *files_forall(
+       struct smbd_server_connection *sconn,
        struct files_struct *(*fn)(struct files_struct *fsp,
                                   void *private_data),
        void *private_data)
 {
        struct files_struct *fsp, *next;
 
-       for (fsp = smbd_server_conn->files; fsp; fsp = next) {
+       for (fsp = sconn->files; fsp; fsp = next) {
                struct files_struct *ret;
                next = fsp->next;
                ret = fn(fsp, private_data);
index 1a330994b8a74082e323deb04a6f1f8293802dae..9f2d6b3e9af3697eb8ea6484564953c01702c9c8 100644 (file)
@@ -78,12 +78,11 @@ static void exit_server_common(enum server_exit_reason how,
                TALLOC_FREE(sconn->smb1.negprot.auth_context);
        }
 
-       if (lp_log_writeable_files_on_exit()) {
-               bool found = false;
-               files_forall(log_writeable_file_fn, &found);
-       }
-
        if (sconn) {
+               if (lp_log_writeable_files_on_exit()) {
+                       bool found = false;
+                       files_forall(sconn, log_writeable_file_fn, &found);
+               }
                had_open_conn = conn_close_all(sconn);
                invalidate_all_vuids(sconn);
        }