[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha6-993-g96b3242
Tim Prouty
tprouty at samba.org
Thu Feb 19 09:11:30 GMT 2009
The branch, master has been updated
via 96b3242f124d60fd8d8b6f5a34b57c26c42dfd14 (commit)
via 59d21afa83b3d7cb996500f3ce2b1317f4c471c7 (commit)
via fdcd5a3a201489b1408951936e9bfc0871834a29 (commit)
from 6bac890533112e6c4f853c0b77a9dd431c471cee (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 96b3242f124d60fd8d8b6f5a34b57c26c42dfd14
Author: Zack Kirsch <zack.kirsch at isilon.com>
Date: Tue Feb 17 21:03:33 2009 -0800
s3 OneFS: Fixes "inherit permissions" and "nt acl support" for Onefs.
commit 59d21afa83b3d7cb996500f3ce2b1317f4c471c7
Author: todd stecher <todd.stecher at gmail.com>
Date: Wed Feb 18 00:02:51 2009 -0800
S3: Dumb down debug spew in perfcount module code
commit fdcd5a3a201489b1408951936e9bfc0871834a29
Author: todd stecher <todd.stecher at gmail.com>
Date: Mon Feb 16 20:45:45 2009 -0800
S3: Make changes to perfcount API set for when a single request leads to multiple replies
(e.g. reply_echo). Change test and onefs modules to match new api set (thanks Volker!).
-----------------------------------------------------------------------
Summary of changes:
source3/include/smb_perfcount.h | 8 ++++-
source3/modules/onefs_system.c | 12 ++++++-
source3/modules/perfcount_onefs.c | 64 +++++++++++++++++++++++++++++-------
source3/modules/perfcount_test.c | 47 +++++++++++++++++++++++++++
source3/smbd/perfcount.c | 8 ++--
source3/smbd/reply.c | 17 +++++++++-
6 files changed, 135 insertions(+), 21 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/smb_perfcount.h b/source3/include/smb_perfcount.h
index 218045b..01a539d 100644
--- a/source3/include/smb_perfcount.h
+++ b/source3/include/smb_perfcount.h
@@ -39,6 +39,8 @@ struct smb_perfcount_handlers {
uint64_t out_bytes);
void (*perfcount_set_client) (struct smb_perfcount_data *pcd, uid_t uid,
const char *user, const char *domain);
+ void (*perfcount_copy_context) (struct smb_perfcount_data *pcd,
+ struct smb_perfcount_data *new_pcd);
void (*perfcount_defer_op) (struct smb_perfcount_data *pcd,
struct smb_perfcount_data *def_pcd);
void (*perfcount_end) (struct smb_perfcount_data *pcd);
@@ -86,13 +88,17 @@ void smb_init_perfcount_data(struct smb_perfcount_data *pcd);
(_pcd_)->handlers->perfcount_set_msglen_out((_pcd_), (_out_));\
} while (0)
-
#define SMB_PERFCOUNT_SET_CLIENT(_pcd_,_uid_, _user_, _domain_) \
do {if((_pcd_) && (_pcd_)->handlers) \
(_pcd_)->handlers->perfcount_set_client((_pcd_), (_uid_), \
(_user_), (_domain_)); \
} while (0)
+#define SMB_PERFCOUNT_COPY_CONTEXT(_pcd_, _new_pcd_) \
+ do {if((_pcd_) && (_pcd_)->handlers) \
+ (_pcd_)->handlers->perfcount_copy_context((_pcd_), (_new_pcd_)); \
+ } while (0)
+
#define SMB_PERFCOUNT_DEFER_OP(_pcd_, _def_pcd_) \
do {if((_pcd_) && (_pcd_)->handlers) \
(_pcd_)->handlers->perfcount_defer_op((_pcd_), (_def_pcd_)); \
diff --git a/source3/modules/onefs_system.c b/source3/modules/onefs_system.c
index b17cfe9..6f93d9f 100644
--- a/source3/modules/onefs_system.c
+++ b/source3/modules/onefs_system.c
@@ -93,6 +93,7 @@ int onefs_sys_create_file(connection_struct *conn,
int secinfo = 0;
int ret_fd = -1;
uint32_t onefs_dos_attributes;
+ struct ifs_createfile_flags cf_flags = CF_FLAGS_NONE;
/* Setup security descriptor and get secinfo. */
if (sd != NULL) {
@@ -143,10 +144,19 @@ int onefs_sys_create_file(connection_struct *conn,
smlock_dump(10, psml);
+ /**
+ * Deal with kernel creating Default ACLs. (Isilon bug 47447.)
+ *
+ * 1) "nt acl support = no", default_acl = no
+ * 2) "inherit permissions = yes", default_acl = no
+ */
+ if (lp_nt_acl_support(SNUM(conn)) && !lp_inherit_perms(SNUM(conn)))
+ cf_flags = cf_flags_or(cf_flags, CF_FLAGS_DEFAULT_ACL);
+
ret_fd = ifs_createfile(base_fd, path,
(enum ifs_ace_rights)open_access_mask, flags & ~O_ACCMODE, mode,
onefs_oplock, id, psml, secinfo, pifs_sd, onefs_dos_attributes,
- &onefs_granted_oplock);
+ cf_flags, &onefs_granted_oplock);
DEBUG(10,("onefs_sys_create_file(%s): ret_fd = %d, "
"onefs_granted_oplock = %s\n",
diff --git a/source3/modules/perfcount_onefs.c b/source3/modules/perfcount_onefs.c
index a4fbe6a..9b35af6 100644
--- a/source3/modules/perfcount_onefs.c
+++ b/source3/modules/perfcount_onefs.c
@@ -29,7 +29,7 @@ struct onefs_op_counter {
};
struct onefs_stats_context {
- bool deferred;
+ bool alloced;
struct isp_op_delta iod;
/* ANDX commands stats stored here */
@@ -107,7 +107,6 @@ static void onefs_smb_statistics_set_op(struct smb_perfcount_data *pcd, int op)
if (pcd->context == NULL)
return;
-
iod = onefs_stats_get_op_delta(ctxt);
iod->op = isp_cifs_op_id(op);
@@ -197,6 +196,50 @@ static void onefs_smb_statistics_set_msglen_out(struct smb_perfcount_data *pcd,
ctxt->iod.out_bytes = out_bytes;
}
+static int onefs_copy_perfcount_context(struct onefs_stats_context *ctxt,
+ struct onefs_stats_context **dest)
+{
+ struct onefs_stats_context *new_ctxt;
+
+ /* make an alloc'd copy of the data */
+ new_ctxt = SMB_MALLOC_P(struct onefs_stats_context);
+ if (!new_ctxt) {
+ return -1;
+ }
+
+ memcpy(new_ctxt, ctxt, sizeof(struct onefs_stats_context));
+ new_ctxt->alloced = True;
+ *dest = new_ctxt;
+ return 0;
+}
+
+static void onefs_smb_statistics_copy_context(struct smb_perfcount_data *pcd,
+ struct smb_perfcount_data *dest)
+{
+ struct onefs_stats_context *ctxt = pcd->context;
+ struct onefs_stats_context *new_ctxt;
+ int ret;
+
+ /* not enabled */
+ if (pcd->context == NULL)
+ return;
+
+#ifdef ONEFS_PERF_DEBUG
+ DEBUG(0,("******** COPYING op %s(%d)\n",
+ onefs_stat_debug(&ctxt->iod), ctxt->iod.op));
+#endif
+
+ ret = onefs_copy_perfcount_context(ctxt, &new_ctxt);
+ if (ret)
+ return;
+
+ /* instrumentation */
+ if (ctxt == &g_context)
+ ZERO_STRUCT(g_context);
+
+ dest->context = new_ctxt;
+}
+
/*
* For perf reasons, we usually use the global - sometimes, though,
* when an operation is deferred, we need to alloc a copy.
@@ -206,35 +249,29 @@ static void onefs_smb_statistics_defer_op(struct smb_perfcount_data *pcd,
{
struct onefs_stats_context *ctxt = pcd->context;
struct onefs_stats_context *deferred_ctxt;
+ int ret;
/* not enabled */
if (pcd->context == NULL)
return;
/* already allocated ? */
- if (ctxt->deferred)
+ if (ctxt->alloced)
{
def_pcd->context = ctxt;
pcd->context = NULL;
return;
}
-
#ifdef ONEFS_PERF_DEBUG
DEBUG(0,("******** DEFERRING op %s(%d)\n",
onefs_stat_debug(&ctxt->iod), ctxt->iod.op));
#endif
- /* make an alloc'd copy of the data */
- deferred_ctxt = SMB_MALLOC_P(struct onefs_stats_context);
- if (!deferred_ctxt) {
- /* disable for now - we'll get bogus stats, though */
- def_pcd->context = NULL;
+ ret = onefs_copy_perfcount_context(ctxt, &deferred_ctxt);
+ if (ret)
return;
- }
- memcpy(deferred_ctxt, ctxt, sizeof(struct onefs_stats_context));
- deferred_ctxt->deferred = True;
def_pcd->context = (void*) deferred_ctxt;
/* instrumentation */
@@ -284,7 +321,7 @@ static void onefs_smb_statistics_end(struct smb_perfcount_data *pcd)
ctxt->iod.in_bytes, ctxt->iod.out_bytes));
#endif
- if (ctxt->deferred)
+ if (ctxt->alloced)
SAFE_FREE(ctxt);
else
ZERO_STRUCTP(ctxt);
@@ -302,6 +339,7 @@ static struct smb_perfcount_handlers onefs_pc_handlers = {
onefs_smb_statistics_set_msglen_in,
onefs_smb_statistics_set_msglen_out,
onefs_smb_statistics_set_client,
+ onefs_smb_statistics_copy_context,
onefs_smb_statistics_defer_op,
onefs_smb_statistics_end
};
diff --git a/source3/modules/perfcount_test.c b/source3/modules/perfcount_test.c
index b140172..418d83a 100644
--- a/source3/modules/perfcount_test.c
+++ b/source3/modules/perfcount_test.c
@@ -294,6 +294,52 @@ static void perfcount_test_set_msglen_out(struct smb_perfcount_data *pcd,
ctxt->ops->bytes_out = bytes_out;
}
+static void perfcount_test_copy_context(struct smb_perfcount_data *pcd,
+ struct smb_perfcount_data *new_pcd)
+{
+ struct perfcount_test_context *ctxt =
+ (struct perfcount_test_context *)pcd->context;
+ struct perfcount_test_context *new_ctxt;
+
+ struct perfcount_test_counter *ctr;
+ struct perfcount_test_counter *new_ctr;
+
+ if (pcd->context == NULL)
+ return;
+
+ new_ctxt = SMB_MALLOC_P(struct perfcount_test_context);
+ if (!new_ctxt) {
+ return;
+ }
+
+ memcpy(new_ctxt, ctxt, sizeof(struct perfcount_test_context));
+
+ for (ctr = ctxt->ops; ctr != NULL; ctr = ctr->next) {
+ new_ctr = SMB_MALLOC_P(struct perfcount_test_counter);
+ if (!new_ctr) {
+ goto error;
+ }
+
+ memcpy(new_ctr, ctr, sizeof(struct perfcount_test_counter));
+ new_ctr->next = NULL;
+ new_ctr->prev = NULL;
+ DLIST_ADD(new_ctxt->ops, new_ctr);
+ }
+
+ new_pcd->context = new_ctxt;
+ return;
+
+error:
+
+ for (ctr = new_ctxt->ops; ctr != NULL; ) {
+ new_ctr = ctr->next;
+ SAFE_FREE(ctr);
+ ctr = new_ctr;
+ }
+
+ SAFE_FREE(new_ctxt);
+}
+
/*
* For perf reasons, its best to use some global state
* when an operation is deferred, we need to alloc a copy.
@@ -337,6 +383,7 @@ static struct smb_perfcount_handlers perfcount_test_handlers = {
perfcount_test_set_msglen_in,
perfcount_test_set_msglen_out,
perfcount_test_set_client,
+ perfcount_test_copy_context,
perfcount_test_defer_op,
perfcount_test_end
};
diff --git a/source3/smbd/perfcount.c b/source3/smbd/perfcount.c
index a0ba0a5..2c3871d 100644
--- a/source3/smbd/perfcount.c
+++ b/source3/smbd/perfcount.c
@@ -78,7 +78,7 @@ NTSTATUS smb_register_perfcounter(int interface_version, const char *name,
}
if (smb_perfcount_find_module(name)) {
- DEBUG(0,("Perfcount Module %s already loaded!\n", name));
+ DEBUG(3,("Perfcount Module %s already loaded!\n", name));
return NT_STATUS_OK;
}
@@ -87,7 +87,7 @@ NTSTATUS smb_register_perfcounter(int interface_version, const char *name,
entry->handlers = (struct smb_perfcount_handlers*) handlers;
DLIST_ADD(modules, entry);
- DEBUG(0, ("Successfully added perfcounter module '%s'\n", name));
+ DEBUG(3, ("Successfully added perfcounter module '%s'\n", name));
return NT_STATUS_OK;
}
@@ -105,7 +105,7 @@ static bool smb_load_perfcount_module(const char *name)
DEBUG(3, ("Initialising perfcounter module [%s]\n", name));
if (g_smb_perfcount_handlers) {
- DEBUG(0,("Only 1 perfcount handler may be registered in "
+ DEBUG(3,("Only 1 perfcount handler may be registered in "
"smb.conf\n"));
return true;
}
@@ -146,7 +146,7 @@ static bool smb_load_perfcount_module(const char *name)
(NT_STATUS_IS_OK(smb_probe_module("perfcount", module_path)) &&
(entry = smb_perfcount_find_module(module_name)))) {
- DEBUG(0,("Successfully loaded perfcounter module [%s] \n", name));
+ DEBUG(3,("Successfully loaded perfcounter module [%s] \n", name));
} else {
DEBUG(0,("Can't find a perfcounter module [%s]\n",name));
goto fail;
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 1ceda99..457f941 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -4621,11 +4621,15 @@ void reply_tdis(struct smb_request *req)
void reply_echo(struct smb_request *req)
{
connection_struct *conn = req->conn;
+ struct smb_perfcount_data local_pcd;
+ struct smb_perfcount_data *cur_pcd;
int smb_reverb;
int seq_num;
START_PROFILE(SMBecho);
+ smb_init_perfcount_data(&local_pcd);
+
if (req->wct < 1) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
END_PROFILE(SMBecho);
@@ -4646,14 +4650,23 @@ void reply_echo(struct smb_request *req)
smb_reverb = 100;
}
- for (seq_num =1 ; seq_num <= smb_reverb ; seq_num++) {
+ for (seq_num = 1 ; seq_num <= smb_reverb ; seq_num++) {
+
+ /* this makes sure we catch the request pcd */
+ if (seq_num == smb_reverb) {
+ cur_pcd = &req->pcd;
+ } else {
+ SMB_PERFCOUNT_COPY_CONTEXT(&req->pcd, &local_pcd);
+ cur_pcd = &local_pcd;
+ }
+
SSVAL(req->outbuf,smb_vwv0,seq_num);
show_msg((char *)req->outbuf);
if (!srv_send_smb(smbd_server_fd(),
(char *)req->outbuf,
IS_CONN_ENCRYPTED(conn)||req->encrypted,
- &req->pcd))
+ cur_pcd))
exit_server_cleanly("reply_echo: srv_send_smb failed.");
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list