[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Thu Apr 1 17:49:11 MDT 2010
The branch, master has been updated
via bf90969... Move initialize_async_io_handler() inside of smbd/aio.c.
from b6aabcd... Add torture test for bug 7310 - DOS attribute inconsistency with MS Office
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit bf90969892411f28ea330611156ddfec5e2e1321
Author: Jeremy Allison <jra at samba.org>
Date: Thu Apr 1 16:47:59 2010 -0700
Move initialize_async_io_handler() inside of smbd/aio.c.
Call from actual aio read or write. No reason to call this globally on startup.
Jeremy.
-----------------------------------------------------------------------
Summary of changes:
source3/include/proto.h | 1 -
source3/smbd/aio.c | 76 ++++++++++++++++++++++++++---------------------
source3/smbd/process.c | 3 --
3 files changed, 42 insertions(+), 38 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 2ebc75c..c9fe610 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -6047,7 +6047,6 @@ struct regval_ctr *svcctl_fetch_regvalues( const char *name, NT_USER_TOKEN *toke
/* The following definitions come from smbd/aio.c */
-void initialize_async_io_handler(void);
bool schedule_aio_read_and_X(connection_struct *conn,
struct smb_request *req,
files_struct *fsp, SMB_OFF_T startpos,
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 751fed1..a04f3d5 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -36,6 +36,42 @@
#endif
/****************************************************************************
+ Initialize the signal handler for aio read/write.
+*****************************************************************************/
+
+static void smbd_aio_signal_handler(struct tevent_context *ev_ctx,
+ struct tevent_signal *se,
+ int signum, int count,
+ void *_info, void *private_data)
+{
+ siginfo_t *info = (siginfo_t *)_info;
+ unsigned int mid = (unsigned int)info->si_value.sival_int;
+
+ smbd_aio_complete_mid(mid);
+}
+
+
+static void initialize_async_io_handler(void)
+{
+ if (aio_signal_event) {
+ return;
+ }
+
+ aio_signal_event = tevent_add_signal(smbd_event_context(),
+ smbd_event_context(),
+ RT_SIGNAL_AIO, SA_SIGINFO,
+ smbd_aio_signal_handler,
+ NULL);
+ if (!aio_signal_event) {
+ exit_server("Failed to setup RT_SIGNAL_AIO handler");
+ }
+
+ /* tevent supports 100 signal with SA_SIGINFO */
+ aio_pending_size = 100;
+}
+
+
+/****************************************************************************
The buffer we keep around whilst an aio request is in process.
*****************************************************************************/
@@ -154,6 +190,9 @@ bool schedule_aio_read_and_X(connection_struct *conn,
bufsize = smb_size + 12 * 2 + smb_maxcnt;
+ /* Ensure aio is initialized. */
+ initialize_async_io_handler();
+
if ((aio_ex = create_aio_extra(fsp, bufsize)) == NULL) {
DEBUG(10,("schedule_aio_read_and_X: malloc fail.\n"));
return False;
@@ -247,6 +286,9 @@ bool schedule_aio_write_and_X(connection_struct *conn,
return False;
}
+ /* Ensure aio is initialized. */
+ initialize_async_io_handler();
+
bufsize = smb_size + 6*2;
if (!(aio_ex = create_aio_extra(fsp, bufsize))) {
@@ -535,17 +577,6 @@ void smbd_aio_complete_mid(unsigned int mid)
TALLOC_FREE(aio_ex);
}
-static void smbd_aio_signal_handler(struct tevent_context *ev_ctx,
- struct tevent_signal *se,
- int signum, int count,
- void *_info, void *private_data)
-{
- siginfo_t *info = (siginfo_t *)_info;
- unsigned int mid = (unsigned int)info->si_value.sival_int;
-
- smbd_aio_complete_mid(mid);
-}
-
/****************************************************************************
We're doing write behind and the client closed the file. Wait up to 30
seconds (my arbitrary choice) for the aio to complete. Return 0 if all writes
@@ -675,30 +706,7 @@ void cancel_aio_by_fsp(files_struct *fsp)
}
}
-/****************************************************************************
- Initialize the signal handler for aio read/write.
-*****************************************************************************/
-
-void initialize_async_io_handler(void)
-{
- aio_signal_event = tevent_add_signal(smbd_event_context(),
- smbd_event_context(),
- RT_SIGNAL_AIO, SA_SIGINFO,
- smbd_aio_signal_handler,
- NULL);
- if (!aio_signal_event) {
- exit_server("Failed to setup RT_SIGNAL_AIO handler");
- }
-
- /* tevent supports 100 signal with SA_SIGINFO */
- aio_pending_size = 100;
-}
-
#else
-void initialize_async_io_handler(void)
-{
-}
-
bool schedule_aio_read_and_X(connection_struct *conn,
struct smb_request *req,
files_struct *fsp, SMB_OFF_T startpos,
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 40c85d4..485439a 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2852,9 +2852,6 @@ void smbd_process(void)
if (!init_oplocks(smbd_messaging_context()))
exit_server("Failed to init oplocks");
- /* Setup aio signal handler. */
- initialize_async_io_handler();
-
/* register our message handlers */
messaging_register(smbd_messaging_context(), NULL,
MSG_SMB_FORCE_TDIS, msg_force_tdis);
--
Samba Shared Repository
More information about the samba-cvs
mailing list