[SCM] Samba Shared Repository - branch master updated
Stefan Metzmacher
metze at samba.org
Wed Jun 8 10:58:01 MDT 2011
The branch, master has been updated
via 0931147 s3:selftest: add a few more raw.* tests
via 957cfd2 s3:libsmb/cli_np_tstream: s/TSTREAM_CLI_NP_BUF_SIZE/TSTREAM_CLI_NP_MAX_BUF_SIZE
via ad1cf18 s3:libsmb:cli_np_tstream: use dynamic talloc buffers
from 0a3fadc s3-winbind: always use samlogon cache for wbinfo -r, even when caching is disabled.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 0931147cbca6cd2f438b2fa49d222606246e364d
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Mar 28 08:23:27 2011 +0200
s3:selftest: add a few more raw.* tests
metze
Autobuild-User: Stefan Metzmacher <metze at samba.org>
Autobuild-Date: Wed Jun 8 18:57:01 CEST 2011 on sn-devel-104
commit 957cfd23e1781e342edde07fc01dbec279088afa
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Jun 7 18:49:55 2011 +0200
s3:libsmb/cli_np_tstream: s/TSTREAM_CLI_NP_BUF_SIZE/TSTREAM_CLI_NP_MAX_BUF_SIZE
This isn't the fixed buffer size anymore, as we use dynamic beffer
it's just the maximum size.
metze
commit ad1cf187fdbcd726c6c74085308784fe4ecca883
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Jun 7 18:45:54 2011 +0200
s3:libsmb:cli_np_tstream: use dynamic talloc buffers
Having 8192 bytes on an idle connection is a bit to much,
so we better use dynamic buffers using talloc, which also
avoids a memcpy in the common SMBtrans readv codepath.
metze
-----------------------------------------------------------------------
Summary of changes:
source3/libsmb/cli_np_tstream.c | 49 +++++++++++++++++++++++++++-----------
source3/selftest/tests.py | 4 ++-
2 files changed, 38 insertions(+), 15 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/libsmb/cli_np_tstream.c b/source3/libsmb/cli_np_tstream.c
index 5e11a92..7521181 100644
--- a/source3/libsmb/cli_np_tstream.c
+++ b/source3/libsmb/cli_np_tstream.c
@@ -45,7 +45,7 @@ static const struct tstream_context_ops tstream_cli_np_ops;
* otherwise we may get NT_STATUS_PIPE_BUSY on the SMBtrans request
* from NT4 servers. (See bug #8195)
*/
-#define TSTREAM_CLI_NP_BUF_SIZE 4280
+#define TSTREAM_CLI_NP_MAX_BUF_SIZE 4280
struct tstream_cli_np {
struct cli_state *cli;
@@ -63,7 +63,7 @@ struct tstream_cli_np {
struct {
off_t ofs;
size_t left;
- uint8_t buf[TSTREAM_CLI_NP_BUF_SIZE];
+ uint8_t *buf;
} read, write;
};
@@ -363,9 +363,26 @@ static void tstream_cli_np_writev_write_next(struct tevent_req *req)
tstream_context_data(state->stream,
struct tstream_cli_np);
struct tevent_req *subreq;
+ size_t i;
+ size_t left = 0;
+
+ for (i=0; i < state->count; i++) {
+ left += state->vector[i].iov_len;
+ }
+
+ if (left == 0) {
+ TALLOC_FREE(cli_nps->write.buf);
+ tevent_req_done(req);
+ return;
+ }
cli_nps->write.ofs = 0;
- cli_nps->write.left = TSTREAM_CLI_NP_BUF_SIZE;
+ cli_nps->write.left = MIN(left, TSTREAM_CLI_NP_MAX_BUF_SIZE);
+ cli_nps->write.buf = talloc_realloc(cli_nps, cli_nps->write.buf,
+ uint8_t, cli_nps->write.left);
+ if (tevent_req_nomem(cli_nps->write.buf, req)) {
+ return;
+ }
/*
* copy the pending buffer first
@@ -391,11 +408,6 @@ static void tstream_cli_np_writev_write_next(struct tevent_req *req)
state->ret += len;
}
- if (cli_nps->write.ofs == 0) {
- tevent_req_done(req);
- return;
- }
-
if (cli_nps->trans.active && state->count == 0) {
cli_nps->trans.active = false;
cli_nps->trans.write_req = req;
@@ -634,6 +646,10 @@ static void tstream_cli_np_readv_read_next(struct tevent_req *req)
state->ret += len;
}
+ if (cli_nps->read.left == 0) {
+ TALLOC_FREE(cli_nps->read.buf);
+ }
+
if (state->count == 0) {
tevent_req_done(req);
return;
@@ -652,7 +668,7 @@ static void tstream_cli_np_readv_read_next(struct tevent_req *req)
}
subreq = cli_read_andx_send(state, state->ev, cli_nps->cli,
- cli_nps->fnum, 0, TSTREAM_CLI_NP_BUF_SIZE);
+ cli_nps->fnum, 0, TSTREAM_CLI_NP_MAX_BUF_SIZE);
if (tevent_req_nomem(subreq, req)) {
return;
}
@@ -688,7 +704,7 @@ static void tstream_cli_np_readv_trans_start(struct tevent_req *req)
NULL, 0, 0,
cli_nps->write.buf,
cli_nps->write.ofs,
- TSTREAM_CLI_NP_BUF_SIZE);
+ TSTREAM_CLI_NP_MAX_BUF_SIZE);
if (tevent_req_nomem(subreq, req)) {
return;
}
@@ -728,7 +744,7 @@ static void tstream_cli_np_readv_trans_done(struct tevent_req *subreq)
return;
}
- if (received > TSTREAM_CLI_NP_BUF_SIZE) {
+ if (received > TSTREAM_CLI_NP_MAX_BUF_SIZE) {
tstream_cli_np_readv_disconnect_now(req, EIO, __location__);
return;
}
@@ -740,8 +756,7 @@ static void tstream_cli_np_readv_trans_done(struct tevent_req *subreq)
cli_nps->read.ofs = 0;
cli_nps->read.left = received;
- memcpy(cli_nps->read.buf, rcvbuf, received);
- TALLOC_FREE(rcvbuf);
+ cli_nps->read.buf = talloc_move(cli_nps, &rcvbuf);
if (cli_nps->trans.write_req == NULL) {
tstream_cli_np_readv_read_next(req);
@@ -803,7 +818,7 @@ static void tstream_cli_np_readv_read_done(struct tevent_req *subreq)
return;
}
- if (received > TSTREAM_CLI_NP_BUF_SIZE) {
+ if (received > TSTREAM_CLI_NP_MAX_BUF_SIZE) {
TALLOC_FREE(subreq);
tstream_cli_np_readv_disconnect_now(req, EIO, __location__);
return;
@@ -817,6 +832,12 @@ static void tstream_cli_np_readv_read_done(struct tevent_req *subreq)
cli_nps->read.ofs = 0;
cli_nps->read.left = received;
+ cli_nps->read.buf = talloc_array(cli_nps, uint8_t, received);
+ if (cli_nps->read.buf == NULL) {
+ TALLOC_FREE(subreq);
+ tevent_req_nomem(cli_nps->read.buf, req);
+ return;
+ }
memcpy(cli_nps->read.buf, rcvbuf, received);
TALLOC_FREE(subreq);
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index fda3be1..361f4aa 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -161,7 +161,9 @@ raw = ["raw.acls", "raw.chkpath", "raw.close", "raw.composite", "raw.context", "
"raw.sfileinfo.base", "raw.sfileinfo.bug", "raw.streams", "raw.unlink", "raw.write",
"raw.samba3hide", "raw.samba3badpath", "raw.sfileinfo.rename",
"raw.samba3caseinsensitive", "raw.samba3posixtimedlock",
- "raw.samba3rootdirfid", "raw.sfileinfo.end-of-file"]
+ "raw.samba3rootdirfid", "raw.sfileinfo.end-of-file",
+ "raw.bench-oplock", "raw.bench-lock", "raw.bench-open", "raw.bench-tcon",
+ "raw.samba3checkfsp", "raw.samba3closeerr", "raw.samba3oplocklogoff"]
smb2 = ["smb2.lock", "smb2.read", "smb2.compound", "smb2.connect", "smb2.scan", "smb2.scanfind",
"smb2.bench-oplock"]
--
Samba Shared Repository
More information about the samba-cvs
mailing list