From c465417ac112336489fc99f3d82aaab59446eb4a Mon Sep 17 00:00:00 2001 From: Swapnil Chaudhary Date: Thu, 18 Aug 2022 02:59:09 -0600 Subject: [PATCH 01/32] CORTX-33743: Analyze and fix memory leaks found in glibc when running s3 IOs with valgrind Problem statement: Valgrind reported few leaks in the code, where strdup was used for allocating memory to the duplicate string. Fix Description: Analyzed the code statically and freed up the variables allocated memory dynamically during the execution. Attaching the valrind report with the code changes, where no leak is found wrt the leaks described of the JIRA ticket. Signed-off-by: Swapnil Chaudhary --- ha/entrypoint.c | 1 + motr/setup.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ha/entrypoint.c b/ha/entrypoint.c index e5e2aea1724..09095f488af 100644 --- a/ha/entrypoint.c +++ b/ha/entrypoint.c @@ -600,6 +600,7 @@ static int ha_entrypoint_client_fom_tick(struct m0_fom *fom) fop->f_opaque = ecl; next_state = M0_HEC_SEND_WAIT; rc = m0_rpc_post(item) == 0 ? M0_FSO_WAIT : M0_FSO_AGAIN; + m0_free(req_fop_data->erf_git_rev_id.b_addr); break; case M0_HEC_SEND_WAIT: diff --git a/motr/setup.c b/motr/setup.c index 733d2445025..8014f428ed2 100644 --- a/motr/setup.c +++ b/motr/setup.c @@ -1099,8 +1099,10 @@ static int cs_storage_init(const char *stob_type, /** Finalises storage for a request handler in a motr context. */ -static void cs_storage_fini(struct cs_stobs *stob) +static void cs_storage_fini(struct m0_reqh_context *rctx) { + struct cs_stobs *stob = &rctx->rc_stob; + m0_free((char*)rctx->rc_addb_stlocation); cs_storage_devs_fini(); if (stob->s_sdom != NULL) m0_stob_domain_fini(stob->s_sdom); @@ -1687,7 +1689,7 @@ static int cs_storage_setup(struct m0_motr *cctx) cleanup_addb2: m0_reqh_addb2_fini(&rctx->rc_reqh); cleanup_stob: - cs_storage_fini(&rctx->rc_stob); + cs_storage_fini(rctx); reqh_be_fini: m0_reqh_be_fini(&rctx->rc_reqh); be_fini: @@ -2874,7 +2876,7 @@ static void cs_level_leave(struct m0_module *module) break; case CS_LEVEL_STORAGE_SETUP: if (rctx->rc_state == RC_INITIALISED) { - cs_storage_fini(&rctx->rc_stob); + cs_storage_fini(rctx); rctx->rc_reqh.rh_pools = NULL; } break; From 77efafe6d50144568f22fa15607580fbff640413 Mon Sep 17 00:00:00 2001 From: Pratik Kumar Patil <80801716+Garuda5611@users.noreply.github.com> Date: Thu, 18 Aug 2022 14:56:17 +0530 Subject: [PATCH 02/32] CORTX-33978: codacy cleanup: Fixed formatting issues (#2087) [fenced-code-flag] -> added name of programming language after 3 backquotes ``` Signed-off-by: Pratik Patil Signed-off-by: Swapnil Chaudhary --- doc/FOPFOM-Programming-Guide.md | 6 ++++-- doc/HLD-OF-Motr-LNet-Transport.md | 2 +- doc/HLD-of-Catalogue-Service.md | 2 +- doc/Motr-Lnet-Transport.md | 2 +- doc/Running_Motr_Across_a_Cluster.md | 11 +++++++---- doc/motr-object-app.md | 3 +-- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/doc/FOPFOM-Programming-Guide.md b/doc/FOPFOM-Programming-Guide.md index 1cf5196aed7..428356e8923 100644 --- a/doc/FOPFOM-Programming-Guide.md +++ b/doc/FOPFOM-Programming-Guide.md @@ -43,9 +43,10 @@ record { u64 f_seq; u64 f_oid } reqh_ut_fom_fop_fid; -``` +``` + **Makefile.am entry:** -``` +```C UT_SRCDIR = @SRCDIR@/reqh/ut noinst_LTLIBRARIES = libreqh-ut.la INCLUDES = -I. -I$(top_srcdir)/include \ -I$(top_srcdir) @@ -62,6 +63,7 @@ EXTRA_DIST = fom_io.ff MOSTLYCLEANFILES = $(FOM_FOPS) ``` + On compiling fom_io_xc.ff file using ff2c compiler, it creates corresponding fom_io_xc.h and fom_io_xc.c. ## Encoding-Decoding FOP diff --git a/doc/HLD-OF-Motr-LNet-Transport.md b/doc/HLD-OF-Motr-LNet-Transport.md index 86a7f989f39..345a1eb02f9 100644 --- a/doc/HLD-OF-Motr-LNet-Transport.md +++ b/doc/HLD-OF-Motr-LNet-Transport.md @@ -152,7 +152,7 @@ Support for this interface is transport specific and availability may also vary #### Controlling network buffer event delivery The design provides the following APIs for the higher level application to control when network buffer event delivery takes place and which thread is used for the buffer event callback. -``` +```C void m0_net_buffer_event_deliver_all(struct m0_net_transfer_mc *tm); int m0_net_buffer_event_deliver_synchronously(struct m0_net_transfer_mc *tm); bool m0_net_buffer_event_pending(struct m0_net_transfer_mc *tm); diff --git a/doc/HLD-of-Catalogue-Service.md b/doc/HLD-of-Catalogue-Service.md index bbdf3f29f80..c459a09979f 100644 --- a/doc/HLD-of-Catalogue-Service.md +++ b/doc/HLD-of-Catalogue-Service.md @@ -159,7 +159,7 @@ foreach key in req.input { | PUT | cfid, input: array of {key, val} | rc, count | :------------- | :------------- | :-------------| -``` +```C reply.count = 0; cat = catalogue_get(req.cfid); diff --git a/doc/Motr-Lnet-Transport.md b/doc/Motr-Lnet-Transport.md index 3abf474036b..94c849e7fa3 100644 --- a/doc/Motr-Lnet-Transport.md +++ b/doc/Motr-Lnet-Transport.md @@ -152,7 +152,7 @@ Support for this interface is transport specific and availability may also vary #### Controlling network buffer event delivery The design provides the following APIs for the higher level application to control when network buffer event delivery takes place and which thread is used for the buffer event callback. -``` +```C void m0_net_buffer_event_deliver_all(struct m0_net_transfer_mc *tm); int m0_net_buffer_event_deliver_synchronously(struct m0_net_transfer_mc *tm); bool m0_net_buffer_event_pending(struct m0_net_transfer_mc *tm); diff --git a/doc/Running_Motr_Across_a_Cluster.md b/doc/Running_Motr_Across_a_Cluster.md index a9bf2764fec..68e261dc7d4 100644 --- a/doc/Running_Motr_Across_a_Cluster.md +++ b/doc/Running_Motr_Across_a_Cluster.md @@ -18,14 +18,14 @@ This document provides information on how to build motr from source and then run 3. ### Configure your CDF ( cluster description file ) to "point" to all nodes in your cluster: 1. Create the CDF: - ```sh + ```yaml cp /opt/seagate/cortx/hare/share/cfgen/examples/singlenode.yaml ~/CDF.yaml vi ~/CDF.yaml ``` 2. Configure the CDF to "point" to each node in the cluster: 1. Add this text N-1 times, where N is the number of nodes to your CDF. The `ip a` will provide your available data_iface values, you must use the one that has `state UP`. Next, you can get the hostname for the node by running `cat /etc/hostname`. However, in some cases, the hostname might not be publicly recognizable by other nodes, so it's recommended to put an IP address instead of a hostname. - ```sh + ```yaml - hostname: ssu0 # [user@]hostname data_iface: ens33 # name of data network interface #data_iface_type: o2ib # type of network interface (optional); @@ -53,10 +53,11 @@ This document provides information on how to build motr from source and then run ``` > A single node CDF should look like this: - ```sh # Cluster Description File (CDF). # See `cfgen --help-schema` for the format description. nodes: + + ```yaml - hostname: ssu0 # [user@]hostname data_iface: ens33 # name of data network interface #data_iface_type: o2ib # type of network interface (optional); @@ -107,6 +108,8 @@ This document provides information on how to build motr from source and then run # Cluster Description File (CDF). # See `cfgen --help-schema` for the format description. nodes: + + ```yaml - hostname: ssu0 # [user@]hostname data_iface: ens33 # name of data network interface #data_iface_type: o2ib # type of network interface (optional); @@ -201,7 +204,7 @@ This document provides information on how to build motr from source and then run #profiles: # - name: default # pools: [ the pool ] - + ``` 4. ### Disable the firewall on each node: This is needed by s3 server, no need to do this if you don't have s3 client (`s3: 0`) on the CDF (at `m0_clients` section). diff --git a/doc/motr-object-app.md b/doc/motr-object-app.md index 3129d243e83..ef163afc42a 100644 --- a/doc/motr-object-app.md +++ b/doc/motr-object-app.md @@ -79,9 +79,8 @@ The most important and necessary configuration parameters: These parameters can be queried with one of the following options: -``` - `hctl status` will show these parameters -``` + If you've followed these instructions [Cluster Setup](https://github.com/Seagate/Cortx/blob/main/doc/Cluster_Setup.md) or [Quick Start Guide](/doc/Quick-Start-Guide.rst) to setup a Cortx Motr system. Or From c91f8415dc8be480e94a63780d8b93f679778480 Mon Sep 17 00:00:00 2001 From: Naga Kishore Date: Fri, 19 Aug 2022 09:53:11 +0530 Subject: [PATCH 03/32] Cortx-29342: Port gdb-extensions.py to python3 (#2082) Problem: Unable to load gdb-extensions.py. Failing with syntax errors Solution: Introduce parenthesis for "print" function. Replace "long" with "int". Removed macro definition as gdb.execute() is throwing errors. User need to manually define macros at gdb command prompt. Added comments for the same inside the file. Signed-off-by: Naga Kishore Kommuri Signed-off-by: Swapnil Chaudhary --- scripts/gdb/gdb-extensions.py | 87 +++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 40 deletions(-) diff --git a/scripts/gdb/gdb-extensions.py b/scripts/gdb/gdb-extensions.py index 107e23d3baa..e947fb3543b 100644 --- a/scripts/gdb/gdb-extensions.py +++ b/scripts/gdb/gdb-extensions.py @@ -31,7 +31,7 @@ def field_type(container, field): def offset_of(container, field): macro_call = "offsetof({0}, {1})".format(container, field) - offset = long(gdb.parse_and_eval(macro_call)) + offset = int(gdb.parse_and_eval(macro_call)) return offset def human_readable(count): @@ -132,8 +132,8 @@ def invoke(self, arg, from_tty): argv = gdb.string_to_argv(arg) argc = len(argv) if argc not in (1, 4, 5): - print 'Error: Usage: m0-list-print [&]list' \ - ' [[struct|union] tag link [visit|"in-detail"]]' + print('Error: Usage: m0-list-print [&]list' \ + ' [[struct|union] tag link [visit|"in-detail"]]') return vhead, head, ok = self.get_head(argv) @@ -145,13 +145,13 @@ def invoke(self, arg, from_tty): visit = argv[4] if argc == 5 else None vnd = vhead['l_head'] - nd = long(vnd) + nd = int(vnd) total = 0 while nd != head: obj_addr = nd - offset if visit is None: - print "0x%x" % obj_addr + print("0x%x" % obj_addr) elif visit == "in-detail": cmd = "p *({0} *){1}".format(str(elm_type), obj_addr) gdb.execute(cmd) @@ -160,10 +160,10 @@ def invoke(self, arg, from_tty): gdb.execute(cmd) vnd = vnd['ll_next'] - nd = long(vnd) + nd = int(vnd) total += 1 - print "Total: %d" % total + print("Total: %d" % total) @staticmethod def get_head(argv): @@ -175,14 +175,14 @@ def get_head(argv): type = type[len('const '):] if type == "struct m0_list": - head = long(vhead.address) + head = int(vhead.address) elif type == "struct m0_list *": - head = long(vhead) + head = int(vhead) elif type in ("struct m0_tl", "struct m0_tl *"): vhead = vhead['t_head'] - head = long(vhead.address) + head = int(vhead.address) else: - print "Error: Invalid argument type: '%s'" % type + print("Error: Invalid argument type: '%s'" % type) ok = False return vhead, head, ok @@ -194,8 +194,8 @@ def get_offset(argv): if argc in (4, 5): if argv[1] not in ("struct", "union"): - print 'Error: Argument 2 must be ' + \ - 'either "struct" or "union"' + print('Error: Argument 2 must be ' + \ + 'either "struct" or "union"') return 0, None, False str_elm_type = "{0} {1}".format(argv[1], argv[2]) @@ -203,12 +203,12 @@ def get_offset(argv): try: elm_type = gdb.lookup_type(str_elm_type) except: - print "Error: type '{0}' does not exist".format(str_elm_type) + print("Error: type '{0}' does not exist".format(str_elm_type)) return 0, None, False type = str(field_type(str_elm_type, anchor)) if type not in ("struct m0_list_link", "struct m0_tlink"): - print "Error: Argument 4 must be of type m0_list_link or m0_tlink" + print("Error: Argument 4 must be of type m0_list_link or m0_tlink") return 0, None, False if type == "struct m0_tlink": @@ -244,36 +244,36 @@ def invoke(self, arg, from_tty): argc = len(argv) if argc != 1: - print "Error: Usage: m0-bufvec-print [&]m0_bufvec" + print("Error: Usage: m0-bufvec-print [&]m0_bufvec") return vbufvec = gdb.parse_and_eval(argv[0]) t = str(vbufvec.type) if t != "struct m0_bufvec" and t != "struct m0_bufvec *": - print "Error: Argument 1 must be either 'struct m0_bufvec' or" + \ - " 'struct m0_bufvec *' type" + print("Error: Argument 1 must be either 'struct m0_bufvec' or" + \ + " 'struct m0_bufvec *' type") return - nr_seg = long(vbufvec['ov_vec']['v_nr']) + nr_seg = int(vbufvec['ov_vec']['v_nr']) buf_size = 0 offset = 0 sum_of_bytes_in_buf = 0 - print "seg:index start_addr end_addr offset bcount sum" + print("seg:index start_addr end_addr offset bcount sum") for i in range(nr_seg): - start_addr = long(vbufvec['ov_buf'][i]) - count = long(vbufvec['ov_vec']['v_count'][i]) + start_addr = int(vbufvec['ov_buf'][i]) + count = int(vbufvec['ov_vec']['v_count'][i]) end_addr = start_addr + count sum_of_bytes_in_seg = sum(start_addr, count) - print "seg:{0} {1:#x} {2:#x} {3} {4} {5}".format(i, \ + print("seg:{0} {1:#x} {2:#x} {3} {4} {5}".format(i, \ start_addr, end_addr, human_readable(offset), \ - human_readable(count), sum_of_bytes_in_seg) + human_readable(count), sum_of_bytes_in_seg)) buf_size += count offset += count sum_of_bytes_in_buf += sum_of_bytes_in_seg - print "nr_seg:", nr_seg - print "buf_size:", human_readable(buf_size) - print "sum:", sum_of_bytes_in_buf + print("nr_seg:", nr_seg) + print("buf_size:", human_readable(buf_size)) + print("sum:", sum_of_bytes_in_buf) # #============================================================================== @@ -293,28 +293,28 @@ def invoke(self, arg, from_tty): argc = len(argv) if argc != 1: - print "Error: Usage: m0-indexvec-print [&]m0_indexvec" + print("Error: Usage: m0-indexvec-print [&]m0_indexvec") return v_ivec = gdb.parse_and_eval(argv[0]) t = str(v_ivec.type) if t != "struct m0_indexvec" and t != "struct m0_indexvec *": - print "Error: Argument 1 must be of either 'struct m0_indexvec' or" + \ - " 'struct m0_indexvec *' type." + print("Error: Argument 1 must be of either 'struct m0_indexvec' or" + \ + " 'struct m0_indexvec *' type.") return - nr_seg = long(v_ivec['iv_vec']['v_nr']) + nr_seg = int(v_ivec['iv_vec']['v_nr']) total_count = 0 - print " :seg_num index count" + print(" :seg_num index count") for i in range(nr_seg): - index = long(v_ivec['iv_index'][i]) - count = long(v_ivec['iv_vec']['v_count'][i]) - print "seg:", i, index, count + index = int(v_ivec['iv_index'][i]) + count = int(v_ivec['iv_vec']['v_count'][i]) + print("seg:", i, index, count) total_count += count - print "nr_seg:", nr_seg - print "total:", total_count + print("nr_seg:", nr_seg) + print("total:", total_count) # List of macros to be defined macros = [ \ @@ -324,12 +324,19 @@ def invoke(self, arg, from_tty): ] # Define macros listed in macros[] -for m in macros: - gdb.execute("macro define %s" % m) +# +# TODO: Fix and uncomment following 'for loop'. For the time being +# execute following manually at gdb command prompt +# +# macro define offsetof(typ,memb) ((unsigned long)((char *)&(((typ *)0)->memb))) +# macro define container_of(ptr, type, member) ((type *)((char *)(ptr)-(char *)(&((type *)0)->member))) +# +#for m in macros: +# gdb.execute("macro define %s" % m) M0ListPrint() M0BufvecPrint() M0IndexvecPrint() -print "Loading python gdb extensions for Motr..." +print("Loading python gdb extensions for Motr...") #print "NOTE: If you've not already loaded, you may also want to load gdb-extensions" From edd8177daab71ce1f6d2706ccac175a2dac9adc5 Mon Sep 17 00:00:00 2001 From: Venkateswarlu Payidimarry Date: Fri, 19 Aug 2022 10:25:48 +0530 Subject: [PATCH 04/32] CORTX-30953: [Codacy] fix shell directive problems (#2084) Problem: Codacy warning, "shellcheck: Tips depend on target shell and yours is unknown. Solution: Add a shebang or a 'shell' directive" Signed-off-by: Venkateswarlu Payidimarry Signed-off-by: Swapnil Chaudhary --- fdmi/st/fdmi_test.sh | 1 + m0t1fs/linux_kernel/st/common_service_fids_inc.sh | 1 + m0t1fs/linux_kernel/st/m0t1fs_client_inc.sh | 1 + m0t1fs/linux_kernel/st/m0t1fs_common_inc.sh | 1 + m0t1fs/linux_kernel/st/m0t1fs_dix_common_inc.sh | 1 + m0t1fs/linux_kernel/st/m0t1fs_io_config_params.sh | 1 + m0t1fs/linux_kernel/st/m0t1fs_server_inc.sh | 1 + m0t1fs/linux_kernel/st/m0t1fs_sns_common_inc.sh | 1 + motr/st/utils/motr_fs.sh | 1 + motr/st/utils/sns_repair_common_inc.sh | 1 + net/test/run.sh | 1 + scripts/provisioning/roles/motr-build/files/sclo-git212.sh | 1 + 12 files changed, 12 insertions(+) diff --git a/fdmi/st/fdmi_test.sh b/fdmi/st/fdmi_test.sh index 1a59f0e2ff1..8107a8bda6c 100755 --- a/fdmi/st/fdmi_test.sh +++ b/fdmi/st/fdmi_test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # diff --git a/m0t1fs/linux_kernel/st/common_service_fids_inc.sh b/m0t1fs/linux_kernel/st/common_service_fids_inc.sh index 93eaa9bf02e..c9c23fe3ae1 100644 --- a/m0t1fs/linux_kernel/st/common_service_fids_inc.sh +++ b/m0t1fs/linux_kernel/st/common_service_fids_inc.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # diff --git a/m0t1fs/linux_kernel/st/m0t1fs_client_inc.sh b/m0t1fs/linux_kernel/st/m0t1fs_client_inc.sh index 6ab6617da5f..d4f74819597 100644 --- a/m0t1fs/linux_kernel/st/m0t1fs_client_inc.sh +++ b/m0t1fs/linux_kernel/st/m0t1fs_client_inc.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # diff --git a/m0t1fs/linux_kernel/st/m0t1fs_common_inc.sh b/m0t1fs/linux_kernel/st/m0t1fs_common_inc.sh index 84cc0b5b114..3793d832410 100755 --- a/m0t1fs/linux_kernel/st/m0t1fs_common_inc.sh +++ b/m0t1fs/linux_kernel/st/m0t1fs_common_inc.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # diff --git a/m0t1fs/linux_kernel/st/m0t1fs_dix_common_inc.sh b/m0t1fs/linux_kernel/st/m0t1fs_dix_common_inc.sh index 5bb312dc2af..8aa5aba39a2 100755 --- a/m0t1fs/linux_kernel/st/m0t1fs_dix_common_inc.sh +++ b/m0t1fs/linux_kernel/st/m0t1fs_dix_common_inc.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # diff --git a/m0t1fs/linux_kernel/st/m0t1fs_io_config_params.sh b/m0t1fs/linux_kernel/st/m0t1fs_io_config_params.sh index e03351b4b04..d87d204aa1a 100755 --- a/m0t1fs/linux_kernel/st/m0t1fs_io_config_params.sh +++ b/m0t1fs/linux_kernel/st/m0t1fs_io_config_params.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # diff --git a/m0t1fs/linux_kernel/st/m0t1fs_server_inc.sh b/m0t1fs/linux_kernel/st/m0t1fs_server_inc.sh index d3825394677..bf65bb31f58 100644 --- a/m0t1fs/linux_kernel/st/m0t1fs_server_inc.sh +++ b/m0t1fs/linux_kernel/st/m0t1fs_server_inc.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # diff --git a/m0t1fs/linux_kernel/st/m0t1fs_sns_common_inc.sh b/m0t1fs/linux_kernel/st/m0t1fs_sns_common_inc.sh index 6e2d57bc03e..7990f704fb8 100644 --- a/m0t1fs/linux_kernel/st/m0t1fs_sns_common_inc.sh +++ b/m0t1fs/linux_kernel/st/m0t1fs_sns_common_inc.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # diff --git a/motr/st/utils/motr_fs.sh b/motr/st/utils/motr_fs.sh index 59114b590e0..5c3341aa086 100755 --- a/motr/st/utils/motr_fs.sh +++ b/motr/st/utils/motr_fs.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # diff --git a/motr/st/utils/sns_repair_common_inc.sh b/motr/st/utils/sns_repair_common_inc.sh index d1cffab559c..b88c8886146 100644 --- a/motr/st/utils/sns_repair_common_inc.sh +++ b/motr/st/utils/sns_repair_common_inc.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # diff --git a/net/test/run.sh b/net/test/run.sh index e991626f322..4f3b1556cc6 100644 --- a/net/test/run.sh +++ b/net/test/run.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # diff --git a/scripts/provisioning/roles/motr-build/files/sclo-git212.sh b/scripts/provisioning/roles/motr-build/files/sclo-git212.sh index db81212da13..87d43907ee5 100644 --- a/scripts/provisioning/roles/motr-build/files/sclo-git212.sh +++ b/scripts/provisioning/roles/motr-build/files/sclo-git212.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # From 7a7a588cf0aec5cf4f4081f0613111c1afd68729 Mon Sep 17 00:00:00 2001 From: Sayed Alfhad Shah Date: Fri, 19 Aug 2022 10:29:46 +0530 Subject: [PATCH 05/32] CORTX-30751: Codacy code cleanup (#1606) (#1893) This patch fixes some of the codacy warnings. warning fixed : "Double quote to prevent globing and words splitting". Signed-off-by: alfhad Signed-off-by: Swapnil Chaudhary --- st/m0t1fs-buffsize-layout-change-test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/st/m0t1fs-buffsize-layout-change-test.sh b/st/m0t1fs-buffsize-layout-change-test.sh index 7e53e192b71..65924a77910 100755 --- a/st/m0t1fs-buffsize-layout-change-test.sh +++ b/st/m0t1fs-buffsize-layout-change-test.sh @@ -24,7 +24,7 @@ set -e SANDBOX_DIR=${SANDBOX_DIR:-/var/motr/sandbox.m0t1fs-writesize-st} M0_SRC_DIR=`readlink -f $0` M0_SRC_DIR=${M0_SRC_DIR%/*/*} -cd $M0_SRC_DIR +cd "$M0_SRC_DIR" echo "Installing Motr services" sudo scripts/install-motr-service -u @@ -43,7 +43,7 @@ dd if=/dev/zero of=/mnt/m0t1fs/12345:1 bs=1048576 count=10 stat /mnt/m0t1fs/12345:1 blksize=`stat /mnt/m0t1fs/12345:1 | grep "IO Block" | sed -e 's/.*IO Block:[[:space:]]//' -e 's/[[:space:]]reg.*//'` -if test $blksize -eq 1048576 -a $oldblksize -ne 1048576; then +if test "$blksize" -eq 1048576 -a "$oldblksize" -ne 1048576; then echo "Successfully set IO Block on first write" else echo "IO Block size is not set correctly" @@ -59,7 +59,7 @@ setfattr -n writesize -v "1048576" /mnt/m0t1fs/12345:2 stat /mnt/m0t1fs/12345:2 blksize=`stat /mnt/m0t1fs/12345:2 | grep "IO Block" | sed -e 's/.*IO Block:[[:space:]]//' -e 's/[[:space:]]reg.*//'` -if test $blksize -eq 1048576 -a $oldblksize -ne 1048576; then +if test "$blksize" -eq 1048576 -a "$oldblksize" -ne 1048576; then echo "Successfully set IO Block on setfattr" else echo "IO Block size is not set correctly" From 9bc78b221a0104b4aaa2114bfc21ebcb75dd341a Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Gaur Date: Fri, 19 Aug 2022 11:58:23 +0530 Subject: [PATCH 06/32] CORTX-30751: This patch fixes some of the codacy warnings. (#2057) Problem: We see 1688 occurrences of the pattern, "Double quote to prevent globing and word splitting". And issues like Use $(...) notation instead of legacy backticked .... Solution: We are putting the variable references in double-quotes. Also fixed issues like Use $(...) notation instead of legacy backticked .... Signed-off-by: Gaurav Gaur Co-authored-by: Venkatesh Balagani Signed-off-by: Swapnil Chaudhary --- .../cortx/motr/sanity/cortx_lnet_sanity.sh | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/scripts/install/opt/seagate/cortx/motr/sanity/cortx_lnet_sanity.sh b/scripts/install/opt/seagate/cortx/motr/sanity/cortx_lnet_sanity.sh index 33608b09f27..44b8779dd56 100755 --- a/scripts/install/opt/seagate/cortx/motr/sanity/cortx_lnet_sanity.sh +++ b/scripts/install/opt/seagate/cortx/motr/sanity/cortx_lnet_sanity.sh @@ -62,7 +62,7 @@ verify_lnet_installation() RESULT=$ERR_LNET_COMP_NOT_INSTALLED fi done - return $RESULT + return "$RESULT" } verify_lnet_conf_exists() @@ -80,14 +80,14 @@ verify_lnet_conf_exists() msg "LNET conf file found here $LNET_CONF_FILE is not empty." fi fi - return $RESULT + return "$RESULT" } verify_lnet_conf_data() { local RESULT=$ERR_LNET_BAD_CONF_DATA - while LNET_CONF= read -r CONF_LINE + while read -r CONF_LINE do if [[ "$CONF_LINE" =~ \#.* ]]; then # msg "Comment line: $CONF_LINE" @@ -99,55 +99,55 @@ verify_lnet_conf_data() fi SEP=' ' read -r -a TOK <<< "$CONF_LINE" - DEVICE=`echo ${TOK[2]} | cut -d "(" -f2 | cut -d ")" -f1` + DEVICE=$(echo "${TOK[2]}" | cut -d "(" -f2 | cut -d ")" -f1) msg "Found configured device: [$DEVICE]" - if [ ! -L "/sys/class/net/"$DEVICE ]; then - err "Device File [/sys/class/net/$DEVICE] not found." - RESULT=$ERR_LNET_DEV_FILE_NOT_FOUND + if [ ! -L "/sys/class/net/${DEVICE}" ]; then + err "Device File [/sys/class/net/${DEVICE}] not found." + RESULT=${ERR_LNET_DEV_FILE_NOT_FOUND} break fi - IP_ADDR=`ifconfig $DEVICE | awk '/inet /{print substr($2,1)}'` + IP_ADDR=$(ifconfig "${DEVICE}" | awk '/inet /{print substr($2,1)}') if [ "$IP_ADDR" == "" ]; then - err "Cound not extract IP for Device $DEVICE \n$(ifconfig $DEVICE)" + err "Cound not extract IP for Device $DEVICE \n$(ifconfig "${DEVICE}")" RESULT=$ERR_LNET_INVALID_IP break fi msg "Configured device: [$DEVICE] has address [$IP_ADDR]." - PING_TEST=$(ping -c 3 $IP_ADDR) + PING_TEST=$(ping -c 3 "${IP_ADDR}") PING_TEST_RESULT=$? if [ "$PING_TEST_RESULT" != "0" ]; then err "Failed to ping IP_ADDR [$IP_ADDR]\n$PING_TEST" - RESULT=$ERR_LNET_IP_ADDR_PING_FAILED + RESULT=${ERR_LNET_IP_ADDR_PING_FAILED} break fi msg "IP_ADDR [$IP_ADDR] is a valid and reachable IP address" - RESULT=$ERR_SUCCESS + RESULT=${ERR_SUCCESS} ## we are assuming only one Device for LNET configuration break done < $LNET_CONF_FILE - return $RESULT + return "${RESULT}" } verify_lnet_status() { local RESULT=0 LIST_NIDS=$(sudo lctl list_nids) - if [ "$LIST_NIDS" != "$IP_ADDR@tcp" ] && [ "$LIST_NIDS" != "$IP_ADDR@o2ib" ]; then + if [ "${LIST_NIDS}" != "$IP_ADDR@tcp" ] && [ "$LIST_NIDS" != "$IP_ADDR@o2ib" ]; then err "NID [$LIST_NIDS] for [$IP_ADDR] not found." - LNET_PORT=`netstat -a | grep ":988" | wc -l` - if [ $LNET_PORT -ge 1 ]; then + LNET_PORT=$(netstat -a | grep -c ":988") + if [ "${LNET_PORT}" -ge 1 ]; then err "Port 988 seems to be in in use \n$(netstat -a | grep \":988\")" fi RESULT=$ERR_LNET_NID_FOR_IP_ADDR_NOT_FOUND else msg "NID [$LIST_NIDS] found device [$DEVICE] IP [$IP_ADDR]" fi - return $RESULT + return "${RESULT}" } ## main @@ -158,7 +158,7 @@ is_sudoed workflow verify_lnet_installation -die_if_failed $? "Required Lustre packages [${LNET_INSTALLED_COMPONENTS[@]}] were not found." +die_if_failed $? "Required Lustre packages [${LNET_INSTALLED_COMPONENTS[*]}] were not found." verify_lnet_conf_exists die_if_failed $? "File [$LNET_CONF_FILE] not found or is empty." From 05b9ecefd41d79ee9a7a7bbd40a866d2c564ad24 Mon Sep 17 00:00:00 2001 From: Pratik Kumar Patil <80801716+Garuda5611@users.noreply.github.com> Date: Fri, 19 Aug 2022 15:54:34 +0530 Subject: [PATCH 07/32] CORTX-33978: Fixed codacy formatting issues (#2089) [fenced-code-flag] -> added name of programming language after 3 backquotes ``` Signed-off-by: Pratik Patil Signed-off-by: Swapnil Chaudhary --- doc/FOPFOM-Programming-Guide.md | 31 ++++++++++++++-------------- doc/HLD-of-Catalogue-Service.md | 6 +++--- doc/Running_Motr_Across_a_Cluster.md | 13 ++++-------- doc/motr-object-app.md | 15 +++++++------- 4 files changed, 30 insertions(+), 35 deletions(-) diff --git a/doc/FOPFOM-Programming-Guide.md b/doc/FOPFOM-Programming-Guide.md index 428356e8923..5e097bc502d 100644 --- a/doc/FOPFOM-Programming-Guide.md +++ b/doc/FOPFOM-Programming-Guide.md @@ -71,7 +71,7 @@ Rather than sending individual items between Colibri services as separate RPCs, ## Sending a FOP A fop can be sent as a request FOP or a reply FOP. A fop is sent across using the various rpc interfaces. Every fop has an rpc item embedded into it. -``` +```C struct m0_fop { ... /** @@ -85,14 +85,14 @@ struct m0_fop { Sending a fop involves initializing various fop and rpc item structures and then invoking the m0_rpc_post routines. The steps for the same are described below with few code examples. **Define and initialize the fop_type ops** -``` +```C const struct m0_fop_type_ops m0_rpc_fop_conn_establish_ops = { .fto_fom_init = &m0_rpc_fop_conn_establish_fom_init }; ``` **Define and initialize the rpc item_type ops** -``` +```C static struct m0_rpc_item_type_ops default_item_type_ops = { .rito_encode = m0_rpc_fop_item_type_default_encode, .rito_decode = m0_rpc_fop_item_type_default_decode, @@ -101,7 +101,7 @@ static struct m0_rpc_item_type_ops default_item_type_ops = { ``` **Define and initialize the rpc item type** -``` +```C m0_RPC_ITEM_TYPE_DEF(m0_rpc_item_conn_establish, m0_RPC_FOP_CONN_ESTABLISH_OPCODE, m0_RPC_ITEM_TYPE_REQUEST | m0_RPC_ITEM_TYPE_MUTABO, @@ -109,7 +109,8 @@ m0_RPC_ITEM_TYPE_DEF(m0_rpc_item_conn_establish, ``` **Define and initialize the fop type for the new fop and associate the corresponding item type** -```struct m0_fop_type m0_rpc_fop_conn_establish_fopt; +```C +struct m0_fop_type m0_rpc_fop_conn_establish_fopt; /* In module’s init function */ foo_subsystem_init() { @@ -127,7 +128,7 @@ A request FOP is sent by invoking a rpc routine m0_rpc_post(), and its correspon + Client side Every request fop should be submitted to request handler for processing (both at the client as well as at the server side) which is then forwarded by the request handler itself, although currently (for “november” demo) we do not have request handler at the client side. Thus sending a FOP from the client side just involves submitting it to rpc layer by invoking m0_rpc_post(). So, this may look something similar to this: -``` +```C system_call()->m0t1fs_sys_call() m0t2fs_sys_call() { /* create fop */ @@ -142,7 +143,7 @@ At server side a fop should be submitted to request handler for processing, invo The current format of fop operations need all fop formats referenced in the .ff file to be present in the same file. However with introduction of bulk IO client-server, there arises a need of referencing remote fops from one .ff file. Bulk IO transfer needs IO fop to contain a m0_net_buf_desc which is fop itself. ff2c compiler has a construct called “require” for this purpose. "require" statement introduces a dependency on other source file. For each "require", an #include directive is produced, which includes corresponding header file, "lib/vec.h" in this case require "lib/vec"; Example: -``` +```C require "net/net_otw_types"; require "addb/addbff/addb"; @@ -214,7 +215,7 @@ Examples Consider the following write FOM example Declaring FOP in reqh_ut_fom_xc.ff file -``` +```C record { u64 f_seq; u64 f_oid @@ -231,7 +232,7 @@ record { + Defining and building a FOP To build a particular FOP we need to define its corresponding m0_fop_type_ops and m0_fop_type structures as follows: -``` +```C static struct m0_fop_type_ops reqh_ut_write_fop_ops = { .fto_fom_init = reqh_ut_io_fom_init, }; @@ -239,7 +240,7 @@ static struct m0_fop_type_ops reqh_ut_write_fop_ops = { struct m0_fop_type reqh_ut_fom_io_write_fopt; ``` After defining the above structure, we need to have two subroutines(something like below) which actually builds the FOPs, and adds them to the global FOPs list. -``` +```C /** Function to clean reqh ut io fops */ void reqh_ut_fom_io_fop_fini(void) { @@ -262,7 +263,7 @@ int reqh_ut_fom_io_fop_init(void) After defining and building a FOP as above, we can now define its corresponding FOM. + Defining FOM -``` +```C static struct m0_fom_ops reqh_ut_write_fom_ops = { .fo_fini = reqh_ut_io_fom_fini .fo_state = reqh_ut_write_fom_state, (implements actual fom operation) @@ -271,20 +272,20 @@ static struct m0_fom_ops reqh_ut_write_fom_ops = { ``` **FOM type operations structure** FOM type operations structure -``` +```C static const struct m0_fom_type_ops reqh_ut_write_fom_type_ops = { .fto_create = reqh_ut_write_fom_create, }; ``` FOM type structure, this is embedded inside struct m0_fop_type, -``` +```C static struct m0_fom_type reqh_ut_write_fom_mopt = { .ft_ops = &reqh_ut_write_fom_type_ops, }; ``` A typical fom state function would look something similar to this: -``` +```C int reqh_ut_write_fom_state(struct m0_fom *fom { ... @@ -341,4 +342,4 @@ int reqh_ut_write_fom_state(struct m0_fom *fom } } ``` -**Note:** For additional details on the implementation of above methods please refer to request handler UT code in reqh/ut/reqh_fom_ut.c +**Note:** For additional details on the implementation of above methods please refer to request handler UT code in reqh/ut/reqh_fom_ut.c \ No newline at end of file diff --git a/doc/HLD-of-Catalogue-Service.md b/doc/HLD-of-Catalogue-Service.md index c459a09979f..d2624681d2a 100644 --- a/doc/HLD-of-Catalogue-Service.md +++ b/doc/HLD-of-Catalogue-Service.md @@ -187,7 +187,7 @@ tx_close(tx); | :------------- | :------------- | :-------------| -``` +```C count = 0; cat = catalogue_get(req.cfid); @@ -219,7 +219,7 @@ tx_close(tx); | NEXT | cfid, input: array of {key, nr} rc | output: array of { rec: array of { key, val } } | :------------- | :------------- | :---------------| -``` +```C count = 0; cat = catalogue_get(req.cfid); @@ -258,4 +258,4 @@ The detailed level design of the catalogue service should decide on use of rpc b ### Security model -None at the moment. Security model should be designed for all storage objects together. +None at the moment. Security model should be designed for all storage objects together. \ No newline at end of file diff --git a/doc/Running_Motr_Across_a_Cluster.md b/doc/Running_Motr_Across_a_Cluster.md index 68e261dc7d4..ba09dbe1fb7 100644 --- a/doc/Running_Motr_Across_a_Cluster.md +++ b/doc/Running_Motr_Across_a_Cluster.md @@ -53,11 +53,10 @@ This document provides information on how to build motr from source and then run ``` > A single node CDF should look like this: + ```yaml # Cluster Description File (CDF). # See `cfgen --help-schema` for the format description. nodes: - - ```yaml - hostname: ssu0 # [user@]hostname data_iface: ens33 # name of data network interface #data_iface_type: o2ib # type of network interface (optional); @@ -104,12 +103,10 @@ This document provides information on how to build motr from source and then run # pools: [ the pool ] ``` > Whereas a CDF with 3 nodes should look like this: - + ```yaml # Cluster Description File (CDF). # See `cfgen --help-schema` for the format description. nodes: - - ```yaml - hostname: ssu0 # [user@]hostname data_iface: ens33 # name of data network interface #data_iface_type: o2ib # type of network interface (optional); @@ -258,7 +255,7 @@ This document provides information on how to build motr from source and then run 8. ### Start the cluster: Run this at the main node, the first node (hostname) listed at the CDF. - ```sh + ```yaml hctl bootstrap --mkfs ~/CDF.yaml ``` 9. ### Run I/O test: @@ -275,6 +272,4 @@ This document provides information on how to build motr from source and then run - Sep 15, 2021: Naga Kishore Kommuri (nagakishore.kommuri@seagate.com) using CentOS Linux release 7.9.2009, verified with git tag CORTX-2.0.0-77 (#7d4d09cc9fd32ec7690c94298136b372069f3ce3) on main branch - Jul 2, 2021: Daniar Kurniawan (daniar@uchicago.edu) using CentOS 7.8.2003 on 4 bare-metal servers hosted by [Chameleon](https://www.chameleoncloud.org/) (node_type=Skylake). - Feb 22, 2021: Mayur Gupta (mayur.gupta@seagate.com) using CentOS 7.8.2003 on a Windows laptop running VMware Workstation. -- Feb 10, 2021: Patrick Hession (patrick.hession@seagate.com) using CentOS 7.8.2003 on a Windows laptop running Windows Hyper-V. - - +- Feb 10, 2021: Patrick Hession (patrick.hession@seagate.com) using CentOS 7.8.2003 on a Windows laptop running Windows Hyper-V. \ No newline at end of file diff --git a/doc/motr-object-app.md b/doc/motr-object-app.md index ef163afc42a..91ca07e93e8 100644 --- a/doc/motr-object-app.md +++ b/doc/motr-object-app.md @@ -84,13 +84,11 @@ These parameters can be queried with one of the following options: If you've followed these instructions [Cluster Setup](https://github.com/Seagate/Cortx/blob/main/doc/Cluster_Setup.md) or [Quick Start Guide](/doc/Quick-Start-Guide.rst) to setup a Cortx Motr system. Or -``` - Run "motr/examples/setup_a_running_motr_system.sh" to setup a single node Motr, and parameters will be shown there. -``` The first function to use Cortx Motr is to call m0\_client\_init(): -``` +```C rc = m0_client_init(&m0_instance, &motr_conf, true); if (rc != 0) { printf("error in m0_client_init: %d\n", rc); @@ -107,7 +105,7 @@ The first function to use Cortx Motr is to call m0\_client\_init(): And as the final step, application needs to call m0\_client\_fini(): -``` +```C m0_client_fini(m0_instance, true); ``` @@ -142,9 +140,9 @@ The steps to write to an existing object: function object\_write(). * Open the object. * Allocate indexvec (struct m0\_indexvec), data buf (struct m0\_bufvec), attr buf (struct m0\_bufvec) -``` +` with specified count and block size. Please note, Motr I/O must be performed with multiple blocks with some 4K-aligned block size. -``` +` * Fill the indexvec with desired logical offset within the object, and correct buffer size. * Fill the data buf with your data. @@ -163,9 +161,9 @@ The steps to read from an exiting object: function object\_read(). * Open the object. * Allocate indexvec (struct m0\_indexvec), data buf (struct m0\_bufvec), attr buf (struct m0\_bufvec) -``` +` with specified count and block size. Please note, Motr I/O must be performed with multiple blocks with some 4K-aligned block size. -``` +` * Fill the indexvec with desired logical offset within the object, and correct buffer size. * Init the read operation with m0\_obj\_op(). @@ -203,3 +201,4 @@ If run `example1` and encounter error "obj_id invalid. Please refer to M0_ID_APP * Mar 17, 2022: Bo Wei (bo.b.wei@seagate.com) tested using CentOS 7.9. * Sep 28, 2021: Liana Valdes Rodriguez (liana.valdes@seagate.com / lvald108@fiu.edu) tested using CentOS Linux release 7.8.2003 x86_64 + From 3672ae9efd06f72b419b51621f3ec8157ff789ea Mon Sep 17 00:00:00 2001 From: Sayed Alfhad Shah Date: Fri, 19 Aug 2022 21:41:09 +0530 Subject: [PATCH 08/32] CORTX-30751: Codacy code cleanup (#1606) (#1899) This patch fixes some of the codacy warnings. warning fixed : "Double quote to prevent globing and words splitting". Signed-off-by: Alfhad Signed-off-by: Rinku Kothiya Signed-off-by: Swapnil Chaudhary --- st/m0d-device-detach-test.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/st/m0d-device-detach-test.sh b/st/m0d-device-detach-test.sh index 4836c7c765d..a4155915b3f 100755 --- a/st/m0d-device-detach-test.sh +++ b/st/m0d-device-detach-test.sh @@ -31,13 +31,13 @@ M0_SRC_DIR=${M0_SRC_DIR%/*/*} # Number of test iterations ITER_NR=10 -. $M0_SRC_DIR/utils/functions # report_and_exit +. "$M0_SRC_DIR"/utils/functions # report_and_exit # install "motr" Python module required by m0spiel tool -cd $M0_SRC_DIR/utils/spiel +cd "$M0_SRC_DIR"/utils/spiel python3 setup.py install > /dev/null || die 'Cannot install Python "motr" module' -cd $M0_SRC_DIR +cd "$M0_SRC_DIR" echo "Installing Motr services" scripts/install-motr-service -u @@ -59,7 +59,7 @@ systemctl start motr-singlenode sleep 10 # allow motr to finish its startup echo "Perform device-detach test" -cd $SANDBOX_DIR +cd "$SANDBOX_DIR" LNET_NID=`lctl list_nids | head -1` SPIEL_ENDPOINT="$LNET_NID:12345:34:1021" @@ -68,7 +68,7 @@ M0_SPIEL_OPTS="-l $M0_SRC_DIR/motr/.libs/libmotr.so --client $SPIEL_ENDPOINT \ --ha $HA_ENDPOINT" function spiel_cmd { - $M0_SRC_DIR/utils/spiel/m0spiel $M0_SPIEL_OPTS </dev/null 2>&1 & + dd if=/dev/zero of="$filename" bs=1M count=10 >/dev/null 2>&1 & dd_pid=$! spiel_cmd device_detach @@ -129,12 +129,12 @@ if [ $rc -eq 0 ]; then rc=$motr_rc fi -cd $M0_SRC_DIR +cd "$M0_SRC_DIR" scripts/install-motr-service -u utils/m0setup -v -P 3 -N 1 -K 1 -S 1 -i 1 -d /var/motr/img -s 8 -c if [ $rc -eq 0 ]; then - rm -r $SANDBOX_DIR + rm -r "$SANDBOX_DIR" fi report_and_exit m0d-device-detach $rc From f7e69a0cbe437f6944e09a40598d59fb26101148 Mon Sep 17 00:00:00 2001 From: Sayed Alfhad Shah Date: Fri, 19 Aug 2022 21:42:53 +0530 Subject: [PATCH 09/32] CORTX-30751: Codacy code cleanup (#1606) (#1932) This patch fixes some of the codacy warnings. warning fixed : "Double quote to prevent globing and words splitting". Signed-off-by: alfhad Signed-off-by: Rinku Kothiya Signed-off-by: Swapnil Chaudhary --- spiel/st/m0t1fs_spiel_dix_common_inc.sh | 42 ++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/spiel/st/m0t1fs_spiel_dix_common_inc.sh b/spiel/st/m0t1fs_spiel_dix_common_inc.sh index 3e5dc8e4516..fb395557800 100755 --- a/spiel/st/m0t1fs_spiel_dix_common_inc.sh +++ b/spiel/st/m0t1fs_spiel_dix_common_inc.sh @@ -83,8 +83,8 @@ verify() local log_file=$SANDBOX_DIR/check.txt local res=$SANDBOX_DIR/res.txt echo "verifying ..." - $DIXINIT_TOOL_CHECK >$log_file 2>&1 - grep "Metadata exists:" $log_file | grep -v "Metadata exists: true" > $res + "$DIXINIT_TOOL_CHECK" >"$log_file" 2>&1 + grep "Metadata exists:" "$log_file" | grep -v "Metadata exists: true" > $res if [ -s $res ] then echo "See log file with results: $log_file, $res" @@ -116,7 +116,7 @@ spiel_prepare() spiel_cleanup() { - cd $M0_SRC_DIR/utils/spiel + cd "$M0_SRC_DIR"/utils/spiel cat $PYTHON_STUFF | xargs rm -rf rm -rf build/ $PYTHON_STUFF cd - @@ -139,8 +139,8 @@ EOF spiel_dix_repair_abort() { -echo $M0_SRC_DIR/utils/spiel/m0spiel $SPIEL_OPTS - $M0_SRC_DIR/utils/spiel/m0spiel $SPIEL_OPTS < Date: Fri, 19 Aug 2022 21:44:06 +0530 Subject: [PATCH 10/32] CORTX-30751: Codacy code cleanup (#1606) (#1898) This patch fixes some of the codacy warnings. warning fixed : "Double quote to prevent globing and words splitting". Signed-off-by: alfhad Signed-off-by: Rinku Kothiya Signed-off-by: Swapnil Chaudhary --- spiel/st/spiel_multiple_confd.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spiel/st/spiel_multiple_confd.sh b/spiel/st/spiel_multiple_confd.sh index a5fc1cac522..5156d0efec0 100755 --- a/spiel/st/spiel_multiple_confd.sh +++ b/spiel/st/spiel_multiple_confd.sh @@ -96,7 +96,7 @@ _fini() { if [[ "$(is_lnet_available)" == "true" ]]; then m0_modules_remove fi - cd $M0_SRC_DIR/utils/spiel + cd "$M0_SRC_DIR"/utils/spiel cat $INSTALLED_FILES | xargs rm -rf rm -rf build/ $INSTALLED_FILES } @@ -156,7 +156,7 @@ confd_mkfs_start() { -w 3 -f ${!fid}" echo "--- $(date) ---" >>"$path"/m0d.log - cd $path + cd "$path" echo "$M0_SRC_DIR"/utils/mkfs/m0mkfs $OPTS "$M0_SRC_DIR"/utils/mkfs/m0mkfs $OPTS >>"$path"/mkfs.log || @@ -173,11 +173,11 @@ confd_start() { -m $MAX_RPC_MSG_SIZE -q $TM_MIN_RECV_QUEUE_LEN -c $CONF_FILE\ -w 3 -f ${!fid}" - echo "--- `date` ---" >>$path/m0d.log - cd $path + echo "--- `date` ---" >>"$path"/m0d.log + cd "$path" echo "$M0_SRC_DIR"/motr/m0d $OPTS - $M0_SRC_DIR/motr/m0d $OPTS >>$path/m0d.log 2>&1 & + "$M0_SRC_DIR"/motr/m0d $OPTS >>"$path"/m0d.log 2>&1 & local PID=$! sleep 10 kill -0 $PID 2>/dev/null || From aea35c17e19a5887b39d439bde5abaa2a64e6ab2 Mon Sep 17 00:00:00 2001 From: Rinku Kothiya Date: Fri, 19 Aug 2022 23:31:42 +0530 Subject: [PATCH 11/32] CORTX-30751: Codacy code cleanup (#1606) (#2053) This patch fixes some of the codacy warnings. warning fixed : "Double quote to prevent globing and words splitting" Signed-off-by: Rinku Kothiya Co-authored-by: Pradeep Kumbhre pradeep.kumbhre@seagate.com Signed-off-by: Swapnil Chaudhary --- scripts/build-prep-1node-cortx-mgw.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/build-prep-1node-cortx-mgw.sh b/scripts/build-prep-1node-cortx-mgw.sh index d74ae3fafc9..0eec78a284c 100755 --- a/scripts/build-prep-1node-cortx-mgw.sh +++ b/scripts/build-prep-1node-cortx-mgw.sh @@ -28,11 +28,11 @@ mgs="--without-dashboard" [[ -d cortx ]] || { available_device=$(lsblk --output NAME,FSTYPE -dsn | awk '$2 == "" {print $1}' | grep sd | head -n 1) mkfs.ext4 "/dev/$available_device" - mkdir -p $CORTX_WDIR - mount "/dev/$available_device" $CORTX_WDIR + mkdir -p "$CORTX_WDIR" + mount "/dev/$available_device" "$CORTX_WDIR" } -cd $CORTX_WDIR +cd "$CORTX_WDIR" yum install wget -y wget https://raw.githubusercontent.com/Seagate/cortx-motr/main/scripts/build-prep-1node.sh @@ -56,7 +56,7 @@ echo "=========================================" sudo ./install-deps.sh } -cd $CORTX_WDIR/cortx-rgw +cd "$CORTX_WDIR"/cortx-rgw cmake3 -GNinja -DWITH_PYTHON3=3.6 -DWITH_RADOSGW_MOTR=YES -B build cd build && time ninja vstart-base && time ninja radosgw-admin && time ninja radosgw From b4d411927e78917654f5d97b50978f38e8a5d444 Mon Sep 17 00:00:00 2001 From: Rinku Kothiya Date: Sat, 20 Aug 2022 15:11:58 +0530 Subject: [PATCH 12/32] CORTX-30751: Codacy code cleanup (#1606) (#1965) This patch fixes some of the codacy warnings. warning fixed : "Double quote to prevent globing and words splitting". Signed-off-by: Rinku Kothiya Signed-off-by: Swapnil Chaudhary --- scripts/provisioning/vmhost/prepare-host.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/provisioning/vmhost/prepare-host.sh b/scripts/provisioning/vmhost/prepare-host.sh index 8ed0b1d2b03..33be20354d2 100755 --- a/scripts/provisioning/vmhost/prepare-host.sh +++ b/scripts/provisioning/vmhost/prepare-host.sh @@ -71,7 +71,7 @@ wget https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_x86_64.rpm sudo yum -y install ./vagrant_2.2.6_x86_64.rpm rm -fv ./vagrant_2.2.6_x86_64.rpm vagrant plugin install vagrant-{env,hostmanager,scp,libvirt} -sudo usermod -a -G libvirt $USER +sudo usermod -a -G libvirt "$USER" mv "/usr/bin/kvm" "/usr/bin/kvm--`date +'%d%m%Y_%H%M%S_%s'`" sudo ln -s /usr/libexec/qemu-kvm /usr/bin/kvm ls -l /usr/bin/kvm @@ -89,14 +89,14 @@ echo -en "\nIf you already have the box image of the Vanila [CentOS/7] Box, ente read -t 300 box_path -cd $HOME +cd "$HOME" mkdir Centos7 cd Centos7 vagrant init "Centos/7" if [ "$box_path" == "" ]; then vagrant box add Centos/7 --provider=libvirt else - vagrant box add "Centos/7" $box_path + vagrant box add "Centos/7" "$box_path" fi vagrant up vagrant status From 66810f8d502d24b66f201806d68d0bacf28d742a Mon Sep 17 00:00:00 2001 From: Rinku Kothiya Date: Mon, 22 Aug 2022 10:41:34 +0530 Subject: [PATCH 13/32] CORTX-33703: Codacy Cleanup (#2094) Problem: Unable to list ST's Solution: Removed 2035.diff file. It is not required. Signed-off-by: Rinku Kothiya Signed-off-by: Swapnil Chaudhary --- 2035.diff | 834 ------------------------------------------------------ 1 file changed, 834 deletions(-) delete mode 100644 2035.diff diff --git a/2035.diff b/2035.diff deleted file mode 100644 index 0b16e5aa613..00000000000 --- a/2035.diff +++ /dev/null @@ -1,834 +0,0 @@ -diff --git a/bindings/go/README.md b/bindings/go/README.md -index 0db305218c0..422f1712de2 100644 ---- a/bindings/go/README.md -+++ b/bindings/go/README.md -@@ -60,7 +60,8 @@ Usage: mcp [options] src dst - - In order to build: - -- 1. [Build Motr](../../doc/Quick-Start-Guide.rst) first (or install pre-built motr-devel package). -+ 1. [Build Motr](../../doc/Quick-Start-Guide.rst) first -+ (or install pre-built motr-devel package). - 2. Install Go: `sudo yum install go`. - - Then run: -diff --git a/doc/ADDB_Monitoring.md b/doc/ADDB_Monitoring.md -index 417a81dcb26..8f014da00e1 100644 ---- a/doc/ADDB_Monitoring.md -+++ b/doc/ADDB_Monitoring.md -@@ -3,27 +3,27 @@ ADDB records are posted by Motr software to record the occurrence of specific si - - ADDB monitors serve two purposes: - --+ To support online statistics reporting, like similar to df, vmstat, top. This is needed both globally (summarized over all nodes) and locally. --+ Inform external world (HA & cluster management tools) about exceptional conditions like failures, overload, etc. -++ To support online statistics reporting, like similar to df, vmstat, top. This is needed both globally (summarized over all nodes) and locally. -++ Inform external world (HA & cluster management tools) about exceptional conditions like failures, overload, etc. - - ## Definitions --+ **ADDB** Analysis and Diagnotic Data Base. See [0] for aditional details. --+ **ADDB base record type** The architecture defines “event”, “data point” and “counter” type ADDB record categories. See [0] for aditional details. In this HLD we will use the word “exception” instead of “event”. We’ll use the term “event” to describe any derivation of the base record types. --+ **Summary ADDB records** These are summary records that are generated by ADDB monitor for a particular system metric. --+ **ADDB monitors** These are objects present on every node in the cluster (client or server), they generate the summary records. -++ **ADDB** Analysis and Diagnotic Data Base. See [0] for aditional details. -++ **ADDB base record type** The architecture defines “event”, “data point” and “counter” type ADDB record categories. See [0] for aditional details. In this HLD we will use the word “exception” instead of “event”. We’ll use the term “event” to describe any derivation of the base record types. -++ **Summary ADDB records** These are summary records that are generated by ADDB monitor for a particular system metric. -++ **ADDB monitors** These are objects present on every node in the cluster (client or server), they generate the summary records. - - ## Requirements --+ [r.addb.monitor.add.runtime] Addition of ADDB monitors. --+ [r.addb.monitor.remove.runtime] Deletion of ADDB monitors. --+ [r.addb.monitor.summary.generate-addb-records] ADDB monitors are able to generate summary addb records. --+ [r.addb.monitor.summary.deliver-addb-record-to-stats-service] ADDB monitors send summary addb records to stats service. --+ [r.addb.monitor.summary.deliver-addb-exception-records-to-local-HA] ADDB monitors send exception addb records to local HA (High Availability) component as a fop. --+ [r.addb.monitor.summary.deliver-addb-record-to-addb-service] ADDB monitors send summary addb records to addb service similar to normal addb records. --+ [r.addb.monitor.nesting] There can be ADDB monitors for ADDB records that are generated by some other monitors. --+ [r.addb.monitor.stats-service] Stats service to maintain statistics information received from all the nodes. --+ [r.addb.monitor.stats-service.state] ADDB stats service maintains a state, this state is built from all the addb summary records that this service receives through all the nodes present in the system (cluster). This state basically comprises of all the statistics summary information sent from nodes. --+ [r.addb.monitor.stats-service.query] Client (for eg. m0stats, m0t1fs, etc.) can query to this stats service for getting state information. --+ [r.addb.monitor.stats-service.single-instance] There would be only one instance of the stats service in the cluster/system. -++ [r.addb.monitor.add.runtime] Addition of ADDB monitors. -++ [r.addb.monitor.remove.runtime] Deletion of ADDB monitors. -++ [r.addb.monitor.summary.generate-addb-records] ADDB monitors are able to generate summary addb records. -++ [r.addb.monitor.summary.deliver-addb-record-to-stats-service] ADDB monitors send summary addb records to stats service. -++ [r.addb.monitor.summary.deliver-addb-exception-records-to-local-HA] ADDB monitors send exception addb records to local HA (High Availability) component as a fop. -++ [r.addb.monitor.summary.deliver-addb-record-to-addb-service] ADDB monitors send summary addb records to addb service similar to normal addb records. -++ [r.addb.monitor.nesting] There can be ADDB monitors for ADDB records that are generated by some other monitors. -++ [r.addb.monitor.stats-service] Stats service to maintain statistics information received from all the nodes. -++ [r.addb.monitor.stats-service.state] ADDB stats service maintains a state, this state is built from all the addb summary records that this service receives through all the nodes present in the system (cluster). This state basically comprises of all the statistics summary information sent from nodes. -++ [r.addb.monitor.stats-service.query] Client (for eg. m0stats, m0t1fs, etc.) can query to this stats service for getting state information. -++ [r.addb.monitor.stats-service.single-instance] There would be only one instance of the stats service in the cluster/system. - - ## Functional Requirements - There are two APIs that are globally visible, they are to add/delete monitors. -@@ -31,16 +31,16 @@ There are two APIs that are globally visible, they are to add/delete monitors. - ``void m0_addb_monitor_del(struct m0_addb_monitor *mon);`` - - ADDB monitors do two main work / things: --+ Report statistics online --+ Report exceptional conditions like failure, etc. -++ Report statistics online -++ Report exceptional conditions like failure, etc. - - ### Statistics Reporting - Reporting of statistics is required, which is similar to df, vmstat, top, etc. These statistics are generated by monitors that generate summaries of various system metric periodically. - - Statistics belong to two categories: - --1. Stats which are readily available, eg. balloc will generate addb records about free space in a container periodically. --1. Stats which are not readily available. -+1. Stats which are readily available, eg. balloc will generate addb records about free space in a container periodically. -+1. Stats which are not readily available. - - These stats summary ADDB records can be produced on any node, this could be client or server. If produced on client they are sent to endpoint where addb service is running (using the current mechanism) and also to the endpoint where stats service is running, while if produced on server they are written to addb stob and also sent to this endpoint where stats service is running. - -@@ -68,9 +68,9 @@ ADDB monitors are represented as follows: - ``` - Structure field descriptions: - --+ am_watch(), a monitor specific function.Actual monitoring logic is to be written in this function. It does the processing of all the addb records of its interests and can post the summary statistics obtained directly or computed as addb records that gets delivered to endpoint where addb service is running and to the endpoint where stats service is running as addb records. Also, it can post the exceptional conditions to a special service & a local HA component. --+ am_datum, provides for some private information that be kept per monitor. --+ am_linkage, links monitor to the global monitor list. -++ am_watch(), a monitor specific function.Actual monitoring logic is to be written in this function. It does the processing of all the addb records of its interests and can post the summary statistics obtained directly or computed as addb records that gets delivered to endpoint where addb service is running and to the endpoint where stats service is running as addb records. Also, it can post the exceptional conditions to a special service & a local HA component. -++ am_datum, provides for some private information that be kept per monitor. -++ am_linkage, links monitor to the global monitor list. - - There is a global list of all the monitors, add() would just add the monitor to this global list while del () would just remove this particular monitor from this global list. Monitors are added during addb sub-system initialization and deleted during the addb sub-system finalization. - -@@ -90,73 +90,74 @@ There is a periodic posting of these addb summary records and this is done by th - The bottom half i.e. AST part would be run by a dedicated thread & would be synchronized among the various others threads that would run monitors with a sm (state machine) group lock. - - ## Conformance --+ [i.addb.monitor.add] An API is made available for this. --+ [i.addb.monitor.remove] An API is made available for this. --+ [i.addb.monitor.generate-summary-addb-records] Monitor’s am_watch() function will do this. --+ [r.addb.monitor.deliver-addb-record-to-stats-service] Addition to current ADDB mechanism is to be done to differentiate between summary stats records generated by monitors and other addb records & send these summary records to stats service. --+ [r.addb.monitor.deliver-addb-exception-records-to-local-HA] Monitor’s am_watch() function will do this. --+ [r.addb.monitor.deliver-addb-record-to-addb-service] This makes use of current implementation. --+ [r.addb.monitor.nesting] Monitors generate addb records which themselves can be monitored. --+ [r.addb.stats-service.state] Implementation of stats service handles this. --+ [r.addb.stats-service.query] Implementation of stats service handles this. --+ [r.addb.stats-service.single-instance] Implementation of stats service handles this. -++ [i.addb.monitor.add] An API is made available for this. -++ [i.addb.monitor.remove] An API is made available for this. -++ [i.addb.monitor.generate-summary-addb-records] Monitor’s am_watch() function will do this. -++ [r.addb.monitor.deliver-addb-record-to-stats-service] Addition to current ADDB mechanism is to be done to differentiate between summary stats records generated by monitors and other addb records & send these summary records to stats service. -+ -++ [r.addb.monitor.deliver-addb-exception-records-to-local-HA] Monitor’s am_watch() function will do this. -++ [r.addb.monitor.deliver-addb-record-to-addb-service] This makes use of current implementation. -++ [r.addb.monitor.nesting] Monitors generate addb records which themselves can be monitored. -++ [r.addb.stats-service.state] Implementation of stats service handles this. -++ [r.addb.stats-service.query] Implementation of stats service handles this. -++ [r.addb.stats-service.single-instance] Implementation of stats service handles this. - - ## Dependencies --+ [r.addb.retention] ADDB monitor generates addb records. --+ [r.addb.retention.storage] ADDB monitor generates addb records. --+ [r.addb.timings] ADDB monitor may need to calculate processing rate statistics. --+ [r.addb.filtering] ADDB monitor needs information from addb records. --+ [r.addb.record.type.datapoint] ADDB monitor can generate datapoint addb records. --+ [r.addb.record.type.counter] ADDB monitor can generate counter addb records. --+ [r.addb.record.type.event] ADDB monitor can generate event addb record. --+ [r.addb.record.type.counter.statistics] ADDB monitor needs to do statistics reporting. --+ [r.addb.record.definition] ADDB monitor can define new addb record. --+ [r.addb.record.definition.extensible]. --+ [r.addb.post] ADDB monitor can post addb records. --+ [r.addb.post.non-blocking] Decrease performance impact of ADDB monitoring. -++ [r.addb.retention] ADDB monitor generates addb records. -++ [r.addb.retention.storage] ADDB monitor generates addb records. -++ [r.addb.timings] ADDB monitor may need to calculate processing rate statistics. -++ [r.addb.filtering] ADDB monitor needs information from addb records. -++ [r.addb.record.type.datapoint] ADDB monitor can generate datapoint addb records. -++ [r.addb.record.type.counter] ADDB monitor can generate counter addb records. -++ [r.addb.record.type.event] ADDB monitor can generate event addb record. -++ [r.addb.record.type.counter.statistics] ADDB monitor needs to do statistics reporting. -++ [r.addb.record.definition] ADDB monitor can define new addb record. -++ [r.addb.record.definition.extensible]. -++ [r.addb.post] ADDB monitor can post addb records. -++ [r.addb.post.non-blocking] Decrease performance impact of ADDB monitoring. - - ## Use Cases - **Statistical monitoring of addb records that already have statistical information in them.** - Following steps show how an addb monitor collects statistical information on a particular node (client/server) from addb records and send it to stats service as addb records: - --1. Create ADDB monitor, add it to the global list of monitors. --2. Define the type of addb record that it will generate. --3. Get the statistics information from these addb records periodically. --4. Send this statistical information to the endpoint where stats service is running as addb records & to the endpoint where addb service is running if the node is a client or to the addb stob if the node is server periodically. -+1. Create ADDB monitor, add it to the global list of monitors. -+2. Define the type of addb record that it will generate. -+3. Get the statistics information from these addb records periodically. -+4. Send this statistical information to the endpoint where stats service is running as addb records & to the endpoint where addb service is running if the node is a client or to the addb stob if the node is server periodically. - - **Statistical monitoring of addb records that do not contain statistical information in them** - - Following steps show how an addb monitor collects statistical information on a particular node(client/server) from addb records and send it to stats service as addb records: - --1. Create ADDB monitor, add it to the global list of monitors. --2. Define the type of addb record that it will generate. --1. Continuously compute statistics from the monitored addb records. --1. Send this statistical information to the endpoint where stats service is running as addb records & to the endpoint where addb service is running if the node is a client or to the addb stob if the node is server periodically. -+1. Create ADDB monitor, add it to the global list of monitors. -+2. Define the type of addb record that it will generate. -+1. Continuously compute statistics from the monitored addb records. -+1. Send this statistical information to the endpoint where stats service is running as addb records & to the endpoint where addb service is running if the node is a client or to the addb stob if the node is server periodically. - - **Exceptional conditions monitoring** - - Exceptional conditions such as failures, overflows, etc. could be generated inside monitoring(exceptions occurred as a result of interpreting the statistical information generated after monitoring addb records) or outside monitoring (other sub-system failures). - Following steps are to be taken: - --1. Generate the exception description fop. --2. Post this fop to a local HA component. -+1. Generate the exception description fop. -+2. Post this fop to a local HA component. - - **Building a cluster wide global & local state in memory on a node where stats service is running** - --1. Create in-memory state structure of the cluster on this node. --1. Receive statistical summary addb records from all the node. --1. Update the state with the information in these latest addb records. -+1. Create in-memory state structure of the cluster on this node. -+1. Receive statistical summary addb records from all the node. -+1. Update the state with the information in these latest addb records. - - **Query for some state information to the stats service** - --1. Construct & send a request fop for specific or complete state information to the stats service & wait for reply. --2. Stats service checks for requesting information, gathers it in reply fop & sends it back to the node from where request was initiated. -+1. Construct & send a request fop for specific or complete state information to the stats service & wait for reply. -+2. Stats service checks for requesting information, gathers it in reply fop & sends it back to the node from where request was initiated. - - ## Failures - Following failure cases are listed along with their handling mechanism: - --+ A failure to construct new state on the node where the stats service runs would return the previous state to the node that requested this state information during this duration. --+ Exceptional conditions are reported to local HA component using a fop, a failure of receiving a fop by local HA component can happen, this would mean that some exceptional conditions can go unnoticed by local HA component. This type of failure is ignored. -++ A failure to construct new state on the node where the stats service runs would return the previous state to the node that requested this state information during this duration. -++ Exceptional conditions are reported to local HA component using a fop, a failure of receiving a fop by local HA component can happen, this would mean that some exceptional conditions can go unnoticed by local HA component. This type of failure is ignored. - - ### Rationale - The existing ADDB implementation and the newly developed tracing subsystem contributed greatly to the requirement to use C macro interfaces with compile time validation. -@@ -174,4 +175,4 @@ ADDB repositories are stored in Motr storage objects. ADDB summary records are s - The ADDB monitoring component can be added/deleted by modified the configuration related to it. - - ## References --[0] HLD of ADDB collection mechanism. -+[0] HLD of ADDB collection mechanism. -diff --git a/doc/CORTX-MOTR-ARCHITECTURE.md b/doc/CORTX-MOTR-ARCHITECTURE.md -index 32849113426..4ff25b733e2 100644 ---- a/doc/CORTX-MOTR-ARCHITECTURE.md -+++ b/doc/CORTX-MOTR-ARCHITECTURE.md -@@ -192,8 +192,7 @@ - - ![image](./Images/13_FDMI_Example_Plugin.png) - --# Inverse meta-data -- -+## Inverse meta-data - + block allocation - + pdclust structure - + key distribution -@@ -203,7 +202,6 @@ - + hdf5 - - # ADDB -- - + ADDB (analytics and diagnostics data-base): built-in fine grained telemetry sub-system - + Why? - + systems grow larger and more complex -@@ -226,7 +224,7 @@ - + labels: identify context - + payload: up to 16 64-bit values - + interpreted by consumer --+ always on (post-mortem analysis, first incident fix) -++ always on (post-mortem analysis, first incident fix) - + simulation (change configuration, larger system, load mix) - - ``` -@@ -250,7 +248,6 @@ - - - # ADDB: advanced use cases -- - + collect system execution traces - + use them to calibrate a simulator - + use the simulator to: -@@ -259,4 +256,4 @@ - + combine workloads - ![image](./Images/15_ADDB_Advanced_Use_Case.png) - --# Questions -+## Questions -diff --git a/doc/End-to-end-Data-Integrity.md b/doc/End-to-end-Data-Integrity.md -index a6244d23e8e..bfa99706c41 100644 ---- a/doc/End-to-end-Data-Integrity.md -+++ b/doc/End-to-end-Data-Integrity.md -@@ -1,10 +1,10 @@ - # Motr end-to-end Data Integrity - ## Design Highlights --+ Data of each target is divided into blocks of 4096 bytes. --+ Checksum and tags of 64-bit each for these blocks are computed at m0t1fs and sent over wire. --+ Checksum for data blocks is computed based on checksum algorithm selected from configuration. --+ Data integrity type and operations are initialized in m0_file. --+ Using do_sum(), checksum values are computed for each block of data and using do_chk(), checksum values are verified. -++ Data of each target is divided into blocks of 4096 bytes. -++ Checksum and tags of 64-bit each for these blocks are computed at m0t1fs and sent over wire. -++ Checksum for data blocks is computed based on checksum algorithm selected from configuration. -++ Data integrity type and operations are initialized in m0_file. -++ Using do_sum(), checksum values are computed for each block of data and using do_chk(), checksum values are verified. - - ![image](./Images/Write.PNG) - -@@ -12,11 +12,11 @@ - - ## Current Status - ### Completed --+ Di is computed at m0t1fs and sent over wire. --+ After receiving write fop, checksum is recomputed and verified at the IO service. -++ Di is computed at m0t1fs and sent over wire. -++ After receiving write fop, checksum is recomputed and verified at the IO service. - ### In progress --+ In be segment block attributes m0_be_emap_seg:ee_battr is added. The m0_be_emap_seg:ee_val and ee_battr (When b_nob > 0) are stored in btree. --+ Emap split for di data. --+ Write di data to extents while storing the data in disks (uses be_emap_split and in place btree insert api’s). --+ Read di data from extents while reading data from disks and verify checksum. --+ In sns while reading data units, verify checksum and while writing, store di data. -++ In be segment block attributes m0_be_emap_seg:ee_battr is added. The m0_be_emap_seg:ee_val and ee_battr (When b_nob > 0) are stored in btree. -++ Emap split for di data. -++ Write di data to extents while storing the data in disks (uses be_emap_split and in place btree insert api’s). -++ Read di data from extents while reading data from disks and verify checksum. -++ In sns while reading data units, verify checksum and while writing, store di data. -diff --git a/doc/Seagate-FDMI-Design-Notes.md b/doc/Seagate-FDMI-Design-Notes.md -index 5bfb1bb70cf..a4cb9a8fa73 100644 ---- a/doc/Seagate-FDMI-Design-Notes.md -+++ b/doc/Seagate-FDMI-Design-Notes.md -@@ -15,8 +15,8 @@ The processing is to be done on an incoming FOL record against the Filter set. T - Filter Store is to be filled in by means of Subscription API. Filter Index is updated internally on adding Filter. - - Currently 2 options for Plug-in architecture are anticipated: --1. Option 1: FDMI-Plug-in. Each plug-in is linked with FDMI making use of internal FDMI API only (some callback, for instance). See Fig.1 --1. Option 2: FDMI Plug-in transforms to Mero Core Plug-in. Mero core in this case most likely provides limited features for RPC only. Mero RPC is used to collect notifications from all Mero instances. -+1. Option 1: FDMI-Plug-in. Each plug-in is linked with FDMI making use of internal FDMI API only (some callback, for instance). See Fig.1 -+1. Option 2: FDMI Plug-in transforms to Mero Core Plug-in. Mero core in this case most likely provides limited features for RPC only. Mero RPC is used to collect notifications from all Mero instances. - - ## Plug-in API - -@@ -25,8 +25,8 @@ The API is to allow the plug-ins making use of FDMI to register with the latter - Besides, plug-in may additionally inform FDMI about its specifics, like FOL type it is to process, optimization/tweak requirements (e.g. no batching), etc. - - Public Entries: --* Initialize plug-in --* <..> -+* Initialize plug-in -+* <..> - - **N.B.** Plug-in API design details depend on selected architecture option 1 or 2. - -@@ -49,8 +49,8 @@ Failure results in dropping current FOL copy - For both options FOLs are fed to Filer Processor the same way: locally. - - Public Entries: --* <..> --* <..> -+* <..> -+* <..> - - - ## Subscription API -@@ -58,9 +58,9 @@ Public Entries: - The API is to provide a way for adding Filter rules to FDMI instances, identifying FOL processing traits as well as associating Filter with Consumer - - Public Entries: --* Register Filter --* Unregister Filter --* <..> -+* Register Filter -+* Unregister Filter -+* <..> - - ## Notification API - -@@ -74,17 +74,17 @@ Option 2, Filter Processor always sends a Notification to Consumer using Mero RP - - Public Entries: - --* <..> -+* <..> - --* <..> -+* <..> - - ## Assumptions - - ### Filter - - Filter identifies: --* Consumer to be notified --* Conditions FOL to meet -+* Consumer to be notified -+* Conditions FOL to meet - The index format: TBD - - Filter once registered will be eventually spread across the whole number of Cluster nodes running FDMI services. -@@ -94,8 +94,8 @@ The number of Filters registered in Mero Cluster is expected to be of no explici - ### Filter semantics - - Filter syntax need to remain flexible to adopt any future improvements/enhancements, but fully covering initial requirements of multi-type support and human readability. Possible options are: --* Native-language-like syntax (SQL-like) --* Symbolic object notation, easily parsed (some standard adherent notation preferred), easily extensible, including object nesting, e.g. JSON (current DSR’s choice) -+* Native-language-like syntax (SQL-like) -+* Symbolic object notation, easily parsed (some standard adherent notation preferred), easily extensible, including object nesting, e.g. JSON (current DSR’s choice) - - NB: Filter being parsed on ingestion may be transformed to a combination of elementary rules in case the transformation does not change Filter semantics but potentially improves Processor performance (decomposition is being performed) - -diff --git a/doc/outdated/Containers.md b/doc/outdated/Containers.md -index aa95a691987..a8336d7b707 100644 ---- a/doc/outdated/Containers.md -+++ b/doc/outdated/Containers.md -@@ -4,20 +4,29 @@ This document summarizes container discussions in the Motr architecture team. Th - Container is a low level abstraction that insulates higher Motr layers of the knowledge of storage device addresses (block numbers). The bulk of data and meta-data is stored in containers. - - # Items --+ A container is a storage for data or meta-data. There are several types of container: data container, meta-data container, possibly others. -- --+ A container provides a very simple interface: it has an internal namespace consisting of keys and provides methods to fetch and update records stored at a given key. Nomenclature of keys and constraints on record structure depend on container type. For data container, keys are logical page offsets and records are simply pages full of data without any internal structure. For meta-data container keys are opaque identifiers of meta-data records. --+ A container stores its contents in a backing store---a storage device. A container allocates space from its backing store and returns no longer used space back as necessary. --+ Local RAID is implemented by using a collection of containers to stripe data across. Note that local RAID is not implemented in the containers layer to avoid cyclic dependency between layers: the data structures (specifically layouts) that local RAID implementation is required to share with SNS are interpreted by Motr back-end that itself uses containers to store its data. --+ Snapshots. Containers are used for data and meta-data snap shotting. When a local snapshot is made as a part of object or system level snap shotting, a container involved into the snapshot is COW-ed, so that all updates are re-directed to a new container. --+ After a container is COW-ed no update should ever touch the blocks of the read-only primary container. This is a necessary prerequisite of a scalable fsck implementation, that will achieve reasonable confidence in system consistency by background scan and check of periodically taken global snapshots. -- --+ Migration. A container (either read-only or read-write) can migrate to another node. Typical scenarios of such migration are bulk re-integration of updates from a proxy-server to a set of primary servers and moving snapshots. -- --+ To make migration efficient, a container must be able to do a fast IO of its contents to another node. Specifically, it should be possible to send container contents over network without iterating through individual container records. This condition also implies that a container allocates space from its backing store in a relatively large contiguous chunks. --Self-identification. A container has an identity that is stored in the container and migrated together with the container. Higher layers address container records by (container-id, key) pairs and such addresses remain valid across container migrations, including "migration" where a hard drive is pulled out of one server and inserted into another. In the latter case the system must be able to determine what containers were moved between nodes and update configuration respectively, also it should able determine whether any storage or layout invariants were violated, e.g., whether multiple units of the same parity group are now located on the same server. --+ Layouts. Higher layers address and locate data and meta-data through container identifiers and container keys. On the other hand, a layout produces a location of a given piece of data or meta-data. Together this means that lowest level layouts produce locations in the form of (container-id, key) pairs. --+ A container can be merged into another container. Inclusion of one container into another can be done administrative reasons, to efficiently migrate a large number of smaller containers or for some other purpose. On inclusion, a container retains its identity (does it? Losing identity would require updating (and, hence, tracking) all references). --+ Fids. A fid (file identifiers) is an immutable globally and temporally unique file identifier. As file meta-data record ("inode") is stored in some container, it's logical to use (container-id, key) address of this record as fid. Note that this is formally quite similar to the structure of Lustre fid, composed of a sequence identifier and offset within the sequence. --+ CLDB. A method is required to resolve container addresses to node identifiers. This method should work while containers migrate between nodes and merge with each other. Container Location Data-Base (CLDB) is a distributed data-base tracking containers in the cluster. This database is updated transactionally on container migrations and merges (and splits? There must be splits for symmetry.). Note that CLDB supersedes Fid Location Data-Base (FLDB), see above on fids. --+ Data integrity. A container is a possible place to deal with data integrity issues. Alternatively this can be relegated to lower levels (self-checking device pairs) or higher levels (DMU-like file system with check-sums in meta-data). -++ A container is a storage for data or meta-data. There are several types of container: data container, meta-data container, possibly others. -+ -++ A container provides a very simple interface: it has an internal namespace consisting of keys and provides methods to fetch and update records stored at a given key. Nomenclature of keys and constraints on record structure depend on container type. For data container, keys are logical page offsets and records are simply pages full of data without any internal structure. For meta-data container keys are opaque identifiers of meta-data records. -+ -++ A container stores its contents in a backing store---a storage device. A container allocates space from its backing store and returns no longer used space back as necessary. -+ -++ Local RAID is implemented by using a collection of containers to stripe data across. Note that local RAID is not implemented in the containers layer to avoid cyclic dependency between layers: the data structures (specifically layouts) that local RAID implementation is required to share with SNS are interpreted by Motr back-end that itself uses containers to store its data. -+ -++ Snapshots. Containers are used for data and meta-data snap shotting. When a local snapshot is made as a part of object or system level snap shotting, a container involved into the snapshot is COW-ed, so that all updates are re-directed to a new container. -+ -++ After a container is COW-ed no update should ever touch the blocks of the read-only primary container. This is a necessary prerequisite of a scalable fsck implementation, that will achieve reasonable confidence in system consistency by background scan and check of periodically taken global snapshots. -+ -++ Migration. A container (either read-only or read-write) can migrate to another node. Typical scenarios of such migration are bulk re-integration of updates from a proxy-server to a set of primary servers and moving snapshots. -+ -++ To make migration efficient, a container must be able to do a fast IO of its contents to another node. Specifically, it should be possible to send container contents over network without iterating through individual container records. This condition also implies that a container allocates space from its backing store in a relatively large contiguous chunks. -+Self-identification. A container has an identity that is stored in the container and migrated together with the container. Higher layers address container records by (container-id, key) pairs and such addresses remain valid across container migrations, including "migration" where a hard drive is pulled out of one server and inserted into another. In the latter case the system must be able to determine what containers were moved between nodes and update configuration respectively, also it should able determine whether any storage or layout invariants were violated, e.g., whether multiple units of the same parity group are now located on the same server. -+ -++ Layouts. Higher layers address and locate data and meta-data through container identifiers and container keys. On the other hand, a layout produces a location of a given piece of data or meta-data. Together this means that lowest level layouts produce locations in the form of (container-id, key) pairs. -+ -++ A container can be merged into another container. Inclusion of one container into another can be done administrative reasons, to efficiently migrate a large number of smaller containers or for some other purpose. On inclusion, a container retains its identity (does it? Losing identity would require updating (and, hence, tracking) all references). -+ -++ Fids. A fid (file identifiers) is an immutable globally and temporally unique file identifier. As file meta-data record ("inode") is stored in some container, it's logical to use (container-id, key) address of this record as fid. Note that this is formally quite similar to the structure of Lustre fid, composed of a sequence identifier and offset within the sequence. -+ -++ CLDB. A method is required to resolve container addresses to node identifiers. This method should work while containers migrate between nodes and merge with each other. Container Location Data-Base (CLDB) is a distributed data-base tracking containers in the cluster. This database is updated transactionally on container migrations and merges (and splits? There must be splits for symmetry.). Note that CLDB supersedes Fid Location Data-Base (FLDB), see above on fids. -+ -++ Data integrity. A container is a possible place to deal with data integrity issues. Alternatively this can be relegated to lower levels (self-checking device pairs) or higher levels (DMU-like file system with check-sums in meta-data). -diff --git a/doc/trace.md b/doc/trace.md -index 35b0cd4665e..48692b08f13 100644 ---- a/doc/trace.md -+++ b/doc/trace.md -@@ -134,12 +134,12 @@ User-space - - Subsystem filtering is controlled in two ways: - -- 1. environment variable: -+ 1. environment variable: - - $ export M0_TRACE_IMMEDIATE_MASK='!rpc' - $ ./utils/ut.sh - -- 2. CLI options for utils/ut: -+ 2. CLI options for utils/ut: - - -m string: trace mask, either numeric (HEX/DEC) or comma-separated - list of subsystem names, use ! at the beginning to invert -@@ -153,12 +153,12 @@ Subsystem filtering is controlled in two ways: - - Trace levels: - -- 1. environment variable: -+ 1. environment variable: - - export M0_TRACE_LEVEL=debug - ./utils/ut.sh - -- 2. CLI options for utils/ut: -+ 2. CLI options for utils/ut: - - -e string: trace level: level[+][,level[+]] where level is one of - call|debug|info|warn|error|fatal -@@ -170,12 +170,12 @@ Trace levels: - - Trace print context: - -- 1. environment variable: -+ 1. environment variable: - - export M0_TRACE_PRINT_CONTEXT=none - ./utils/ut.sh - -- 2. CLI options for utils/ut: -+ 2. CLI options for utils/ut: - - -p string: trace print context, values: none, func, short, full - -diff --git a/doc/workarounds.md b/doc/workarounds.md -index 646564b5dcd..17d3cde7e00 100644 ---- a/doc/workarounds.md -+++ b/doc/workarounds.md -@@ -1,7 +1,7 @@ - List of workarounds for third-party libraries and external dependencies - ======================================================================= - --* `sem_timedwait(3)` from _glibc_ on _Centos_ >= 7.2 -+* `sem_timedwait(3)` from _glibc_ on _Centos_ >= 7.2 - - **Problem**: `sem_timedwait(3)` returns `-ETIMEDOUT` immediately if `tv_sec` is - greater than `gettimeofday(2) + INT_MAX`, that makes `m0_semaphore_timeddown(M0_TIME_NEVER)` -@@ -17,10 +17,10 @@ List of workarounds for third-party libraries and external dependencies - **Source**: `lib/user_space/semaphore.c: m0_semaphore_timeddown()` - - **References**: -- - [CASTOR-1990: Different sem_timedwait() behaviour on real cluster node and EC2 node](https://jts.seagate.com/browse/CASTOR-1990) -- - [Bug 1412082 - futex_abstimed_wait() always converts abstime to relative time](https://bugzilla.redhat.com/show_bug.cgi?id=1412082) -+ - [CASTOR-1990: Different sem_timedwait() behaviour on real cluster node and EC2 node](https://jts.seagate.com/browse/CASTOR-1990) -+ - [Bug 1412082 - futex_abstimed_wait() always converts abstime to relative time](https://bugzilla.redhat.com/show_bug.cgi?id=1412082) - --* `sched_getcpu(3)` on KVM guest -+* `sched_getcpu(3)` on KVM guest - - **Problem**: `sched_getcpu(3)` can return 0 on a KVM guest system regardless of cpu number. - -@@ -31,4 +31,4 @@ List of workarounds for third-party libraries and external dependencies - **Source**: `lib/user_space/processor.c processor_getcpu_init()` - - **References**: -- - [MOTR-2500: Motr panic: (locality == m0_locality_here()) at m0_locality_chores_run()](https://jts.seagate.com/browse/MOTR-2500) -+ - [MOTR-2500: Motr panic: (locality == m0_locality_here()) at m0_locality_chores_run()](https://jts.seagate.com/browse/MOTR-2500) -diff --git a/fdmi/plugins/motr-fdmi-app.md b/fdmi/plugins/motr-fdmi-app.md -index 1c15efade9b..542f89498a0 100644 ---- a/fdmi/plugins/motr-fdmi-app.md -+++ b/fdmi/plugins/motr-fdmi-app.md -@@ -105,8 +105,8 @@ The executable binary file will be compiled as part of the initial Motr compilat - - The `fdmi_sample_plugin` application can be tested in two forms: - --- Running the `fdmi_app` python script --- Running the `fdmi_plugin_st` shell script -+- Running the `fdmi_app` python script -+- Running the `fdmi_plugin_st` shell script - - For the first case, `fdmi_sample_plugin` communicates with the [fdmi_app]( https://github.com/Seagate/cortx-motr/blob/main/fdmi/plugins/fdmi_app) python script by printing to standard output all the FDMI records. - -@@ -129,12 +129,12 @@ In order to do that, we need to run the `fdmi_app` script typing in the console - The basic arguments needed are the cluster info which will be picked by default from the `etc/motr/confd.xc` config file if not specified at the time of running. This way the FDMI plugin knows where to connect. - - Examples of the flags you can provide to the python script are: --- `-pp`: `plugin path` --- `-le`: `Local endpoint` --- `-fi`: `Filter id` --- `-ha`: `HA endpoint` --- `-pf`: `Profile fid` --- `-sf`: `Process fid` -+- `-pp`: `plugin path` -+- `-le`: `Local endpoint` -+- `-fi`: `Filter id` -+- `-ha`: `HA endpoint` -+- `-pf`: `Profile fid` -+- `-sf`: `Process fid` - - All the flags can be known by running the help:`-h` option. - -@@ -210,4 +210,4 @@ More details about the FDMI design and settings can be found in this link: - - ## Tested by - --- Dec 7, 2021: Liana Valdes Rodriguez (liana.valdes@seagate.com / lvald108@fiu.edu) tested using CentOS Linus release 7.8.2003 x86_64 -+- Dec 7, 2021: Liana Valdes Rodriguez (liana.valdes@seagate.com / lvald108@fiu.edu) tested using CentOS Linus release 7.8.2003 x86_64 -diff --git a/hsm/README.md b/hsm/README.md -index 0f93287d521..d33e17e5077 100644 ---- a/hsm/README.md -+++ b/hsm/README.md -@@ -5,14 +5,14 @@ HSM stands for Hierarchical Storage Management. The concept and design are discu - - For more information, see: - --- [D3.1 HSM for SAGE: Concept and Architecture Report](https://github.com/Seagate/cortx-motr/blob/main/doc/PDF/SAGE_WP3_HSM_for_SAGE_Concept_and_Architecture_v1_Submitted_PUBLIC.pdf) --- [D3.5 HSM for SAGE: Validation Readiness Report](https://github.com/Seagate/cortx-motr/blob/main/doc/PDF/SAGE_D35_HSM_validation_readiness_PUBLIC.pdf) --- [D3.9 HSM for SAGE: Final Validation Report](https://github.com/Seagate/cortx-motr/blob/main/doc/PDF/SAGE_D3.9_HSM_final_v1.1_PUBLIC.pdf) -+- [D3.1 HSM for SAGE: Concept and Architecture Report](https://github.com/Seagate/cortx-motr/blob/main/doc/PDF/SAGE_WP3_HSM_for_SAGE_Concept_and_Architecture_v1_Submitted_PUBLIC.pdf) -+- [D3.5 HSM for SAGE: Validation Readiness Report](https://github.com/Seagate/cortx-motr/blob/main/doc/PDF/SAGE_D35_HSM_validation_readiness_PUBLIC.pdf) -+- [D3.9 HSM for SAGE: Final Validation Report](https://github.com/Seagate/cortx-motr/blob/main/doc/PDF/SAGE_D3.9_HSM_final_v1.1_PUBLIC.pdf) - - - The m0hsm tool available in this directory allows to create composite objects in Motr, write/read to/from them and move them between the tiers (pools). Here is how to use the tool: - --1. Set the following environment variables: -+1. Set the following environment variables: - - ```bash - export CLIENT_PROFILE="<0x7000000000000001:0x480>" # profile id -@@ -24,9 +24,9 @@ The m0hsm tool available in this directory allows to create composite objects in - Profile id of the cluster and ha-agent address on your client node can - be checked with `hctl status` command. As well as all addresses and - processes ids configured in the cluster. Consult with the cluster system -- administrator about which of them you can use. -+ administrator about which of them you can use. - --2. Initialize the composite layout index: -+2. Initialize the composite layout index: - - ```Text - $ m0composite "$CLIENT_LADDR" "$CLIENT_HA_ADDR" "$CLIENT_PROFILE" "$CLIENT_PROC_FID" -@@ -34,7 +34,7 @@ The m0hsm tool available in this directory allows to create composite objects in - - Note: this should be done one time only after the cluster bootstrap. - --3. Configure pools ids of the tiers in ~/.hsm/config file: -+3. Configure pools ids of the tiers in ~/.hsm/config file: - - ```Text - M0_POOL_TIER1 = <0x6f00000000000001:0xc74> # NVME -diff --git a/scripts/provisioning/README.md b/scripts/provisioning/README.md -index af15254c2b2..6c342e4c8e7 100644 ---- a/scripts/provisioning/README.md -+++ b/scripts/provisioning/README.md -@@ -1,24 +1,24 @@ - Build and Test Environment for Motr - =================================== - --* [Quick Start (MacOS)](#quick-start-macos) --* [Quick Start (Windows)](#quick-start-windows) --* [Overview](#overview) --* [Requirements](#requirements) --* [DevVM provisioning](#devvm-provisioning) --* [Building and running Motr](#building-and-running-motr) --* [Try single-node Motr cluster](#try-single-node-motr-cluster) --* [Vagrant basics](#vagrant-basics) --* [Streamlining VMs creation and provisioning with snapshots](#streamlining-vms-creation-and-provisioning-with-snapshots) --* [Managing multiple VM sets with workspaces](#managing-multiple-vm-sets-with-workspaces) --* [Executing Ansible commands manually](#executing-ansible-commands-manually) --* [VirtualBox / VMware / Libvirt specifics](#virtualbox--vmware--libvirt-specifics) -+* [Quick Start (MacOS)](#quick-start-macos) -+* [Quick Start (Windows)](#quick-start-windows) -+* [Overview](#overview) -+* [Requirements](#requirements) -+* [DevVM provisioning](#devvm-provisioning) -+* [Building and running Motr](#building-and-running-motr) -+* [Try single-node Motr cluster](#try-single-node-motr-cluster) -+* [Vagrant basics](#vagrant-basics) -+* [Streamlining VMs creation and provisioning with snapshots](#streamlining-vms-creation-and-provisioning-with-snapshots) -+* [Managing multiple VM sets with workspaces](#managing-multiple-vm-sets-with-workspaces) -+* [Executing Ansible commands manually](#executing-ansible-commands-manually) -+* [VirtualBox / VMware / Libvirt specifics](#virtualbox--vmware--libvirt-specifics) - - Quick Start (MacOS) - ------------------- - --* Install -- - [Homebrew](https://brew.sh/) -+* Install -+ - [Homebrew](https://brew.sh/) - - ```bash - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -@@ -28,27 +28,27 @@ Quick Start (MacOS) - - brew install bash - -- - GNU `readlink` -+ - GNU `readlink` - - brew install coreutils - -- - [VMware Fusion](https://www.vmware.com/go/downloadfusion) or -+ - [VMware Fusion](https://www.vmware.com/go/downloadfusion) or - [VirtualBox](https://www.virtualbox.org/wiki/Downloads) - (VMware is recommended for better experience) -- - [Vagrant](https://www.vagrantup.com/downloads.html) (and -+ - [Vagrant](https://www.vagrantup.com/downloads.html) (and - [Vagrant VMware Utility](https://www.vagrantup.com/vmware/downloads) in case of VMware) -- - Vagrant plugins (for VMware the license needs to be [purchased](https://www.vagrantup.com/vmware)) -+ - Vagrant plugins (for VMware the license needs to be [purchased](https://www.vagrantup.com/vmware)) - - vagrant plugin install vagrant-{env,hostmanager,scp} - vagrant plugin install vagrant-vmware-desktop # for VMware or - - vagrant plugin install vagrant-vbguest # for VirtualBox - -- - Ansible -+ - Ansible - - brew install ansible # on Linux or macOS hosts - --* Configure -+* Configure - - `m0vg` script (make sure you have `$HOME/bin` in the `$PATH`) - - ```bash -@@ -56,7 +56,7 @@ Quick Start (MacOS) - ln -s $MOTR_SRC/scripts/m0vg $HOME/bin/ - ``` - -- - VMs -+ - VMs - - ```bash - # open virtual cluster configuration file in default editor -@@ -106,36 +106,36 @@ Quick Start (MacOS) - see `m0vg params` output for the full list of supported configuration - parameters - --* Run -- - check VMs state -+* Run -+ - check VMs state - - m0vg status - -- - create _cmu_ VM (this can take ~30 minutes depending on the internet -+ - create _cmu_ VM (this can take ~30 minutes depending on the internet - connection, CPU and system disk speed) - - m0vg up cmu - -- - restart _cmu_ VM in order to activate shared folder -+ - restart _cmu_ VM in order to activate shared folder - - m0vg reload cmu - -- - logon on _cmu_ and check contents of `/data` dir -+ - logon on _cmu_ and check contents of `/data` dir - - m0vg tmux - ls /data - -- - create _ssu_ and _client_ VMs (can take about ~40 minutes depending on the -+ - create _ssu_ and _client_ VMs (can take about ~40 minutes depending on the - number of configured _ssu_ and _client_ nodes) - - m0vg up /ssu/ /client/ - m0vg reload /ssu/ /client/ - -- - stop all nodes when they're not needed to be running -+ - stop all nodes when they're not needed to be running - - m0vg halt - -- - if a node hangs (e.g. Motr crash in kernel or deadlock) it can be forced -+ - if a node hangs (e.g. Motr crash in kernel or deadlock) it can be forced - to shutdown using `-f` option for `halt` command, for example: - - m0vg halt -f client1 -@@ -143,35 +143,35 @@ Quick Start (MacOS) - Quick Start (Windows) - --------------------- - --* Install -- - [VMware Workstation](https://www.vmware.com/go/downloadworkstation) or -+* Install -+ - [VMware Workstation](https://www.vmware.com/go/downloadworkstation) or - [VirtualBox](https://www.virtualbox.org/wiki/Downloads) - (VMware is recommended for better experience) -- - [Vagrant](https://www.vagrantup.com/downloads.html) (and -+ - [Vagrant](https://www.vagrantup.com/downloads.html) (and - [Vagrant VMware Utility](https://www.vagrantup.com/vmware/downloads) in case of VMware) -- - Vagrant plugins (for VMware the license needs to be [purchased](https://www.vagrantup.com/vmware)) -+ - Vagrant plugins (for VMware the license needs to be [purchased](https://www.vagrantup.com/vmware)) - - vagrant plugin install vagrant-{env,hostmanager,scp} - vagrant plugin install vagrant-vmware-desktop # for VMware or - - vagrant plugin install vagrant-vbguest # for VirtualBox - -- - [Git for Windows](https://git-scm.com/download/win) -+ - [Git for Windows](https://git-scm.com/download/win) - During installation, when asked, choose the following options (keep other options to their default setting): - -- - _Use Git and optional Unix tools from the Command Prompt_ -- - _Checkout as-is, commit Unix-style line ending_ -- - _Enable symbolic links_ -+ - _Use Git and optional Unix tools from the Command Prompt_ -+ - _Checkout as-is, commit Unix-style line ending_ -+ - _Enable symbolic links_ - --* Configure -+* Configure - -- - Open _Git Bash_ terminal, add CRLF configuration option to make sure that Motr/Hare scripts can work on VM -+ - Open _Git Bash_ terminal, add CRLF configuration option to make sure that Motr/Hare scripts can work on VM - - ```bash - git config --global core.autocrlf input - ``` - -- - Clone Motr repository somewhere, just as an example let's say it's in `$HOME/src/motr`: -+ - Clone Motr repository somewhere, just as an example let's say it's in `$HOME/src/motr`: - - ```bash - mkdir -p src -@@ -179,7 +179,7 @@ Quick Start (Windows) - git clone --recursive git@github.com:Seagate/cortx-motr.git motr - ``` - -- - Create a persistent alias for `m0vg` script: -+ - Create a persistent alias for `m0vg` script: - - ```bash - cat <> $HOME/.bash_profile -@@ -191,9 +191,9 @@ Quick Start (Windows) - - Exit and re-launch _Git Bash_ terminal. At this point the setup should be complete. - --* Run -+* Run - -- - Follow the steps from _Run_ section under _Quick Start (MacOS)_ above. -+ - Follow the steps from _Run_ section under _Quick Start (MacOS)_ above. - - > *NOTE*: during `m0vg up ` command execution you may be asked to enter - > your Windows username and password, and then grant permissions for -@@ -240,22 +240,22 @@ In order to run these scripts, additional tools have to be installed first. It's - assumed that either _macOS_, _Windows_ or _Linux_ is used as a host operating - system. - --* Minimum Host OS -- - 8GB of RAM -- - 10GB of free disk space -- - 2 CPU cores -+* Minimum Host OS -+ - 8GB of RAM -+ - 10GB of free disk space -+ - 2 CPU cores - --* Additional Software/Tools: -- - [VMware Fusion](https://www.vmware.com/products/fusion.html) (for _macOS_) or -+* Additional Software/Tools: -+ - [VMware Fusion](https://www.vmware.com/products/fusion.html) (for _macOS_) or - [VMware Workstation](https://www.vmware.com/products/workstation-pro.html) (for _Windows_) _OR_ - [VirtualBox](https://www.virtualbox.org/wiki/Downloads) - (VMware is recommended for better experience in terms of memory utilisation) - - `libvirt + qemu-kvm` (_Linux_ only) -- - [Vagrant](https://www.vagrantup.com/downloads.html) -- - [Vagrant VMware plugin](https://www.vagrantup.com/vmware) + -- [Vagrant VMware Utility](https://www.vagrantup.com/vmware/downloads) (in case of VMware) -- - [Ansible](https://github.com/ansible/ansible) (_macOS_ and _Linux_ only) -- - [Git for Windows](https://git-scm.com/download/win) (_Windows_ only) -+ - [Vagrant](https://www.vagrantup.com/downloads.html) -+ - [Vagrant VMware plugin](https://www.vagrantup.com/vmware) + -+ [Vagrant VMware Utility](https://www.vagrantup.com/vmware/downloads) (in case of VMware) -+ - [Ansible](https://github.com/ansible/ansible) (_macOS_ and _Linux_ only) -+ - [Git for Windows](https://git-scm.com/download/win) (_Windows_ only) - - On _Ubuntu Linux_ all of the above prerequisites can be installed with a single - command: From ea8ecad637e9d9a28029e715c3641ceb522b0b8b Mon Sep 17 00:00:00 2001 From: Rinku Kothiya Date: Mon, 22 Aug 2022 10:46:26 +0530 Subject: [PATCH 14/32] CORTX-30751: Codacy code cleanup (#1606) (#1957) This patch fixes some of the codacy warnings. warning fixed : "Double quote to prevent globing and words splitting". Signed-off-by: Rinku Kothiya Signed-off-by: Swapnil Chaudhary --- scripts/provisioning/vmhost/super-cleanup.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/provisioning/vmhost/super-cleanup.sh b/scripts/provisioning/vmhost/super-cleanup.sh index 741f46968fc..b4b3bfbedf2 100644 --- a/scripts/provisioning/vmhost/super-cleanup.sh +++ b/scripts/provisioning/vmhost/super-cleanup.sh @@ -22,14 +22,14 @@ ## This is our rescue script when there is system overload because of ## un-cleaned VMs lying in the system. -SCRIPT_DIR="`dirname $0`" +SCRIPT_DIR=$(dirname "$0") DIR_TO_CLEAN="$HOME/virtual_clusters" if [ "$1" != "" ]; then DIR_TO_CLEAN="$1" fi -if [ ! -d $DIR_TO_CLEAN ]; then +if [ ! -d "$DIR_TO_CLEAN" ]; then echo "Path $DIR_TO_CLEAN doesnot exist." exit 1 fi @@ -52,7 +52,7 @@ echo "" echo "Following files exist in the [$DIR_TO_CLEAN] path." echo "" echo "" -ls -l $DIR_TO_CLEAN +ls -l "$DIR_TO_CLEAN" echo -n "Do you want to clean-up every file/cluster? Type [YES] in 30 seconds to continue. " read -t 30 CH if [ "$CH" != "YES" ]; then @@ -64,10 +64,10 @@ fi echo "No looking back now !!!" -for CLSTR_PATH in $DIR_TO_CLEAN/*; do +for CLSTR_PATH in "$DIR_TO_CLEAN"/*; do if [ -d "${CLSTR_PATH}" ]; then - CLSTR="`basename $CLSTR_PATH`" - $SCRIPT_DIR/destroy-cluster.sh $CLSTR --force + CLSTR=$(basename "$CLSTR_PATH") + "$SCRIPT_DIR"/destroy-cluster.sh "$CLSTR" --force fi done From db799e07a3328fd85ef8f5026f171162838fbd87 Mon Sep 17 00:00:00 2001 From: Rinku Kothiya Date: Mon, 22 Aug 2022 10:47:42 +0530 Subject: [PATCH 15/32] CORTX-30751: Codacy code cleanup (#1606) (#1956) This patch fixes some of the codacy warnings. warning fixed : "Double quote to prevent globing and words splitting". Signed-off-by: Rinku Kothiya Signed-off-by: Swapnil Chaudhary --- scripts/systemtap/kem/kem_run.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/systemtap/kem/kem_run.sh b/scripts/systemtap/kem/kem_run.sh index 6416d97483a..f1e8653f578 100755 --- a/scripts/systemtap/kem/kem_run.sh +++ b/scripts/systemtap/kem/kem_run.sh @@ -25,7 +25,7 @@ # # $ make -KEM_DIR="$(readlink -f $0)" +KEM_DIR=$(readlink -f "$0") KEM_DIR="${KEM_DIR%/*}" if [ "$EUID" -ne 0 ]; then @@ -34,15 +34,15 @@ if [ "$EUID" -ne 0 ]; then fi echo Inserting kemd.ko -insmod $KEM_DIR/kemd.ko +insmod "$KEM_DIR/kemd.ko" for i in $(seq 0 $(($(nproc)-1))) do - mknod /dev/kemd$i c 60 $i + mknod "/dev/kemd$i" c 60 "$i" done echo Running Systemtap -stap -g $KEM_DIR/kemd.stp & +stap -g "$KEM_DIR/kemd.stp" & stapPID=$! # Wait stap for start @@ -51,7 +51,7 @@ sleep 20 echo Running KEM clients for i in $(seq 0 $(($(nproc)-1))) do - $KEM_DIR/m0kemc $i > kemc_cpu$i.log 2>&1 & + "$KEM_DIR/m0kemc" "$i" > kemc_cpu"$i".log 2>&1 & kemcPIDs[$i]=$! done @@ -70,14 +70,14 @@ sleep 2 for i in $(seq 0 $(($(nproc)-1))) do - rm -f /dev/kemd$i + rm -f "/dev/kemd$i" done echo Removing kemd.ko -rmmod $KEM_DIR/kemd.ko +rmmod "$KEM_DIR/kemd.ko" for i in $(seq 0 $(($(nproc)-1))) do - $KEM_DIR/../../../utils/m0run m0addb2dump $PWD/_kemc$i/o/100000000000000:2 | grep pagefault -A 1 | head -n 40 - $KEM_DIR/../../../utils/m0run m0addb2dump $PWD/_kemc$i/o/100000000000000:2 | grep ctx_switch -A 1 | head -n 40 + "$KEM_DIR/../../../utils/m0run m0addb2dump" "$PWD"/_kemc"$i"/o/100000000000000:2 | grep pagefault -A 1 | head -n 40 + "$KEM_DIR/../../../utils/m0run m0addb2dump" "$PWD"/_kemc"$i"/o/100000000000000:2 | grep ctx_switch -A 1 | head -n 40 done From fa0aedef252794a9e8d84dfd3e017fb1a55a30c4 Mon Sep 17 00:00:00 2001 From: Rinku Kothiya Date: Mon, 22 Aug 2022 12:49:45 +0530 Subject: [PATCH 16/32] CORTX-30751: Codacy code cleanup (#1606) (#1855) This patch fixes some of the codacy warnings. warning fixed : "Double quote to prevent globing and words splitting". Signed-off-by: Rinku Kothiya Signed-off-by: Swapnil Chaudhary --- m0t1fs/linux_kernel/st/m0t1fs_fsync_test.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/m0t1fs/linux_kernel/st/m0t1fs_fsync_test.sh b/m0t1fs/linux_kernel/st/m0t1fs_fsync_test.sh index 3ea7dc32ce7..2efc6e309a4 100755 --- a/m0t1fs/linux_kernel/st/m0t1fs_fsync_test.sh +++ b/m0t1fs/linux_kernel/st/m0t1fs_fsync_test.sh @@ -19,15 +19,15 @@ # -. `dirname $0`/common.sh -. `dirname $0`/m0t1fs_common_inc.sh -. `dirname $0`/m0t1fs_client_inc.sh -. `dirname $0`/m0t1fs_server_inc.sh -. `dirname $0`/m0t1fs_sns_common_inc.sh +. $(dirname "$0")/common.sh +. $(dirname "$0")/m0t1fs_common_inc.sh +. $(dirname "$0")/m0t1fs_client_inc.sh +. $(dirname "$0")/m0t1fs_server_inc.sh +. $(dirname "$0")/m0t1fs_sns_common_inc.sh fsync_test() { - `dirname $0`/m0t1fs_fsync_test_helper $MOTR_M0T1FS_MOUNT_DIR + $(dirname "$0")/m0t1fs_fsync_test_helper "$MOTR_M0T1FS_MOUNT_DIR" return $? } @@ -48,15 +48,15 @@ main() rc=0 echo "motr service started" - mkdir -p $MOTR_M0T1FS_MOUNT_DIR - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR "oostore" || return 1 + mkdir -p "$MOTR_M0T1FS_MOUNT_DIR" + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" "oostore" || return 1 fsync_test || { echo "Failed: Fsync test failed.." rc=1 } - unmount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR &>> $MOTR_TEST_LOGFILE + unmount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" &>> "$MOTR_TEST_LOGFILE" motr_service stop if [ $? -ne "0" ] From ffc76d760e8acb37e8f525a1cea5a4ea84c1f578 Mon Sep 17 00:00:00 2001 From: Rinku Kothiya Date: Mon, 22 Aug 2022 12:50:52 +0530 Subject: [PATCH 17/32] CORTX-30751: Codacy code cleanup (#2045) This patch fixes some of the codacy warnings. warning fixed : "Double quote to prevent globing and words splitting". Signed-off-by: Rinku Kothiya Co-authored-by: Pradeep Kumbhre Signed-off-by: Swapnil Chaudhary --- scripts/demo/2015-10-dev2.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/demo/2015-10-dev2.sh b/scripts/demo/2015-10-dev2.sh index 44a7b2887c4..7385ca5df6d 100755 --- a/scripts/demo/2015-10-dev2.sh +++ b/scripts/demo/2015-10-dev2.sh @@ -40,7 +40,7 @@ CONFD_NODE="172.16.1.1" SERVER_LIST="$(echo 172.16.1.{1..6} 172.16.2.{1..7})" CLIENT_LIST="$(echo 10.22.192.{51,52,{59..64},68,69})" TEST_TYPE="write" -NUMBER_OF_CLIENTS=$(echo $CLIENT_LIST | wc -w) +NUMBER_OF_CLIENTS=$(echo "$CLIENT_LIST" | wc -w) FILE_LID=13 TEST_DURATION="10m" FILE_PREFIX="0:1000" @@ -58,7 +58,7 @@ FIO_BINARY="/root/fio" function on_each_server() { for node in $SERVER_LIST; do - ssh -n $node "$@" & + ssh -n "$node" "$@" & done wait } @@ -66,7 +66,7 @@ function on_each_server() function on_each_client() { for node in $CLIENT_LIST; do - ssh -n $node "$@" & + ssh -n "$node" "$@" & done wait } @@ -74,7 +74,7 @@ function on_each_client() function on_each_node() { for node in $CLIENT_LIST $SERVER_LIST; do - ssh -n $node "$@" & + ssh -n "$node" "$@" & done wait } @@ -90,7 +90,7 @@ function scp_to_each_node() local remote_file="$2" for node in $CLIENT_LIST $SERVER_LIST; do - scp $local_file $node:$remote_file & + scp "$local_file" "$node":"$remote_file" & done wait } @@ -98,7 +98,7 @@ function scp_to_each_node() function fio_script() { local client_index=$1 - local client_index0=$(printf %02d $client_index) + local client_index0=$(printf %02d "$client_index") cat << EOF # tested with patched fio-2.2.10 [global] @@ -213,8 +213,8 @@ function run_test() done if [ "x$TEST_TYPE" = "xwrite" ]; then echo "`date` Creating $FILE_PREFIX-prefixed files on $node..." - ssh -n $node "touch $files" - ssh -n $node "setfattr -n lid -v $FILE_LID $files" + ssh -n "$node" "touch $files" + ssh -n "$node" "setfattr -n lid -v $FILE_LID $files" echo "`date` Done." fi i=0 @@ -228,7 +228,7 @@ function run_test() break fi done - $FIO_BINARY --eta-newline=5 --status-interval=30 $FIO_PARAMS + "$FIO_BINARY" --eta-newline=5 --status-interval=30 $FIO_PARAMS on_each_client pkill -x fio wait } @@ -253,11 +253,11 @@ function run_command() ssh -n $CONFD_NODE sed \''s/.*$pool_width $data_units $parity_units.*/ [2: "$pool_width $data_units $parity_units", "'$FILE_LID'"],/'\' -i /usr/libexec/cortx-motr/motr-service.functions ;; "mkfs") - ssh -n $CONFD_NODE systemctl start motr-mkfs@confd - ssh -n $CONFD_NODE systemctl start motr-server-confd - i=0; for n in $SERVER_LIST; do ssh -n $n systemctl start motr-mkfs@ios$i & i=$(($i + 1)); done - ssh -n $CONFD_NODE systemctl start motr-mkfs@mds & - ssh -n $CONFD_NODE systemctl start motr-mkfs@ha & + ssh -n "$CONFD_NODE" systemctl start motr-mkfs@confd + ssh -n "$CONFD_NODE" systemctl start motr-server-confd + i=0; for n in "$SERVER_LIST"; do ssh -n "$n" systemctl start motr-mkfs@ios$i & i=$(($i + 1)); done + ssh -n "$CONFD_NODE" systemctl start motr-mkfs@mds & + ssh -n "$CONFD_NODE" systemctl start motr-mkfs@ha & wait ;; "start_servers") @@ -296,7 +296,7 @@ function main() i) local rpm_file="$OPTARG" scp_to_each_node "$rpm_file" "$rpm_file" - on_each_node rpm -U --force $rpm_file + on_each_node rpm -U --force "$rpm_file" ;; g) cat genders From cbd0e5e9d538c4d5bea797df3379ff23611a532e Mon Sep 17 00:00:00 2001 From: Rinku Kothiya Date: Mon, 22 Aug 2022 12:51:43 +0530 Subject: [PATCH 18/32] CORTX-30751: Codacy code cleanup (#1606) (#1972) This patch fixes some of the codacy warnings. warning fixed : "Double quote to prevent globing and words splitting". Signed-off-by: Rinku Kothiya Signed-off-by: Swapnil Chaudhary --- .../provisioning/vmhost/gci-create-cluster.sh | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/scripts/provisioning/vmhost/gci-create-cluster.sh b/scripts/provisioning/vmhost/gci-create-cluster.sh index 6a7aa00aa22..65678f298f0 100755 --- a/scripts/provisioning/vmhost/gci-create-cluster.sh +++ b/scripts/provisioning/vmhost/gci-create-cluster.sh @@ -76,9 +76,9 @@ script_terminate() { local RESULT=$1 pwd - cd $HOME_DIR + cd "$HOME_DIR" print_msg "Using [$DESTROY_CLUSTER_SCRIPT $CL_DIR_TAG]" - $DESTROY_CLUSTER_SCRIPT $CL_DIR_TAG "--force" + "$DESTROY_CLUSTER_SCRIPT" "$CL_DIR_TAG" "--force" SCRIPT_TIME=$(( $(date +%s) - $SCRIPT_START )) if [ $RESULT != 0 ]; then print_msg "Returing $RESULT; Status: FAILED; in $SCRIPT_TIME seconds." @@ -158,7 +158,7 @@ clone_motr() print_msg "Pulling MOTR_REF [$MOTR_REF]" cd motr print_msg "Executing [git pull $MOTR_REPO $MOTR_REF]" - git pull $MOTR_REPO $MOTR_REF + git pull "$MOTR_REPO" "$MOTR_REF" RESULT=$? if [ $RESULT != 0 ]; then print_msg "ERROR pulling $MOTR_REF!!!" @@ -232,7 +232,7 @@ clone_hare() print_msg "Executing [git checkout -b " \ "$HARE_USER/hare-$HARE_USER_BRANCH FETCH_HEAD]" - git checkout -b $HARE_USER/hare-$HARE_USER_BRANCH FETCH_HEAD + git checkout -b "$HARE_USER/hare-$HARE_USER_BRANCH" FETCH_HEAD RESULT=$? if [ $RESULT != 0 ]; then print_status_and_time $FSTART $RESULT @@ -256,7 +256,7 @@ clone_hare() fi print_msg "Executing [git merge --no-ff $USER/hare-$HARE_USER_BRANCH]" - git merge --no-ff $USER/hare-$HARE_USER_BRANCH + git merge --no-ff "$USER/hare-$HARE_USER_BRANCH" RESULT=$? if [ $RESULT != 0 ]; then print_status_and_time $FSTART $RESULT @@ -268,28 +268,28 @@ clone_hare() use_centos76() { - $M0VG env add M0_VM_BOX=centos76/dev - $M0VG env add M0_VM_BOX_URL="http://cortx-storage.colo.seagate.com/vagrant/centos76/dev" + "$M0VG" env add M0_VM_BOX=centos76/dev + "$M0VG" env add M0_VM_BOX_URL="http://cortx-storage.colo.seagate.com/vagrant/centos76/dev" } use_centos77() { - $M0VG env add M0_VM_BOX=centos77/dev - $M0VG env add M0_VM_BOX_URL="http://cortx-storage.colo.seagate.com/vagrant/centos77/dev" + "$M0VG" env add M0_VM_BOX=centos77/dev + "$M0VG" env add M0_VM_BOX_URL="http://cortx-storage.colo.seagate.com/vagrant/centos77/dev" } edit_m0vg_params() { local FSTART=$(date +%s); local RESULT=0 print_msg "Editing the m0vg params." - $M0VG env add M0_VM_HOSTNAME_PREFIX=$CL_DIR_TAG - $M0VG env add M0_VM_NAME_PREFIX=$CL_DIR_TAG - $M0VG env add M0_VM_NFS_VERSION=3 - $M0VG env add M0_VM_CMU_MEM_MB=8384 - $M0VG env add M0_VM_CLIENT_NR=1 - $M0VG env add M0_VM_CLIENT_MEM_MB=2046 - $M0VG env add M0_VM_SSU_DISKS=6 - $M0VG env add M0_VM_SSU_DISK_SIZE_GB=2 + "$M0VG" env add M0_VM_HOSTNAME_PREFIX="$CL_DIR_TAG" + "$M0VG" env add M0_VM_NAME_PREFIX="$CL_DIR_TAG" + "$M0VG" env add M0_VM_NFS_VERSION=3 + "$M0VG" env add M0_VM_CMU_MEM_MB=8384 + "$M0VG" env add M0_VM_CLIENT_NR=1 + "$M0VG" env add M0_VM_CLIENT_MEM_MB=2046 + "$M0VG" env add M0_VM_SSU_DISKS=6 + "$M0VG" env add M0_VM_SSU_DISK_SIZE_GB=2 # use_centos76 use_centos77 print_status_and_time $FSTART $RESULT @@ -307,7 +307,7 @@ create_vms() read -t 30 CH if [ "$CH" != "4" ]; then print_msg "Creating only cmu !!!" - $M0VG up cmu + "$M0VG" up cmu RESULT=$? if [ $RESULT != 0 ]; then print_msg "IGNORED ERROR in creating cmu vm!!!" @@ -316,7 +316,7 @@ create_vms() ALL_FOUR_VMS_CREATED="NO" else print_msg "Creating all 4 VMs (cmu, ssu1, ssu2, client1) !!!" - $M0VG up cmu ssu1 ssu2 client1 + "$M0VG" up cmu ssu1 ssu2 client1 RESULT=$? if [ $RESULT != 0 ]; then print_msg "IGNORED ERROR in creating cmu vm!!!" @@ -339,7 +339,7 @@ create_cluster() print_msg "Using CL_DIR_PATH [$CL_DIR_PATH];" cleanup_if_existing - mkdir $CL_DIR_PATH; cd $CL_DIR_PATH + mkdir "$CL_DIR_PATH"; cd "$CL_DIR_PATH" clone_motr RESULT=$? @@ -381,7 +381,7 @@ verify_mount() TEST_FILE_VM_PATH="/data/TEST_FILE" TEST_FILE_HOST_PATH="$CL_DIR_PATH/TEST_FILE" - $M0VG run --vm $VM "touch $TEST_FILE_VM_PATH" + "$M0VG" run --vm "$VM" "touch $TEST_FILE_VM_PATH" RESULT=$? if [ $? = 0 ] && [ -f "$TEST_FILE_HOST_PATH" ]; then print_msg "Mount of /data is verified successfully for [$VM];" @@ -392,8 +392,8 @@ verify_mount() "Will retry after 30 sec." read -t 30 a ## CAREFUL -- We are making a recursive call here - $M0VG reload $VM - verify_mount $VM + "$M0VG" reload "$VM" + verify_mount "$VM" fi print_status_and_time $FSTART $RESULT return $RESULT @@ -424,7 +424,7 @@ compile_install_motr() ## COMPILATION OF MOTR M0C_START=$(date +%s) print_msg " COMPILATION OF MOTR STARTED!!! M0C_START [$M0C_START]!!!" - $M0VG run --vm cmu $COMPILE_INSTALL_MOTR_SCRIPT + "$M0VG" run --vm cmu "$COMPILE_INSTALL_MOTR_SCRIPT" RESULT=$?; FTIME=$(( $(date +%s) - $FSTART )) if [ $RESULT = 0 ]; then @@ -441,7 +441,7 @@ compile_install_hare() ## COMPILATION OF HARE H0C_START=$(date +%s) print_msg "COMPILATION OF HARE STARTED!!! H0C_START [$H0C_START]!!!" - $M0VG run --vm cmu $COMPILE_INSTALL_HARE_SCRIPT + "$M0VG" run --vm cmu "$COMPILE_INSTALL_HARE_SCRIPT" RESULT=$?; FTIME=$(( $(date +%s) - $FSTART )) if [ $RESULT = 0 ]; then @@ -458,7 +458,7 @@ start_cluster() ## Starting the cluster STCL_START=$(date +%s) print_msg "Starting the cluster !!!" - $M0VG run --vm cmu $START_CLUSTER_SCRIPT + "$M0VG" run --vm cmu "$START_CLUSTER_SCRIPT" RESULT=$?; FTIME=$(( $(date +%s) - $FSTART )) if [ $RESULT = 0 ]; then @@ -475,7 +475,7 @@ run_tests() ## Run tests print_msg "TESTS WILL BE EXEUTED FROM THE [$RUN_TESTS_SCRIPT]" print_msg "To add your own tests, append these to this file." - $M0VG run --vm cmu $RUN_TESTS_SCRIPT + "$M0VG" run --vm cmu "$RUN_TESTS_SCRIPT" RESULT=$?; FTIME=$(( $(date +%s) - $FSTART )) if [ $RESULT = 0 ]; then @@ -491,17 +491,17 @@ reboot_cluster() { local FSTART=$(date +%s); local RESULT=0 if [ "$ALL_FOUR_VMS_CREATED" == "YES" ]; then - $M0VG reload cmu - $M0VG reload ssu1 - $M0VG reload ssu2 - $M0VG reload client1 + "$M0VG" reload cmu + "$M0VG" reload ssu1 + "$M0VG" reload ssu2 + "$M0VG" reload client1 elif [ "$ALL_FOUR_VMS_CREATED" == "NO" ]; then - $M0VG reload cmu + "$M0VG" reload cmu else print_msg "Some thing has gone wrong with reboot of VMs." script_terminate -1 fi - vagrant global-status --prune | grep $CL_DIR_TAG + vagrant global-status --prune | grep "$CL_DIR_TAG" print_msg "Now waiting for 120 secs for the machines to reboot." print_msg "Press ENTER to verify reboot now." read -t 120 a @@ -547,7 +547,7 @@ print_msg "tests will be executed" check_load_on_host -mkdir -p $CL_HOME; cd $CL_HOME +mkdir -p "$CL_HOME"; cd "$CL_HOME" create_cluster RESULT=$? From a47dc9ab2a66799e47c9e5de7b80b8d466c04d97 Mon Sep 17 00:00:00 2001 From: Huang Hua Date: Mon, 22 Aug 2022 17:19:56 +0800 Subject: [PATCH 19/32] Adding async_disconnecting flag to avoid multiple async rpc disconn (#2004) * async_disconnecting is used to check if waiting is needed. * No need to call session_put() in rm_remote_free(). Because at this moment, maybe some other requests are still in progress. Signed-off-by: Hua Huang Signed-off-by: Swapnil Chaudhary --- rm/rm.c | 8 -------- rpc/link.c | 1 + rpc/link.h | 1 + rpc/service.c | 7 +++++-- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/rm/rm.c b/rm/rm.c index 471f3cbfbd0..db213ba11d0 100644 --- a/rm/rm.c +++ b/rm/rm.c @@ -1385,7 +1385,6 @@ static void rm_remote_free(struct m0_ref *ref) { struct m0_rm_remote *rem = container_of(ref, struct m0_rm_remote, rem_refcnt); - struct m0_rpc_session *sess = rem->rem_session; /* * Free only those remotes who connected to us asking for @@ -1399,13 +1398,6 @@ static void rm_remote_free(struct m0_ref *ref) m0_remotes_tlist_del(rem); m0_rm_remote_fini(rem); m0_free(rem); - - /* - * Note: it seems the session can be NULL only in UTs here. - * (In particular, at rm-ut:fom-funcs.) - */ - if (sess != NULL) - m0_rpc_service_reverse_session_put(sess, true); } M0_INTERNAL void m0_rm_remote_init(struct m0_rm_remote *rem, diff --git a/rpc/link.c b/rpc/link.c index 3531b5e320c..83665f23e2d 100644 --- a/rpc/link.c +++ b/rpc/link.c @@ -615,6 +615,7 @@ M0_INTERNAL int m0_rpc_link_init(struct m0_rpc_link *rlink, rlink->rlk_connected = false; rlink->rlk_rc = 0; + rlink->rlk_async_disconnecting = false; rc = m0_net_end_point_create(&net_ep, &mach->rm_tm, ep); if (rc == 0) { diff --git a/rpc/link.h b/rpc/link.h index fe65733d62b..987ad1801f3 100644 --- a/rpc/link.h +++ b/rpc/link.h @@ -53,6 +53,7 @@ struct m0_rpc_link { struct m0_mutex rlk_wait_mutex; m0_time_t rlk_timeout; bool rlk_connected; + bool rlk_async_disconnecting; }; enum m0_rpc_link_states { diff --git a/rpc/service.c b/rpc/service.c index 07e8c54087a..42e050a449a 100644 --- a/rpc/service.c +++ b/rpc/service.c @@ -237,7 +237,9 @@ m0_rpc_service_reverse_session_put(struct m0_rpc_session *sess, bool disc) rlk = container_of(sess, struct m0_rpc_link, rlk_sess); revc = container_of(rlk, struct m0_reverse_connection, rcf_rlink); - if (revc->rcf_rlink.rlk_connected) { + if (revc->rcf_rlink.rlk_connected && + !revc->rcf_rlink.rlk_async_disconnecting) { + revc->rcf_rlink.rlk_async_disconnecting = true; M0_PRE(!m0_clink_is_armed(&revc->rcf_disc_wait)); m0_clink_fini(&revc->rcf_disc_wait); m0_clink_init(&revc->rcf_disc_wait, @@ -271,7 +273,8 @@ m0_rpc_service_reverse_sessions_cleanup(struct m0_reqh_service *service) false); } m0_tlist_endfor; m0_tl_teardown(rev_conn, &svc->rps_rev_conns, revc) { - if (m0_clink_is_armed(&revc->rcf_disc_wait)) { + if (m0_clink_is_armed(&revc->rcf_disc_wait) && + revc->rcf_rlink.rlk_async_disconnecting) { m0_chan_wait(&revc->rcf_disc_wait); m0_clink_fini(&revc->rcf_disc_wait); } From dee37bb7683b71dd41c6608e536b3c1a5dda65a5 Mon Sep 17 00:00:00 2001 From: Rinku Kothiya Date: Mon, 22 Aug 2022 16:40:15 +0530 Subject: [PATCH 20/32] CORTX-34010: Codacy code cleanup (#2096) Problem: Getting following codacy warnings Useless cat. Consider `cmd < file | ...` Solution: Removed unnecessary cat from the command. Signed-off-by: Rinku Kothiya Signed-off-by: Swapnil Chaudhary --- .../install/opt/seagate/cortx/motr/libexec/m0addb_logrotate.sh | 2 +- .../install/opt/seagate/cortx/motr/libexec/m0trace_logrotate.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install/opt/seagate/cortx/motr/libexec/m0addb_logrotate.sh b/scripts/install/opt/seagate/cortx/motr/libexec/m0addb_logrotate.sh index 5602c2806ec..1d1e81a9ada 100755 --- a/scripts/install/opt/seagate/cortx/motr/libexec/m0addb_logrotate.sh +++ b/scripts/install/opt/seagate/cortx/motr/libexec/m0addb_logrotate.sh @@ -52,7 +52,7 @@ check_param() log_dirs_max_count=2 # have hard coded the log path, # Need to get it from config file -ADDB_RECORD_DIR=$(cat /etc/sysconfig/motr | grep "^MOTR_M0D_ADDB_STOB_DIR" | cut -d '=' -f2) +ADDB_RECORD_DIR=$(grep "^MOTR_M0D_ADDB_STOB_DIR" /etc/sysconfig/motr | cut -d '=' -f2) if [ -z "$ADDB_RECORD_DIR" ]; then ADDB_RECORD_DIR="/var/motr/m0d-*" fi diff --git a/scripts/install/opt/seagate/cortx/motr/libexec/m0trace_logrotate.sh b/scripts/install/opt/seagate/cortx/motr/libexec/m0trace_logrotate.sh index 73928e03c41..1f58fe66be7 100755 --- a/scripts/install/opt/seagate/cortx/motr/libexec/m0trace_logrotate.sh +++ b/scripts/install/opt/seagate/cortx/motr/libexec/m0trace_logrotate.sh @@ -59,7 +59,7 @@ log_files_max_count=5 # have hard coded the log path, # Need to get it from config file motr_logdirs=`ls -d /var/motr*` -M0TR_M0D_TRACE_DIR=$(cat /etc/sysconfig/motr | grep "^MOTR_M0D_TRACE_DIR" | cut -d '=' -f2) +M0TR_M0D_TRACE_DIR=$(grep "^MOTR_M0D_TRACE_DIR" /etc/sysconfig/motr | cut -d '=' -f2) M0D_TRACE_DIR="${M0TR_M0D_TRACE_DIR%\'}" M0D_TRACE_DIR="${M0D_TRACE_DIR#\'}" if [ -n "$M0D_TRACE_DIR" ]; then From 73913ed785efbadda15c7e4b2506aa5bbf5b7aed Mon Sep 17 00:00:00 2001 From: Sayed Alfhad Shah Date: Wed, 24 Aug 2022 13:24:04 +0530 Subject: [PATCH 21/32] CORTX-30751: Codacy code cleanup (#1606) (#1920) This patch fixes some of the codacy warnings. warning fixed : "Double quote to prevent globing and words splitting". Signed-off-by: alfhad Signed-off-by: Swapnil Chaudhary --- spiel/st/m0t1fs_spiel_sns_common_inc.sh | 42 ++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/spiel/st/m0t1fs_spiel_sns_common_inc.sh b/spiel/st/m0t1fs_spiel_sns_common_inc.sh index 9e828d6a0cd..8d3a783a1ab 100755 --- a/spiel/st/m0t1fs_spiel_sns_common_inc.sh +++ b/spiel/st/m0t1fs_spiel_sns_common_inc.sh @@ -91,8 +91,8 @@ verify() { echo "verifying ..." for ((i=0; i < ${#files[*]}; i++)) ; do - local_read $((${unit_size[$i]} * 1024)) ${file_size[$i]} || return $? - read_and_verify ${files[$i]} $((${unit_size[$i]} * 1024)) ${file_size[$i]} || return $? + local_read $((${unit_size[$i]} * 1024)) "${file_size[$i]}" || return $? + read_and_verify "${files[$i]}" $((${unit_size[$i]} * 1024)) "${file_size[$i]}" || return $? done echo "file verification sucess" @@ -143,7 +143,7 @@ spiel_prepare() spiel_cleanup() { - cd $M0_SRC_DIR/utils/spiel + cd "$M0_SRC_DIR"/utils/spiel cat $PYTHON_STUFF | xargs rm -rf rm -rf build/ $PYTHON_STUFF cd - @@ -166,8 +166,8 @@ EOF spiel_sns_repair_abort() { -echo $M0_SRC_DIR/utils/spiel/m0spiel $SPIEL_OPTS - $M0_SRC_DIR/utils/spiel/m0spiel $SPIEL_OPTS < Date: Wed, 24 Aug 2022 13:25:01 +0530 Subject: [PATCH 22/32] CORTX-30751: Codacy code cleanup (#1606) (#1896) This patch fixes some of the codacy warnings. warning fixed : "Double quote to prevent globing and words splitting". Signed-off-by: alfhad Signed-off-by: Swapnil Chaudhary --- st/stob_domain_recreate_on_corruption.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/st/stob_domain_recreate_on_corruption.sh b/st/stob_domain_recreate_on_corruption.sh index 924b83fdd09..e0e2f91230c 100755 --- a/st/stob_domain_recreate_on_corruption.sh +++ b/st/stob_domain_recreate_on_corruption.sh @@ -34,12 +34,12 @@ MAX_RPC_MSG_SIZE=163840 TM_MIN_RECV_QUEUE_LEN=2 error() { echo "$@" >&2; stop 1; } -say() { echo "$@" | tee -a $SANDBOX_DIR/confd/m0d.log; } +say() { echo "$@" | tee -a "$SANDBOX_DIR"/confd/m0d.log; } -M0_SRC_DIR=`readlink -f $0` +M0_SRC_DIR=$(readlink -f "$0") M0_SRC_DIR=${M0_SRC_DIR%/*/*} -. $M0_SRC_DIR/utils/functions # die, sandbox_init, report_and_exit +. "$M0_SRC_DIR"/utils/functions # die, sandbox_init, report_and_exit ## Path to the file with configuration string for confd. CONF_FILE=$SANDBOX_DIR/confd/conf.txt @@ -51,7 +51,7 @@ XPRT=$(m0_default_xprt) start() { sandbox_init _init - stub_confdb | $M0_SRC_DIR/utils/m0confgen >$CONF_FILE + stub_confdb | "$M0_SRC_DIR"/utils/m0confgen >"$CONF_FILE" } stop() { @@ -59,10 +59,10 @@ stop() { trap - EXIT _fini - if [ $rc -eq 0 ]; then + if [ "$rc" -eq 0 ]; then sandbox_fini else - report_and_exit stob-domain-recreate-on-corruption $rc + report_and_exit stob-domain-recreate-on-corruption "$rc" fi } @@ -71,7 +71,7 @@ _init() { if [[ "$(check_and_restart_lnet)" == "true" ]]; then m0_modules_insert fi - mkdir -p $SANDBOX_DIR/confd + mkdir -p "$SANDBOX_DIR"/confd } _fini() { @@ -122,8 +122,8 @@ _mkfs() { -m $MAX_RPC_MSG_SIZE -q $TM_MIN_RECV_QUEUE_LEN -c $CONF_FILE\ -w 3 -f $fid" - echo $M0_SRC_DIR/utils/mkfs/m0mkfs $OPTS - $M0_SRC_DIR/utils/mkfs/m0mkfs $OPTS >>$path/mkfs.log || + echo "$M0_SRC_DIR"/utils/mkfs/m0mkfs $OPTS + "$M0_SRC_DIR"/utils/mkfs/m0mkfs $OPTS >>"$path"/mkfs.log || error 'm0mkfs failed' } @@ -133,7 +133,7 @@ trap stop EXIT echo "Prepare" start -cd $SANDBOX_DIR +cd "$SANDBOX_DIR" say "mkfs" _mkfs say "mkfs (truncate stobs id file)" From 6f142a21fd390958c9889fac3c3359489278b3e5 Mon Sep 17 00:00:00 2001 From: rahul kumar <66949386+rahul27kumar@users.noreply.github.com> Date: Wed, 24 Aug 2022 21:12:56 +0530 Subject: [PATCH 23/32] CORTX-32172: Fixes ADDB client logs to bundled it in rgw support bundle (#2059) Problem: The addb client logs in rgw container is generating in wrong directory (rgw_debug). This "rgw_debug" directories meant for rgw crash files only. Our expectation, addb client logs should be resides in "addb_files-0x7200000000000001:0x13" directory. Solution: It's required to set an environment for M0_CLIENT_ADDB_DIR on cortx-rgw-integration repository in src/rgw/setup/rgw.py at config stage. In cortx-motr, client_init.c will make use of M0_CLIENT_ADDB_DIR environment variable to store addb client log. Signed-off-by: Rahul Kumar Signed-off-by: Swapnil Chaudhary --- motr/client_init.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/motr/client_init.c b/motr/client_init.c index 8a1e5044b18..851244491fd 100644 --- a/motr/client_init.c +++ b/motr/client_init.c @@ -27,6 +27,7 @@ #include "lib/arith.h" /* M0_CNT_INC */ #include "lib/mutex.h" /* m0_mutex_lock */ #include "lib/time.h" /* m0_nanosleep */ +#include "lib/string.h" /* getenv() */ #include "addb2/global.h" #include "addb2/sys.h" #include "fid/fid.h" /* m0_fid */ @@ -1528,7 +1529,6 @@ M0_INTERNAL int m0_client_global_init(void) } #define NOT_EMPTY(x) (x != NULL && *x != '\0') - static struct m0 m0_client_motr_instance; int m0_client_init(struct m0_client **m0c_p, struct m0_config *conf, bool init_m0) @@ -1678,16 +1678,37 @@ int m0_client_init(struct m0_client **m0c_p, } if (conf->mc_is_addb_init) { - char buf[64]; + char buf[256]; + /* uint64 max character size */ + enum { MAX_PID_IN_CHAR_SIZE = 20 }; + const char *addb_stob_location = NULL; /* Default client addb record file size set to 128M */ m0_bcount_t size = DEFAULT_CLIENT_ADDB2_RECORD_SIZE; + if (conf->mc_addb_size != 0) { if (conf->mc_addb_size > MAX_ADDB2_RECORD_SIZE) M0_LOG(M0_WARN, "ADDB size is more than recommended"); size = conf->mc_addb_size; M0_LOG(M0_DEBUG, "ADDB size = %" PRIu64 "", size); } - sprintf(buf, "linuxstob:./addb_%d", (int)m0_pid()); +#ifndef __KERNEL__ + addb_stob_location = getenv("M0_CLIENT_ADDB_DIR"); +#endif + /* checking for buf size overflow */ + if (addb_stob_location != NULL && sizeof(&addb_stob_location) >= + sizeof(buf) - (sizeof("linuxstob:/addb_") + + MAX_PID_IN_CHAR_SIZE)) + { + M0_LOG(M0_WARN, "ADDB location is more than defined " + "size .. ignoring it."); + addb_stob_location = NULL; + } + if (addb_stob_location == NULL) + addb_stob_location = "."; + + snprintf(buf, 255, "linuxstob:%s/addb_%d", + addb_stob_location, (int)m0_pid()); + M0_LOG(M0_DEBUG, "addb_files directory=%s\n", addb_stob_location); M0_LOG(M0_DEBUG, "addb size=%llu\n", (unsigned long long)size); rc = m0_reqh_addb2_init(&m0c->m0c_reqh, buf, 0xaddbf11e, true, true, size); From 1597391c7f76292e36be5c77c86fe24ef4ab39c5 Mon Sep 17 00:00:00 2001 From: Rajat Patil Date: Thu, 25 Aug 2022 19:29:05 +0530 Subject: [PATCH 24/32] CORTX-33972: DI ST and UT fix (#2100) Problem: 43motr-sync-replication ST fails. be-ut failure in emap and io-nw-xfer-ut failure in target_ioreq_seg_add fails. Solution: 43motr-sync-replication fixed for N < K by shifting goff by (K-N)*offset. be-ut failure in emap is fixed by changing EXTMAP_UT_UNIT_SIZE to 16 from 10 as it should be in range of power 2. io-nw-xfer-ut is fixed by allocating ti_goff_ivec. Signed-off-by: Rajat Patil Co-authored-by: Vidyadhar Pinglikar Signed-off-by: Swapnil Chaudhary --- be/ut/extmap.c | 14 +++--- motr/io_nw_xfer.c | 56 +++++++++++++++++------ motr/st/utils/motr_sync_replication_st.sh | 5 +- motr/ut/io_nw_xfer.c | 3 ++ 4 files changed, 54 insertions(+), 24 deletions(-) diff --git a/be/ut/extmap.c b/be/ut/extmap.c index 5f395c0a5e2..6bc855279db 100644 --- a/be/ut/extmap.c +++ b/be/ut/extmap.c @@ -33,7 +33,7 @@ #include "be/ut/helper.h" #include "be/extmap.h" -#define EXTMAP_UT_UNIT_SIZE 10 +#define EXTMAP_UT_UNIT_SIZE 16 #define EXTMAP_UT_CS_SIZE 16 static struct m0_be_ut_backend be_ut_emap_backend; @@ -550,8 +550,8 @@ static void test_paste_checksum_validation(void) M0_UT_ASSERT(seg->ee_ext.e_end == M0_BINDEX_MAX + 1); idx = 0; - e.e_start = 50; - e.e_end = 100; + e.e_start = m0_round_up(50, EXTMAP_UT_UNIT_SIZE); + e.e_end = m0_round_up(100, EXTMAP_UT_UNIT_SIZE); es[idx] = e_temp[idx] = e; e_val[idx] = 12; @@ -601,8 +601,8 @@ static void test_paste_checksum_validation(void) * New segment paste operation 1 */ idx = 1; - e.e_start = 100; - e.e_end = 150; + e.e_start = m0_round_up(100, EXTMAP_UT_UNIT_SIZE); + e.e_end = m0_round_up(150, EXTMAP_UT_UNIT_SIZE); es[idx] = e_temp[idx] = e; e_val[idx] = 11; @@ -660,8 +660,8 @@ static void test_paste_checksum_validation(void) * New segment overwrite paste operation */ idx = 2; - e.e_start = 80; - e.e_end = 130; + e.e_start = m0_round_up(80, EXTMAP_UT_UNIT_SIZE); + e.e_end = m0_round_up(130, EXTMAP_UT_UNIT_SIZE); es[idx] = e_temp[idx] = e; e_val[idx] = 13; diff --git a/motr/io_nw_xfer.c b/motr/io_nw_xfer.c index 928b13911a2..b26e628c4e7 100644 --- a/motr/io_nw_xfer.c +++ b/motr/io_nw_xfer.c @@ -528,15 +528,29 @@ static void target_ioreq_seg_add(struct target_ioreq *ti, /* For checksum of Parity Unit the global object offset will be * assumed to be aligned with PG start offset, so removing the - * additional value NxUS w.r.t PG start, which is added by the + * additional value NxUS w.r.t PG start, which is added by the * nw_xfer_io_distribute() function. src.sa_unit = layout_n(play) + unit - * Removing this offset N will help to compute PG unit idx as 0,1..,k-1 + * Removing this offset N will help to compute PG unit idx as 0,1..,k-1 * which is the index of pi_paritybufs - */ - goff_cksum = unit_type == M0_PUT_DATA ? gob_offset : + */ + goff_cksum = unit_type == M0_PUT_DATA ? gob_offset : (gob_offset + (src->sa_unit - layout_n(play)) * layout_unit_size(play)); - + + /** + * There are scenarios where K > N in such case when the + * unit type is M0_PUT_PARITY, adding [(K-N) x gob offset] into + * global object offset so that right PG and Unit index will get + * computed. + */ + if ((unit_type == M0_PUT_PARITY) && + (layout_k(play) > layout_n(play))) { + m0_bcount_t goff_delta = (layout_k(play) - + layout_n(play)) * + gob_offset; + goff_cksum += goff_delta; + } + M0_LOG(M0_DEBUG, "[gpos %" PRIu64 ", count %" PRIu64 "] [%" PRIu64 ", %" PRIu64 "]" "->[%" PRIu64 ",%" PRIu64 "] %c", gob_offset, count, src->sa_group, @@ -642,7 +656,7 @@ static void target_ioreq_seg_add(struct target_ioreq *ti, * goff_ivec according to target offset. This creates a * mapping between target offset and cheksum offset. * - * This mapping will be used to compute PG Index and + * This mapping will be used to compute PG Index and * Unit Index for each target when FOP is being prepared. */ INDEX(goff_ivec, seg) = goff_cksum; @@ -900,7 +914,7 @@ static int target_ioreq_prepare_checksum(struct m0_op_io *ioo, /* Number of units will not be zero as its already checked */ num_units = irfop->irf_cksum_data.cd_num_units; - + /** * Note: No need to free this as RPC layer will free this * Allocate cksum buffer for number of units added to target_ioreq ti @@ -963,6 +977,8 @@ static void target_ioreq_calc_idx(struct m0_op_io *ioo, struct fop_cksum_data *fop_cs_data = &irfop->irf_cksum_data; uint32_t seg; m0_bindex_t goff; + struct m0_pdclust_layout *play = pdlayout_get(ioo); + m0_bcount_t grp0_idx; /** * Loop through all the segments added and check & add @@ -975,10 +991,24 @@ static void target_ioreq_calc_idx(struct m0_op_io *ioo, &fop_cs_data->cd_idx[fop_cs_data->cd_num_units]; M0_ASSERT(cs_idx->ci_pg_idx == UINT32_MAX && cs_idx->ci_unit_idx == UINT32_MAX); + grp0_idx = pgdata->fg_pgrp0_index; + /** + * There are scenarios where K > N in such case when the + * unit type is parity, shifting grp0 index by + * [(K-N) x pgrp0] for parity so that right PG and Unit + * index will get computed. + */ + if((irfop->irf_pattr == PA_PARITY) && + (layout_k(play) > layout_n(play))) { + grp0_idx += (layout_k(play) - + layout_n(play)) * + pgdata->fg_pgrp0_index; + } + /* Compute PG Index & remaining exta wrt PG boundary */ - cs_idx->ci_pg_idx = (goff - pgdata->fg_pgrp0_index) / + cs_idx->ci_pg_idx = (goff - grp0_idx) / pgdata->fg_pgrp_sz; - rem_pg_sz = (goff - pgdata->fg_pgrp0_index) % + rem_pg_sz = (goff - grp0_idx) % pgdata->fg_pgrp_sz; cs_idx->ci_unit_idx = rem_pg_sz/pgdata->fg_unit_sz; fop_cs_data->cd_num_units++; @@ -1094,13 +1124,13 @@ static int target_ioreq_iofops_prepare(struct target_ioreq *ti, ndom_max_segs = m0_net_domain_get_max_buffer_segments(ndom); - di_enabled = m0__obj_is_di_enabled(ioo) && + di_enabled = m0__obj_is_di_enabled(ioo) && ti->ti_goff_ivec.iv_vec.v_nr; if (di_enabled) { struct m0_pdclust_layout *play = pdlayout_get(ioo); - - /* Init object global offset currsor for a given target */ + + /* Init object global offset currsor for a given target */ m0_ivec_cursor_init(&goff_curr, &ti->ti_goff_ivec); seg_sz = m0__page_size(ioo); pgdata.fg_seg_sz = m0__page_size(ioo); @@ -1109,7 +1139,7 @@ static int target_ioreq_iofops_prepare(struct target_ioreq *ti, pgdata.fg_unit_sz = layout_unit_size(pdlayout_get(ioo)); /** - * There are scenarios where K > N in such case when the + * There are scenarios where K > N in such case when the * filter is PA_PARITY, increase the size of PG so that * right PG and Unit index will get computed based on goff */ diff --git a/motr/st/utils/motr_sync_replication_st.sh b/motr/st/utils/motr_sync_replication_st.sh index 103253c0f5b..0aaafd1f3e7 100755 --- a/motr/st/utils/motr_sync_replication_st.sh +++ b/motr/st/utils/motr_sync_replication_st.sh @@ -34,10 +34,7 @@ m0t1fs_dir="$motr_st_util_dir/../../../m0t1fs/linux_kernel/st" . $motr_st_util_dir/motr_local_conf.sh . $motr_st_util_dir/motr_st_inc.sh -# TODO : N will be reverted to 1 after addressing the code fix in DI checksum -# computation in read path, for the specific case of N=1, K=2, 2 disc failure -# degraded read. -N=2 +N=1 K=2 S=2 P=15 diff --git a/motr/ut/io_nw_xfer.c b/motr/ut/io_nw_xfer.c index 15fe1250682..154e05e0980 100644 --- a/motr/ut/io_nw_xfer.c +++ b/motr/ut/io_nw_xfer.c @@ -272,6 +272,8 @@ static void ut_test_target_ioreq_seg_add(void) m0_bufvec_alloc(&ti->ti_auxbufvec, 1, unit_size); M0_SET0(&ioo->ioo_attr); M0_ALLOC_ARR(ti->ti_pageattrs, 1); + m0_indexvec_alloc(&ti->ti_goff_ivec, 1); + ti->ti_goff_ivec.iv_vec.v_nr = 0; target_ioreq_seg_add(ti, src, tgt, 111, 1, map); M0_UT_ASSERT(ti->ti_ivec.iv_vec.v_nr == 1); @@ -287,6 +289,7 @@ static void ut_test_target_ioreq_seg_add(void) m0_bufvec_free(&ti->ti_bufvec); m0_bufvec_free(&ti->ti_auxbufvec); m0_indexvec_free(&ti->ti_ivec); + m0_indexvec_free(&ti->ti_goff_ivec); ut_dummy_pargrp_iomap_delete(map, instance); m0_free(tgt); From d35cdad7743594e29d05f3185f432ead90ad9dfd Mon Sep 17 00:00:00 2001 From: Rinku Kothiya Date: Thu, 25 Aug 2022 19:32:15 +0530 Subject: [PATCH 25/32] CORTX-33964: Improvement in code coverage job (#2099) Problem: With the previous job if one of the test failed then rest of the jobs were not executed. Solution: Running tests individually instead of a group. Ignoring any failures that occur. Signed-off-by: Rinku Kothiya Signed-off-by: Swapnil Chaudhary --- scripts/jenkins/code-coverage.groovy | 77 ++++++++++++++++------------ 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/scripts/jenkins/code-coverage.groovy b/scripts/jenkins/code-coverage.groovy index 80cdd374bd2..56d1ef7e631 100644 --- a/scripts/jenkins/code-coverage.groovy +++ b/scripts/jenkins/code-coverage.groovy @@ -1,13 +1,10 @@ -pipeline { +pipeline { agent { - label "jenkins-client-for-cortx-motr" + label "code-coverage" } parameters { - string(name: 'NODE_HOST', defaultValue: '', description: 'Node 1 Host FQDN', trim: true) - string(name: 'NODE_USER', defaultValue: '', description: 'Host machine root user', trim: true) - string(name: 'NODE_PASS', defaultValue: '', description: 'Host machine root user password', trim: true) string(name: 'BRANCH', defaultValue: '', description: 'Branch name', trim: true) string(name: 'OPTIONS', defaultValue: '', description: 'Build options', trim: true) booleanParam(name: 'UT', defaultValue: true, description: 'Run UT') @@ -17,58 +14,72 @@ pipeline { options { timeout(time: 180, unit: 'MINUTES') timestamps() - ansiColor('xterm') + ansiColor('xterm') buildDiscarder(logRotator(numToKeepStr: "30")) } environment { - NODE_PASS = "${NODE_PASS.isEmpty() ? NODE_DEFAULT_SSH_CRED_PSW : NODE_PASS}" + TestList = "/tmp/list-of-unit-tests.txt" } stages { - stage('Checkout') { - steps { - checkout([$class: 'GitSCM', branches: [[name: "main"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'PathRestriction', excludedRegions: '', includedRegions: 'scripts/third-party-rpm/.*']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'cortx-admin-github', url: "https://github.com/Seagate/cortx-motr"]]]) - } - } stage ('Compile, execute test and report code coverage') { steps { script { build_stage = env.STAGE_NAME } - sh label: 'Clean up and build motr and run ut for code coverage', script: ''' - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} hostname - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "yum install -y httpd lcov" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "systemctl start httpd.service" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "rm -rf /root/cortx-motr" + sh label: 'Clean up, build motr, run ut/st and generate code coverage report', script: ''' + hostname + pwd + yum install -y httpd lcov + systemctl start httpd.service + make uninstall || true + make clean || true + rm -rf cortx-motr OLD_BUILD_NUMBER=$(echo "$BUILD_NUMBER - 10" | bc) echo "Old build number is : $OLD_BUILD_NUMBER" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "rm -rf /var/www/html/$OLD_BUILD_NUMBER || true" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "cd /root/ ; git clone --recursive -b ${BRANCH} https://github.com/Seagate/cortx-motr" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "cd /root/cortx-motr ; sudo ./scripts/install-build-deps" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "cd /root/cortx-motr ; ./autogen.sh" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "cd /root/cortx-motr ; ./configure --enable-coverage --enable-debug ${OPTIONS}" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "cd /root/cortx-motr ; make -j6" + rm -rf /var/www/html/$OLD_BUILD_NUMBER || true + git clone --recursive -b ${BRANCH} https://github.com/Seagate/cortx-motr cortx-motr + cd cortx-motr + sudo ./scripts/install-build-deps + ./autogen.sh + ./configure --enable-coverage --enable-debug ${OPTIONS} + make -j6 if [ ${UT} == true ] then - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "cd /root/cortx-motr ; sudo ./scripts/m0 run-ut" + ./scripts/m0 run-ut -l > "$TestList" + set +o errexit + while read Test + do + echo "Executing: $Test" + timeout --preserve-status -k 600s 600s ./scripts/m0 run-ut -t $Test + echo "Test $Test Executed and exited with return code $?" + done < "$TestList" fi if [ ${ST} == true ] then - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "cd /root/cortx-motr ; sudo ./scripts/m0 run-st" + ./scripts/m0 run-ut -l > "$TestList" + set +o errexit + while read Test + do + echo "Executing: $Test" + timeout --preserve-status -k 600s 600s ./scripts/m0 run-st -t $Test + echo "Test $Test Executed and exited with return code $?" + done < "$TestList" fi - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "cd /root/cortx-motr ; ./scripts/coverage/gcov-gen-html user ./ ./" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "mkdir -p /var/www/html/$BUILD_NUMBER" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "cp -r /root/cortx-motr/* /var/www/html/$BUILD_NUMBER/" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "systemctl start firewalld.service" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "firewall-cmd --permanent --add-port=80/tcp" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "firewall-cmd --permanent --add-port=443/tcp" - sshpass -p ${NODE_PASS} ssh -o StrictHostKeyChecking=no ${NODE_USER}@${NODE_HOST} "firewall-cmd --reload" - echo "http://${NODE_HOST}/${BUILD_NUMBER}/" + ./scripts/coverage/gcov-gen-html user ./ ./ + mkdir -p /var/www/html/$BUILD_NUMBER + cp -r * /var/www/html/$BUILD_NUMBER/ + systemctl start firewalld.service + firewall-cmd --permanent --add-port=80/tcp + firewall-cmd --permanent --add-port=443/tcp + firewall-cmd --reload + echo "http://$(hostname)/${BUILD_NUMBER}/" ''' } } } } + From acaee6c5a0d103be627912a79a4aa2854d935567 Mon Sep 17 00:00:00 2001 From: Mehul Joshi Date: Fri, 26 Aug 2022 14:00:08 +0530 Subject: [PATCH 26/32] CORTX-34068: Fix m0_utils_common to point to correct path of m0hagen (#2105) Signed-off-by: Mehul Joshi Signed-off-by: Swapnil Chaudhary --- .../install/opt/seagate/cortx/motr/common/m0_utils_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install/opt/seagate/cortx/motr/common/m0_utils_common.sh b/scripts/install/opt/seagate/cortx/motr/common/m0_utils_common.sh index 903ebe520d5..2bcc7b45a7b 100755 --- a/scripts/install/opt/seagate/cortx/motr/common/m0_utils_common.sh +++ b/scripts/install/opt/seagate/cortx/motr/common/m0_utils_common.sh @@ -28,7 +28,7 @@ XPRT="" M0_REPAIR_UTILS=/usr/sbin/m0repair M0_HAM_UTILS=/usr/sbin/m0ham -M0_HAGEN_UTILS=/usr/sbin/m0hagen +M0_HAGEN_UTILS=/usr/bin/m0hagen MOTR_COPY=/usr/bin/m0cp MOTR_CAT=/usr/bin/m0cat From 3437ac7c3867909e294f3b690b5ae64998fae637 Mon Sep 17 00:00:00 2001 From: Swapnil Chaudhary Date: Fri, 26 Aug 2022 03:22:43 -0600 Subject: [PATCH 27/32] CORTX-33743_FIX_MEMORY_LEAK Pulled latest code and addressed review comments. Signed-off-by: Swapnil Chaudhary --- ha/entrypoint.c | 3 ++- motr/setup.c | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ha/entrypoint.c b/ha/entrypoint.c index 09095f488af..50c6d4bc5e4 100644 --- a/ha/entrypoint.c +++ b/ha/entrypoint.c @@ -600,7 +600,8 @@ static int ha_entrypoint_client_fom_tick(struct m0_fom *fom) fop->f_opaque = ecl; next_state = M0_HEC_SEND_WAIT; rc = m0_rpc_post(item) == 0 ? M0_FSO_WAIT : M0_FSO_AGAIN; - m0_free(req_fop_data->erf_git_rev_id.b_addr); + //m0_free(req_fop_data->erf_git_rev_id.b_addr); + m0_buf_free(&req_fop_data->erf_git_rev_id); break; case M0_HEC_SEND_WAIT: diff --git a/motr/setup.c b/motr/setup.c index 8014f428ed2..7a1b6df85f6 100644 --- a/motr/setup.c +++ b/motr/setup.c @@ -458,6 +458,7 @@ static void cs_reqh_ctx_fini(struct m0_reqh_context *rctx) m0_free(rctx->rc_services[i]); m0_free(rctx->rc_services); m0_free(rctx->rc_service_fids); + m0_free((char*)rctx->rc_addb_stlocation); rctx->rc_stob.s_sfile.sf_is_initialised = false; rctx->rc_stob.s_ad_disks_init = false; } @@ -1099,10 +1100,10 @@ static int cs_storage_init(const char *stob_type, /** Finalises storage for a request handler in a motr context. */ -static void cs_storage_fini(struct m0_reqh_context *rctx) +static void cs_storage_fini(struct cs_stobs *stob) { - struct cs_stobs *stob = &rctx->rc_stob; - m0_free((char*)rctx->rc_addb_stlocation); + //struct cs_stobs *stob = &rctx->rc_stob; + //m0_free((char*)rctx->rc_addb_stlocation); cs_storage_devs_fini(); if (stob->s_sdom != NULL) m0_stob_domain_fini(stob->s_sdom); @@ -1689,7 +1690,7 @@ static int cs_storage_setup(struct m0_motr *cctx) cleanup_addb2: m0_reqh_addb2_fini(&rctx->rc_reqh); cleanup_stob: - cs_storage_fini(rctx); + cs_storage_fini(&rctx->rc_stob); reqh_be_fini: m0_reqh_be_fini(&rctx->rc_reqh); be_fini: @@ -2876,7 +2877,7 @@ static void cs_level_leave(struct m0_module *module) break; case CS_LEVEL_STORAGE_SETUP: if (rctx->rc_state == RC_INITIALISED) { - cs_storage_fini(rctx); + cs_storage_fini(&rctx->rc_stob); rctx->rc_reqh.rh_pools = NULL; } break; From 4fbf4e9601427db83a0591773281dcffd7862f0c Mon Sep 17 00:00:00 2001 From: Swapnil Chaudhary Date: Sun, 28 Aug 2022 23:33:13 -0600 Subject: [PATCH 28/32] Patch for testing the code Signed-off-by: Swapnil Chaudhary --- motr/m0d.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/motr/m0d.c b/motr/m0d.c index 47bbb9de2d9..eb1ad257b26 100644 --- a/motr/m0d.c +++ b/motr/m0d.c @@ -123,7 +123,7 @@ M0_INTERNAL int main(int argc, char **argv) int result; int rc; struct m0_motr motr_ctx; - struct rlimit rlim = {10240, 10240}; + //struct rlimit rlim = {10240, 10240}; if (argc > 1 && (strcmp(argv[1], "-v") == 0 || strcmp(argv[1], "--version") == 0)) { @@ -149,11 +149,11 @@ M0_INTERNAL int main(int argc, char **argv) } } - rc = setrlimit(RLIMIT_NOFILE, &rlim); - if (rc != 0) { - warnx("\n Failed to setrlimit\n"); - goto out; - } + //rc = setrlimit(RLIMIT_NOFILE, &rlim); + //if (rc != 0) { + // warnx("\n Failed to setrlimit\n"); + // goto out; + //} rc = cs_register_signal(); if (rc != 0) { From c12e226b6e3f71627f8cb2fe0417e628ebfa520a Mon Sep 17 00:00:00 2001 From: Swapnil Chaudhary Date: Tue, 30 Aug 2022 00:30:47 -0600 Subject: [PATCH 29/32] Addressed review comments Signed-off-by: Swapnil Chaudhary --- ha/entrypoint.c | 3 ++- motr/setup.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ha/entrypoint.c b/ha/entrypoint.c index 50c6d4bc5e4..326ec78453c 100644 --- a/ha/entrypoint.c +++ b/ha/entrypoint.c @@ -505,6 +505,7 @@ static void ha_entrypoint_client_fop_release(struct m0_ref *ref) M0_ENTRY(); M0_PRE(ref != NULL); fop = container_of(ref, struct m0_fop, f_ref); + m0_free(fop->f_data.fd_data); fop->f_data.fd_data = NULL; m0_fop_fini(fop); M0_SET0(fop); @@ -601,7 +602,7 @@ static int ha_entrypoint_client_fom_tick(struct m0_fom *fom) next_state = M0_HEC_SEND_WAIT; rc = m0_rpc_post(item) == 0 ? M0_FSO_WAIT : M0_FSO_AGAIN; //m0_free(req_fop_data->erf_git_rev_id.b_addr); - m0_buf_free(&req_fop_data->erf_git_rev_id); + //m0_buf_free(&req_fop_data->erf_git_rev_id); break; case M0_HEC_SEND_WAIT: diff --git a/motr/setup.c b/motr/setup.c index 7a1b6df85f6..9584378cc11 100644 --- a/motr/setup.c +++ b/motr/setup.c @@ -2281,8 +2281,8 @@ static int _args_parse(struct m0_motr *cctx, int argc, char **argv) LAMBDA(void, (const char *s) { char tmp_buf[512]; - sprintf(tmp_buf, "%s-%d", s, (int)m0_pid()); - rctx->rc_addb_stlocation = strdup(tmp_buf); + snprintf(tmp_buf, "%s-%d", s, (int)m0_pid()); + rctx->rc_addb_stlocation = m0_strdup(tmp_buf); })), M0_STRINGARG('d', "Device configuration file", LAMBDA(void, (const char *s) From 0cd4f6d527dee806b24266a8eade78452c0803a2 Mon Sep 17 00:00:00 2001 From: Swapnil Chaudhary Date: Tue, 30 Aug 2022 01:29:49 -0600 Subject: [PATCH 30/32] Addressed review comments and testing the patch Signed-off-by: Swapnil Chaudhary --- motr/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/motr/setup.c b/motr/setup.c index 9584378cc11..9009eea1ed1 100644 --- a/motr/setup.c +++ b/motr/setup.c @@ -2281,7 +2281,7 @@ static int _args_parse(struct m0_motr *cctx, int argc, char **argv) LAMBDA(void, (const char *s) { char tmp_buf[512]; - snprintf(tmp_buf, "%s-%d", s, (int)m0_pid()); + snprintf(tmp_buf,sizeof(tmp_buf) ,"%s-%d", s, (int)m0_pid()); rctx->rc_addb_stlocation = m0_strdup(tmp_buf); })), M0_STRINGARG('d', "Device configuration file", From 5ab2d68d277bee0733eca0f39cb4dd5041a0db5c Mon Sep 17 00:00:00 2001 From: Swapnil Chaudhary Date: Tue, 30 Aug 2022 12:11:08 -0600 Subject: [PATCH 31/32] Addressed review comments and updatedthe code with required changes. Signed-off-by: Swapnil Chaudhary --- ha/entrypoint.c | 7 +++---- motr/m0d.c | 12 ++++++------ motr/setup.c | 2 -- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/ha/entrypoint.c b/ha/entrypoint.c index 326ec78453c..e053e60e772 100644 --- a/ha/entrypoint.c +++ b/ha/entrypoint.c @@ -501,11 +501,12 @@ static struct m0_rpc_item_ops ha_entrypoint_client_item_ops = { static void ha_entrypoint_client_fop_release(struct m0_ref *ref) { struct m0_fop *fop; - + struct m0_ha_entrypoint_req_fop *req_fop_data; M0_ENTRY(); M0_PRE(ref != NULL); fop = container_of(ref, struct m0_fop, f_ref); - m0_free(fop->f_data.fd_data); + req_fop_data = (struct m0_ha_entrypoint_req_fop*)fop->f_data.fd_data; + m0_buf_free(&req_fop_data->erf_git_rev_id); fop->f_data.fd_data = NULL; m0_fop_fini(fop); M0_SET0(fop); @@ -601,8 +602,6 @@ static int ha_entrypoint_client_fom_tick(struct m0_fom *fom) fop->f_opaque = ecl; next_state = M0_HEC_SEND_WAIT; rc = m0_rpc_post(item) == 0 ? M0_FSO_WAIT : M0_FSO_AGAIN; - //m0_free(req_fop_data->erf_git_rev_id.b_addr); - //m0_buf_free(&req_fop_data->erf_git_rev_id); break; case M0_HEC_SEND_WAIT: diff --git a/motr/m0d.c b/motr/m0d.c index eb1ad257b26..47bbb9de2d9 100644 --- a/motr/m0d.c +++ b/motr/m0d.c @@ -123,7 +123,7 @@ M0_INTERNAL int main(int argc, char **argv) int result; int rc; struct m0_motr motr_ctx; - //struct rlimit rlim = {10240, 10240}; + struct rlimit rlim = {10240, 10240}; if (argc > 1 && (strcmp(argv[1], "-v") == 0 || strcmp(argv[1], "--version") == 0)) { @@ -149,11 +149,11 @@ M0_INTERNAL int main(int argc, char **argv) } } - //rc = setrlimit(RLIMIT_NOFILE, &rlim); - //if (rc != 0) { - // warnx("\n Failed to setrlimit\n"); - // goto out; - //} + rc = setrlimit(RLIMIT_NOFILE, &rlim); + if (rc != 0) { + warnx("\n Failed to setrlimit\n"); + goto out; + } rc = cs_register_signal(); if (rc != 0) { diff --git a/motr/setup.c b/motr/setup.c index 9009eea1ed1..ca9ede451af 100644 --- a/motr/setup.c +++ b/motr/setup.c @@ -1102,8 +1102,6 @@ static int cs_storage_init(const char *stob_type, */ static void cs_storage_fini(struct cs_stobs *stob) { - //struct cs_stobs *stob = &rctx->rc_stob; - //m0_free((char*)rctx->rc_addb_stlocation); cs_storage_devs_fini(); if (stob->s_sdom != NULL) m0_stob_domain_fini(stob->s_sdom); From 2f13b69edfa3e3da3535bae302bacfa2978cb468 Mon Sep 17 00:00:00 2001 From: Swapnil Chaudhary Date: Tue, 30 Aug 2022 23:00:47 -0600 Subject: [PATCH 32/32] Addressed review comments --- motr/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/motr/setup.c b/motr/setup.c index 6274f458212..f799259f67b 100644 --- a/motr/setup.c +++ b/motr/setup.c @@ -2292,7 +2292,7 @@ static int _args_parse(struct m0_motr *cctx, int argc, char **argv) LAMBDA(void, (const char *s) { char tmp_buf[512]; - snprintf(tmp_buf,sizeof(tmp_buf) ,"%s-%d", s, (int)m0_pid()); + snprintf(tmp_buf, sizeof(tmp_buf), "%s-%d", s, (int)m0_pid()); rctx->rc_addb_stlocation = m0_strdup(tmp_buf); })), M0_STRINGARG('d', "Device configuration file",