summaryrefslogtreecommitdiff
path: root/source3/smbd/aio.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-07-18 14:40:43 +0200
committerVolker Lendecke <vl@samba.org>2010-07-18 21:22:41 +0200
commit55512f479172047ae7f69604c23fffecf66de8c4 (patch)
tree169fa2b40939e86cbc9bbcbb440b3a6204c19a24 /source3/smbd/aio.c
parentb1717ac92edbc08e1f4cd2a38dd9f60be8492469 (diff)
downloadsamba-55512f479172047ae7f69604c23fffecf66de8c4.tar.gz
samba-55512f479172047ae7f69604c23fffecf66de8c4.tar.bz2
samba-55512f479172047ae7f69604c23fffecf66de8c4.zip
s3: Work better without the aio sighandler
Refuse async I/O if we can't set up the signal handler
Diffstat (limited to 'source3/smbd/aio.c')
-rw-r--r--source3/smbd/aio.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index a5a0e44738..dbce120dc6 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -67,11 +67,17 @@ static void smbd_aio_signal_handler(struct tevent_context *ev_ctx,
}
-static void initialize_async_io_handler(void)
+static bool initialize_async_io_handler(void)
{
+ static bool tried_signal_setup = false;
+
if (aio_signal_event) {
- return;
+ return true;
+ }
+ if (tried_signal_setup) {
+ return false;
}
+ tried_signal_setup = true;
aio_signal_event = tevent_add_signal(smbd_event_context(),
smbd_event_context(),
@@ -79,7 +85,8 @@ static void initialize_async_io_handler(void)
smbd_aio_signal_handler,
NULL);
if (!aio_signal_event) {
- exit_server("Failed to setup RT_SIGNAL_AIO handler");
+ DEBUG(10, ("Failed to setup RT_SIGNAL_AIO handler\n"));
+ return false;
}
/* tevent supports 100 signal with SA_SIGINFO */
@@ -145,7 +152,9 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
int ret;
/* Ensure aio is initialized. */
- initialize_async_io_handler();
+ if (!initialize_async_io_handler()) {
+ return NT_STATUS_RETRY;
+ }
if (fsp->base_fsp != NULL) {
/* No AIO on streams yet */
@@ -250,7 +259,9 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
int ret;
/* Ensure aio is initialized. */
- initialize_async_io_handler();
+ if (!initialize_async_io_handler()) {
+ return NT_STATUS_RETRY;
+ }
if (fsp->base_fsp != NULL) {
/* No AIO on streams yet */
@@ -382,7 +393,9 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
int ret;
/* Ensure aio is initialized. */
- initialize_async_io_handler();
+ if (!initialize_async_io_handler()) {
+ return NT_STATUS_RETRY;
+ }
if (fsp->base_fsp != NULL) {
/* No AIO on streams yet */
@@ -478,7 +491,9 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
int ret;
/* Ensure aio is initialized. */
- initialize_async_io_handler();
+ if (!initialize_async_io_handler()) {
+ return NT_STATUS_RETRY;
+ }
if (fsp->base_fsp != NULL) {
/* No AIO on streams yet */