[SCM] Samba Shared Repository - branch master updated
Stefan Metzmacher
metze at samba.org
Tue Jun 26 06:09:07 MDT 2012
The branch, master has been updated
via 5df1fda s3: Restore async i/o with the "native" AIO interface
via 93399c1 s3:smbXsrv_tcon: pass max_tcons explicitly for smbXsrv_tcon_table_init()
via 9c36781 s3:smbXsrv_session: pass max_sessions explicitly for smbXsrv_session_table_init()
from 66f59f0 tdb: finish weaning off err.h.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 5df1fda0f5f775c0ccf23412b29b2fd8b013156e
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jun 25 12:23:22 2012 +0200
s3: Restore async i/o with the "native" AIO interface
eff3609 moved the async signal handler initialization to later in the process
to enable aio_fork and aio_pthread on platforms without realtime signals. This
commit broke the use of the native aio interface. aio_pending_size is
initialized to 0, so aio.c will not allow async i/0 at all if modules do not
set that variable correctly. Initialize to 100 right from the start.
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Tue Jun 26 14:08:22 CEST 2012 on sn-devel-104
commit 93399c1ec309fd98eb78d10ba11a3a92d8217837
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jun 25 08:13:59 2012 +0200
s3:smbXsrv_tcon: pass max_tcons explicitly for smbXsrv_tcon_table_init()
metze
commit 9c36781580bdaf47108c8775e2eff97b0a256e74
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jun 25 08:13:59 2012 +0200
s3:smbXsrv_session: pass max_sessions explicitly for smbXsrv_session_table_init()
metze
-----------------------------------------------------------------------
Summary of changes:
source3/smbd/aio.c | 3 ---
source3/smbd/globals.c | 2 +-
source3/smbd/smbXsrv_session.c | 33 ++++++++++++++++++++++++---------
source3/smbd/smbXsrv_tcon.c | 33 ++++++++++++++++++++++++---------
4 files changed, 49 insertions(+), 22 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 7ba0bdc..ec68b90 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -91,9 +91,6 @@ bool initialize_async_io_handler(void)
DEBUG(10, ("Failed to setup RT_SIGNAL_AIO handler\n"));
return false;
}
-
- /* tevent supports 100 signal with SA_SIGINFO */
- aio_pending_size = 100;
return true;
}
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index 7c4ffec..87ecff7 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -28,7 +28,7 @@
#if defined(HAVE_AIO)
struct aio_extra *aio_list_head = NULL;
struct tevent_signal *aio_signal_event = NULL;
-int aio_pending_size = 0;
+int aio_pending_size = 100; /* tevent supports 100 signals SA_SIGINFO */
int outstanding_aio_calls = 0;
#endif
diff --git a/source3/smbd/smbXsrv_session.c b/source3/smbd/smbXsrv_session.c
index 9ae078e..f31d85b 100644
--- a/source3/smbd/smbXsrv_session.c
+++ b/source3/smbd/smbXsrv_session.c
@@ -44,6 +44,7 @@ struct smbXsrv_session_table {
struct db_context *db_ctx;
uint32_t lowest_id;
uint32_t highest_id;
+ uint32_t max_sessions;
uint32_t num_sessions;
} local;
struct {
@@ -161,12 +162,26 @@ static void smbXsrv_session_close_loop(struct tevent_req *subreq);
static NTSTATUS smbXsrv_session_table_init(struct smbXsrv_connection *conn,
uint32_t lowest_id,
- uint32_t highest_id)
+ uint32_t highest_id,
+ uint32_t max_sessions)
{
struct smbXsrv_session_table *table;
NTSTATUS status;
struct tevent_req *subreq;
int ret;
+ uint64_t max_range;
+
+ if (lowest_id > highest_id) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ max_range = highest_id;
+ max_range -= lowest_id;
+ max_range += 1;
+
+ if (max_sessions > max_range) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
table = talloc_zero(conn, struct smbXsrv_session_table);
if (table == NULL) {
@@ -180,6 +195,7 @@ static NTSTATUS smbXsrv_session_table_init(struct smbXsrv_connection *conn,
}
table->local.lowest_id = lowest_id;
table->local.highest_id = highest_id;
+ table->local.max_sessions = max_sessions;
status = smbXsrv_session_global_init();
if (!NT_STATUS_IS_OK(status)) {
@@ -1064,7 +1080,6 @@ NTSTATUS smbXsrv_session_create(struct smbXsrv_connection *conn,
struct smbXsrv_session **_session)
{
struct smbXsrv_session_table *table = conn->session_table;
- uint32_t max_sessions = table->local.highest_id - table->local.lowest_id;
struct db_record *local_rec = NULL;
struct smbXsrv_session *session = NULL;
void *ptr = NULL;
@@ -1073,7 +1088,7 @@ NTSTATUS smbXsrv_session_create(struct smbXsrv_connection *conn,
struct smbXsrv_channel_global0 *channels = NULL;
NTSTATUS status;
- if (table->local.num_sessions >= max_sessions) {
+ if (table->local.num_sessions >= table->local.max_sessions) {
return NT_STATUS_INSUFFICIENT_RESOURCES;
}
@@ -1470,9 +1485,10 @@ static int smbXsrv_session_logoff_all_callback(struct db_record *local_rec,
NTSTATUS smb1srv_session_table_init(struct smbXsrv_connection *conn)
{
/*
- * Allow a range from 1..65534.
+ * Allow a range from 1..65534 with 65534 values.
*/
- return smbXsrv_session_table_init(conn, 1, UINT16_MAX - 1);
+ return smbXsrv_session_table_init(conn, 1, UINT16_MAX - 1,
+ UINT16_MAX - 1);
}
NTSTATUS smb1srv_session_lookup(struct smbXsrv_connection *conn,
@@ -1488,11 +1504,10 @@ NTSTATUS smb1srv_session_lookup(struct smbXsrv_connection *conn,
NTSTATUS smb2srv_session_table_init(struct smbXsrv_connection *conn)
{
/*
- * For now use the same range as SMB1.
- *
- * Allow a range from 1..65534.
+ * Allow a range from 1..4294967294 with 65534 (same as SMB1) values.
*/
- return smbXsrv_session_table_init(conn, 1, UINT16_MAX - 1);
+ return smbXsrv_session_table_init(conn, 1, UINT32_MAX - 1,
+ UINT16_MAX - 1);
}
NTSTATUS smb2srv_session_lookup(struct smbXsrv_connection *conn,
diff --git a/source3/smbd/smbXsrv_tcon.c b/source3/smbd/smbXsrv_tcon.c
index d258911..9f8162a 100644
--- a/source3/smbd/smbXsrv_tcon.c
+++ b/source3/smbd/smbXsrv_tcon.c
@@ -35,6 +35,7 @@ struct smbXsrv_tcon_table {
struct db_context *db_ctx;
uint32_t lowest_id;
uint32_t highest_id;
+ uint32_t max_tcons;
uint32_t num_tcons;
} local;
struct {
@@ -147,9 +148,23 @@ static NTSTATUS smbXsrv_tcon_local_key_to_id(TDB_DATA key, uint32_t *id)
static NTSTATUS smbXsrv_tcon_table_init(TALLOC_CTX *mem_ctx,
struct smbXsrv_tcon_table *table,
uint32_t lowest_id,
- uint32_t highest_id)
+ uint32_t highest_id,
+ uint32_t max_tcons)
{
NTSTATUS status;
+ uint64_t max_range;
+
+ if (lowest_id > highest_id) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ max_range = highest_id;
+ max_range -= lowest_id;
+ max_range += 1;
+
+ if (max_tcons > max_range) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
ZERO_STRUCTP(table);
table->local.db_ctx = db_open_rbt(table);
@@ -158,6 +173,7 @@ static NTSTATUS smbXsrv_tcon_table_init(TALLOC_CTX *mem_ctx,
}
table->local.lowest_id = lowest_id;
table->local.highest_id = highest_id;
+ table->local.max_tcons = max_tcons;
status = smbXsrv_tcon_global_init();
if (!NT_STATUS_IS_OK(status)) {
@@ -685,7 +701,6 @@ static NTSTATUS smbXsrv_tcon_create(struct smbXsrv_connection *conn,
NTTIME now,
struct smbXsrv_tcon **_tcon)
{
- uint32_t max_tcons = table->local.highest_id - table->local.lowest_id;
struct db_record *local_rec = NULL;
struct smbXsrv_tcon *tcon = NULL;
void *ptr = NULL;
@@ -693,7 +708,7 @@ static NTSTATUS smbXsrv_tcon_create(struct smbXsrv_connection *conn,
struct smbXsrv_tcon_global0 *global = NULL;
NTSTATUS status;
- if (table->local.num_tcons >= max_tcons) {
+ if (table->local.num_tcons >= table->local.max_tcons) {
return NT_STATUS_INSUFFICIENT_RESOURCES;
}
@@ -1055,7 +1070,7 @@ static int smbXsrv_tcon_disconnect_all_callback(struct db_record *local_rec,
NTSTATUS smb1srv_tcon_table_init(struct smbXsrv_connection *conn)
{
/*
- * Allow a range from 1..65534.
+ * Allow a range from 1..65534 with 65534 values.
*/
conn->tcon_table = talloc_zero(conn, struct smbXsrv_tcon_table);
if (conn->tcon_table == NULL) {
@@ -1063,7 +1078,8 @@ NTSTATUS smb1srv_tcon_table_init(struct smbXsrv_connection *conn)
}
return smbXsrv_tcon_table_init(conn, conn->tcon_table,
- 1, UINT16_MAX - 1);
+ 1, UINT16_MAX - 1,
+ UINT16_MAX - 1);
}
NTSTATUS smb1srv_tcon_create(struct smbXsrv_connection *conn,
@@ -1106,9 +1122,7 @@ NTSTATUS smb1srv_tcon_disconnect_all(struct smbXsrv_connection *conn)
NTSTATUS smb2srv_tcon_table_init(struct smbXsrv_session *session)
{
/*
- * For now use the same range as SMB1.
- *
- * Allow a range from 1..65534.
+ * Allow a range from 1..4294967294 with 65534 (same as SMB1) values.
*/
session->tcon_table = talloc_zero(session, struct smbXsrv_tcon_table);
if (session->tcon_table == NULL) {
@@ -1116,7 +1130,8 @@ NTSTATUS smb2srv_tcon_table_init(struct smbXsrv_session *session)
}
return smbXsrv_tcon_table_init(session, session->tcon_table,
- 1, UINT16_MAX - 1);
+ 1, UINT32_MAX - 1,
+ UINT16_MAX - 1);
}
NTSTATUS smb2srv_tcon_create(struct smbXsrv_session *session,
--
Samba Shared Repository
More information about the samba-cvs
mailing list