The branch, master has been updated via 1e793357906 smbd: Remove smb1-only perfcount subsystem via 1a5ac20a232 smbd: Remove unused "pcd" from struct pending_message_list via d2dcc0fdf56 smbd: Remove unused "deferred_pcd" from process_smb() via 5adbc366deb smbd: Remove unused "deferred_pcd" from process_smb1() via 15503566796 smbd: Remove unused "deferred_pcd" from construct_reply() via 43f64955dc3 smbd: Remove unused "pcd" from struct smb_request via 625056af0b4 smbd: Remove unused "deferred_pcd" from construct_reply_chain() via f13b8b10361 smbd: Remove unused "deferred_pcd" from process_smb2() via 12f1d94a4ee smbd: Remove unused "pcd" arg from smb1_srv_send() via d342be5b091 modules: Remove perfcount_test module via 5fa8a1e166c smbd: Remove SMB_PERFCOUNT_ macros via c7704d2dac5 smbd: Remove unused smb2_srv_send() from 22ab42c1007 s3/utils: avoid erronous NO MEMORY detection
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 1e793357906a636b89883ff39d42902a608805cc Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 5 16:06:50 2023 +0200 smbd: Remove smb1-only perfcount subsystem This never took off outside of a special OEM setup. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Mon Jun 5 18:13:05 UTC 2023 on atb-devel-224 commit 1a5ac20a2324a46482cf4a8387ce767fb6e170fd Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 5 16:03:42 2023 +0200 smbd: Remove unused "pcd" from struct pending_message_list Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit d2dcc0fdf56a473e2a23332d93b8ac64d209efe5 Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 5 16:02:29 2023 +0200 smbd: Remove unused "deferred_pcd" from process_smb() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 5adbc366deb164493f82be6e98388b790bc5a88b Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 5 16:00:06 2023 +0200 smbd: Remove unused "deferred_pcd" from process_smb1() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 155035667966c0d3c8dbec263b53c415dfa50d5e Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 5 15:58:08 2023 +0200 smbd: Remove unused "deferred_pcd" from construct_reply() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 43f64955dc3a9910567061213fc282ed77560602 Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 5 15:55:10 2023 +0200 smbd: Remove unused "pcd" from struct smb_request After the macros went away, nobody read this anymore Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 625056af0b4bebd401196cf1f32f69be32707194 Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 5 15:52:57 2023 +0200 smbd: Remove unused "deferred_pcd" from construct_reply_chain() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit f13b8b103613edad04adaf1b6d3164cea9415883 Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 5 15:47:50 2023 +0200 smbd: Remove unused "deferred_pcd" from process_smb2() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 12f1d94a4ee89e43c5eb092dc701c20331b63399 Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 5 15:45:35 2023 +0200 smbd: Remove unused "pcd" arg from smb1_srv_send() Looks larger than it is, "git clang-format" added a few lines Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit d342be5b0911af542976d3522e964321f61b8f30 Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 5 15:36:55 2023 +0200 modules: Remove perfcount_test module Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 5fa8a1e166ce986a53601359469591babb1f75b4 Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 5 15:35:07 2023 +0200 smbd: Remove SMB_PERFCOUNT_ macros Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit c7704d2dac513cbe9b6160a7e389c8b60291ba0c Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 5 15:31:57 2023 +0200 smbd: Remove unused smb2_srv_send() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: source3/include/includes.h | 1 - source3/include/smb_perfcount.h | 105 ----------- source3/include/vfs.h | 2 - source3/modules/perfcount_test.c | 395 --------------------------------------- source3/modules/wscript_build | 7 - source3/smbd/perfcount.c | 195 ------------------- source3/smbd/proto.h | 21 +-- source3/smbd/smb1_aio.c | 25 +-- source3/smbd/smb1_ipc.c | 43 +++-- source3/smbd/smb1_negprot.c | 3 +- source3/smbd/smb1_nttrans.c | 20 +- source3/smbd/smb1_oplock.c | 7 +- source3/smbd/smb1_pipes.c | 13 +- source3/smbd/smb1_process.c | 89 +++++---- source3/smbd/smb1_process.h | 25 ++- source3/smbd/smb1_reply.c | 57 ++---- source3/smbd/smb1_trans2.c | 31 ++- source3/smbd/smb2_negprot.c | 3 +- source3/smbd/smb2_process.c | 102 ++++------ source3/smbd/smb2_reply.c | 5 +- source3/wscript | 7 +- source3/wscript_build | 1 - 22 files changed, 201 insertions(+), 956 deletions(-) delete mode 100644 source3/include/smb_perfcount.h delete mode 100644 source3/modules/perfcount_test.c delete mode 100644 source3/smbd/perfcount.c Changeset truncated at 500 lines: diff --git a/source3/include/includes.h b/source3/include/includes.h index 27ce2074a72..02beb0a0c88 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -264,7 +264,6 @@ typedef char fstring[FSTRING_LEN]; #include "../lib/util/charset/charset.h" #include "dynconfig/dynconfig.h" #include "locking.h" -#include "smb_perfcount.h" #include "smb.h" #include "../lib/util/byteorder.h" diff --git a/source3/include/smb_perfcount.h b/source3/include/smb_perfcount.h deleted file mode 100644 index efefb3c00b8..00000000000 --- a/source3/include/smb_perfcount.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Portable SMB Messaging statistics interfaces - Copyright (C) Todd Stecher (2008) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef _SMB_PERFCOUNT_H_ -#define _SMB_PERFCOUNT_H_ - -/* Change to 2, loadable modules now take a TALLOC_CTX * parameter. */ -#define SMB_PERFCOUNTER_INTERFACE_VERSION 2 - -struct smb_perfcount_data{ - struct smb_perfcount_handlers *handlers; - void *context; -}; - -struct smb_perfcount_handlers { - void (*perfcount_start) (struct smb_perfcount_data *pcd); - void (*perfcount_add) (struct smb_perfcount_data *pcd); - void (*perfcount_set_op) (struct smb_perfcount_data *pcd, int op); - void (*perfcount_set_subop) (struct smb_perfcount_data *pcd, int subop); - void (*perfcount_set_ioctl) (struct smb_perfcount_data *pcd, int io_ctl); - void (*perfcount_set_msglen_in) (struct smb_perfcount_data *pcd, - uint64_t in_bytes); - void (*perfcount_set_msglen_out) (struct smb_perfcount_data *pcd, - uint64_t out_bytes); - 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); -}; - -bool smb_perfcount_init(void); - -NTSTATUS smb_register_perfcounter(int interface_version, const char *name, - const struct smb_perfcount_handlers *handlers); - -void smb_init_perfcount_data(struct smb_perfcount_data *pcd); - -#define SMB_PERFCOUNT_START(_pcd_) \ - do {if((_pcd_) && (_pcd_)->handlers) \ - (_pcd_)->handlers->perfcount_start((_pcd_)); \ - } while (0) - -#define SMB_PERFCOUNT_ADD(_pcd_) \ - do {if((_pcd_) && (_pcd_)->handlers) \ - (_pcd_)->handlers->perfcount_add((_pcd_)); \ - } while (0) - -#define SMB_PERFCOUNT_SET_OP(_pcd_,_op_) \ - do {if((_pcd_) && (_pcd_)->handlers) \ - (_pcd_)->handlers->perfcount_set_op((_pcd_), (_op_)); \ - } while (0) - -#define SMB_PERFCOUNT_SET_SUBOP(_pcd_,_subop_) \ - do {if((_pcd_) && (_pcd_)->handlers) \ - (_pcd_)->handlers->perfcount_set_subop((_pcd_), (_subop_)); \ - } while (0) - -#define SMB_PERFCOUNT_SET_IOCTL(_pcd_,_subop_) \ - do {if((_pcd_) && (_pcd_)->handlers) \ - (_pcd_)->handlers->perfcount_set_ioctl((_pcd_), (_subop_)); \ - } while (0) - -#define SMB_PERFCOUNT_SET_MSGLEN_IN(_pcd_,_in_) \ - do {if((_pcd_) && (_pcd_)->handlers) \ - (_pcd_)->handlers->perfcount_set_msglen_in((_pcd_), (_in_));\ - } while (0) - -#define SMB_PERFCOUNT_SET_MSGLEN_OUT(_pcd_,_out_) \ - do {if((_pcd_) && (_pcd_)->handlers) \ - (_pcd_)->handlers->perfcount_set_msglen_out((_pcd_), (_out_));\ - } 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_)); \ - } while (0) - -#define SMB_PERFCOUNT_END(_pcd_) \ - do {if((_pcd_) && (_pcd_)->handlers) \ - (_pcd_)->handlers->perfcount_end((_pcd_));\ - } while (0) - -#endif /* _SMB_PERFCOUNT_H_ */ diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 5ad15135ef9..31b657addee 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -814,8 +814,6 @@ struct smb_request { */ struct smbXsrv_session *session; - struct smb_perfcount_data pcd; - /* * Chained request handling */ diff --git a/source3/modules/perfcount_test.c b/source3/modules/perfcount_test.c deleted file mode 100644 index ec95a716298..00000000000 --- a/source3/modules/perfcount_test.c +++ /dev/null @@ -1,395 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * Test module for perfcounters - * - * Copyright (C) Todd Stecher 2008 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see <http://www.gnu.org/licenses/>. - */ - -#include "includes.h" -#include "smbd/smbd.h" - -#define PARM_PC_TEST_TYPE "pc_test" -#define PARM_DUMPON_COUNT "count" -#define PARM_DUMPON_COUNT_DEFAULT 50 - -struct perfcount_test_identity { - uid_t uid; - char *user; - char *domain; -}; - -struct perfcount_test_counter { - int op; - int sub_op; - int ioctl; - uint64_t bytes_in; - uint64_t bytes_out; - int count; - - struct perfcount_test_counter *next; - struct perfcount_test_counter *prev; -}; - -struct perfcount_test_context { - - /* wip: identity */ - struct perfcount_test_identity *id; - struct perfcount_test_counter *ops; -}; - -#define MAX_OP 256 -struct perfcount_test_counter *g_list[MAX_OP]; - -int count; - -/* determine frequency of dumping results */ -int count_mod = 1; - -static void perfcount_test_add_counters(struct perfcount_test_context *ctxt) -{ - struct perfcount_test_counter *head; - struct perfcount_test_counter *ptc; - struct perfcount_test_counter *tmp; - bool found; - - for (ptc = ctxt->ops; ptc != NULL; ) { - - found = false; - - if (ptc->op >= MAX_OP) - continue; - - for (head = g_list[ptc->op]; head != NULL; head = head->next) { - if ((ptc->sub_op == head->sub_op) && - (ptc->ioctl == head->ioctl)) { - head->bytes_in += ptc->bytes_in; - head->bytes_out += ptc->bytes_out; - head->count++; - tmp = ptc->next; - DLIST_REMOVE(ctxt->ops, ptc); - SAFE_FREE(ptc); - ptc = tmp; - found = true; - break; - } - } - - /* not in global tracking list - add it */ - if (!found) { - tmp = ptc->next; - DLIST_REMOVE(ctxt->ops, ptc); - ptc->count = 1; - DLIST_ADD(g_list[ptc->op], ptc); - ptc = tmp; - } - } - -} - -#if 0 - -static void perfcount_test_dump_id(struct perfcount_test_identity *id, int lvl) -{ - if (!id) - return; - - DEBUG(lvl,("uid - %d\n", id->uid)); - DEBUG(lvl,("user - %s\n", id->user)); - DEBUG(lvl,("domain - %s\n", id->domain)); -} - -#endif - -static const char *trans_subop_table[] = { - "unknown", "trans:create", "trans:ioctl", "trans:set sd", - "trans:change notify", "trans: rename", "trans:get sd", - "trans:get quota", "trans:set quota" -}; - -static const char *trans2_subop_table[] = { - "trans2:open", "trans2:find first", "trans2:find next", - "trans2:q fsinfo", "trans2:set fsinfo", "trans2:q path info", - "trans2:set pathinfo", "trans2:fs ctl", "trans2: io ctl", - "trans2:find notify first", "trans2:find notify next", - "trans2:mkdir", "trans2:sess setup", "trans2:get dfs referral", - "trans2:report dfs inconsistent" -}; - -static const char *smb_subop_name(int op, int subop) -{ - /* trans */ - if (op == 0x25) { - if (subop >= sizeof(trans_subop_table) / - sizeof(trans_subop_table[0])) { - return "unknown"; - } - return trans_subop_table[subop]; - } else if (op == 0x32) { - if (subop >= sizeof(trans2_subop_table) / - sizeof(trans2_subop_table[0])) { - return "unknown"; - } - return trans2_subop_table[subop]; - } - - return "unknown"; -} - -static void perfcount_test_dump_counter(struct perfcount_test_counter *ptc, - int lvl) -{ -#if defined(WITH_SMB1SERVER) - DEBUG(lvl, ("OP: %s\n", smb_fn_name(ptc->op))); -#endif - if (ptc->sub_op > 0) { - DEBUG(lvl, ("SUBOP: %s\n", - smb_subop_name(ptc->op, ptc->sub_op))); - } - - if (ptc->ioctl > 0) { - DEBUG(lvl, ("IOCTL: %d\n", ptc->ioctl)); - } - - DEBUG(lvl, ("Count: %d\n\n", ptc->count)); -} - -static void perfcount_test_dump_counters(void) -{ - int i; - struct perfcount_test_counter *head; - - count_mod = lp_parm_int(0, PARM_PC_TEST_TYPE, PARM_DUMPON_COUNT, - PARM_DUMPON_COUNT_DEFAULT); - - if (count_mod == 0) { - return; - } - - if ((count++ % count_mod) != 0) - return; - - DEBUG(0,("##### Dumping Performance Counters #####\n")); - - for (i=0; i < MAX_OP; i++) { - struct perfcount_test_counter *next; - for (head = g_list[i]; head != NULL; head = next) { - next = head->next; - perfcount_test_dump_counter(head, 0); - SAFE_FREE(head); - } - g_list[i] = NULL; - } -} - -/* operations */ -static void perfcount_test_start(struct smb_perfcount_data *pcd) -{ - struct perfcount_test_context *ctxt; - struct perfcount_test_counter *ctr; - /* - * there shouldn't already be a context here - if so, - * there's an unbalanced call to start / end. - */ - if (pcd->context) { - DEBUG(0,("perfcount_test_start - starting " - "initialized context - %p\n", pcd)); - return; - } - - ctxt = SMB_MALLOC_P(struct perfcount_test_context); - if (!ctxt) - return; - - ZERO_STRUCTP(ctxt); - - /* create 'default' context */ - ctr = SMB_MALLOC_P(struct perfcount_test_counter); - if (!ctr) { - SAFE_FREE(ctxt); - return; - } - - ZERO_STRUCTP(ctr); - ctr->op = ctr->sub_op = ctr->ioctl = -1; - DLIST_ADD(ctxt->ops, ctr); - - pcd->context = (void*)ctxt; -} - -static void perfcount_test_add(struct smb_perfcount_data *pcd) -{ - struct perfcount_test_context *ctxt = - (struct perfcount_test_context *)pcd->context; - struct perfcount_test_counter *ctr; - - if (pcd->context == NULL) - return; - - ctr = SMB_MALLOC_P(struct perfcount_test_counter); - if (!ctr) { - return; - } - - DLIST_ADD(ctxt->ops, ctr); - -} - -static void perfcount_test_set_op(struct smb_perfcount_data *pcd, int op) -{ - struct perfcount_test_context *ctxt = - (struct perfcount_test_context *)pcd->context; - - if (pcd->context == NULL) - return; - - ctxt->ops->op = op; -} - -static void perfcount_test_set_subop(struct smb_perfcount_data *pcd, int sub_op) -{ - struct perfcount_test_context *ctxt = - (struct perfcount_test_context *)pcd->context; - - if (pcd->context == NULL) - return; - - ctxt->ops->sub_op = sub_op; -} - -static void perfcount_test_set_ioctl(struct smb_perfcount_data *pcd, int io_ctl) -{ - struct perfcount_test_context *ctxt = - (struct perfcount_test_context *)pcd->context; - if (pcd->context == NULL) - return; - - ctxt->ops->ioctl = io_ctl; -} - -static void perfcount_test_set_msglen_in(struct smb_perfcount_data *pcd, - uint64_t bytes_in) -{ - struct perfcount_test_context *ctxt = - (struct perfcount_test_context *)pcd->context; - if (pcd->context == NULL) - return; - - ctxt->ops->bytes_in = bytes_in; -} - -static void perfcount_test_set_msglen_out(struct smb_perfcount_data *pcd, - uint64_t bytes_out) -{ - struct perfcount_test_context *ctxt = - (struct perfcount_test_context *)pcd->context; - - if (pcd->context == NULL) - return; - - 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. - */ -static void perfcount_test_defer_op(struct smb_perfcount_data *pcd, - struct smb_perfcount_data *def_pcd) -{ - /* we don't do anything special to deferred ops */ -- Samba Shared Repository