From patchwork Mon Dec 19 10:21:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blazej Kucman X-Patchwork-Id: 13076443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DB1EC10F1B for ; Mon, 19 Dec 2022 10:22:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231734AbiLSKWH (ORCPT ); Mon, 19 Dec 2022 05:22:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231733AbiLSKWF (ORCPT ); Mon, 19 Dec 2022 05:22:05 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7E582DF6 for ; Mon, 19 Dec 2022 02:22:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671445324; x=1702981324; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EUGSsdRkiB7qeapSnsIN0KkDMa/R+Sb5sDzxDQB2lQg=; b=PW3xoo8MQrXuUhu1oBfXjyGQY1ukKEdZVZukdabuBRdfLy+mb5cooEJl VdvP8uKWwPb/xFCJZHKMrEq66+g5V0pYkNJf9jhvF83+nFwIguFP7Drze FRNyZJUCHUJRDFMAtj1b+iiO+aY2fPW0vnyfbFGgwHSh5AFSRTMOdd1Do ymxCkQUTQTZdrX0MQ8a6cQkNhYaj6tGkfMlLiSDkfBGCr2I6pExNPPb5J beeRzJ6IbAECMobtY3xK2oUqdCFwqlgFD/Uifp+AC5uN8ZUgXDYpDzaKG 11rrx7DxfW50FN9vOEYwG3vax25egCORkNc39XQ8R+DAcubkuDqF0+e4D Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10565"; a="319364342" X-IronPort-AV: E=Sophos;i="5.96,255,1665471600"; d="scan'208";a="319364342" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2022 02:22:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10565"; a="824805170" X-IronPort-AV: E=Sophos;i="5.96,255,1665471600"; d="scan'208";a="824805170" Received: from linux-myjy.igk.intel.com ([10.102.108.92]) by orsmga005.jf.intel.com with ESMTP; 19 Dec 2022 02:22:03 -0800 From: Blazej Kucman To: linux-raid@vger.kernel.org Cc: jes@trained-monkey.org, colyli@suse.de Subject: [PATCH V2 1/2] Monitor: block if monitor modes are combined. Date: Mon, 19 Dec 2022 11:21:57 +0100 Message-Id: <20221219102158.10180-2-blazej.kucman@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221219102158.10180-1-blazej.kucman@intel.com> References: <20221219102158.10180-1-blazej.kucman@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org Block monitoring start if --scan mode and MD devices list are combined. Signed-off-by: Blazej Kucman --- Monitor.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Monitor.c b/Monitor.c index 7d7dc4d2..119e17d8 100644 --- a/Monitor.c +++ b/Monitor.c @@ -123,7 +123,7 @@ int Monitor(struct mddev_dev *devlist, * and if we can get_disk_info and find a name * Then we hot-remove and hot-add to the other array * - * If devlist is NULL, then we can monitor everything because --scan + * If devlist is NULL, then we can monitor everything if --scan * was given. We get an initial list from config file and add anything * that appears in /proc/mdstat */ @@ -136,6 +136,11 @@ int Monitor(struct mddev_dev *devlist, struct mddev_ident *mdlist; int delay_for_event = c->delay; + if (devlist && c->scan) { + pr_err("Devices list and --scan option cannot be combined - not monitoring.\n"); + return 1; + } + if (!mailaddr) mailaddr = conf_get_mailaddr(); From patchwork Mon Dec 19 10:21:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blazej Kucman X-Patchwork-Id: 13076444 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBDD8C4167B for ; Mon, 19 Dec 2022 10:22:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231733AbiLSKWN (ORCPT ); Mon, 19 Dec 2022 05:22:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231735AbiLSKWH (ORCPT ); Mon, 19 Dec 2022 05:22:07 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 629172BFF for ; Mon, 19 Dec 2022 02:22:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671445327; x=1702981327; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ENE+EyUOhHi5cbzLGa+Jl/AoGto3XvlaLLRyB3CP5ZQ=; b=nKtb7m0FipEvn/FsVEFgCMVPqY3htloPGZhNxPqqsVwz+eq2LMqVTnDk jVrH+ijaZrSskB8WsP7uWR1AkZRK/HxPcKEXPO1bzzo45ySvos/PoqkWZ DXHkDrkpA8anrAOgJHi4SL8qHR07GiUoHBNYphglxlxrGVjwt76E4Cljn ilwogZhfcQE5w8Cjbi1GO0eW8x8ctOuJNWjCeTeAJhER9zjykBRNFIGo3 4o7zj+1KDJ4I/YPabEWU1YRItfntw0En7vl6ZUnkJdBFSkhshOikhlfQm 4z9a4sAjFRsgIvWlyFdKYFt/m1nWzvPzKKOKmQKEsUGgwAVaRkw8BOJe5 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10565"; a="319364351" X-IronPort-AV: E=Sophos;i="5.96,255,1665471600"; d="scan'208";a="319364351" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2022 02:22:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10565"; a="824805181" X-IronPort-AV: E=Sophos;i="5.96,255,1665471600"; d="scan'208";a="824805181" Received: from linux-myjy.igk.intel.com ([10.102.108.92]) by orsmga005.jf.intel.com with ESMTP; 19 Dec 2022 02:22:06 -0800 From: Blazej Kucman To: linux-raid@vger.kernel.org Cc: jes@trained-monkey.org, colyli@suse.de Subject: [PATCH V2 2/2] Update mdadm Monitor manual. Date: Mon, 19 Dec 2022 11:21:58 +0100 Message-Id: <20221219102158.10180-3-blazej.kucman@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221219102158.10180-1-blazej.kucman@intel.com> References: <20221219102158.10180-1-blazej.kucman@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org - describe monitor work modes, - clarify the turning off condition, - describe the mdmonitor.service as a prefered management way. Signed-off-by: Blazej Kucman --- mdadm.8.in | 71 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 21 deletions(-) diff --git a/mdadm.8.in b/mdadm.8.in index 70c79d1e..64f71ed1 100644 --- a/mdadm.8.in +++ b/mdadm.8.in @@ -2548,13 +2548,33 @@ Usage: .I options... devices... .PP -This usage causes +Monitor option can work in two modes: +.IP \(bu 4 +system wide mode, follow all md devices based on +.B /proc/mdstat, +.IP \(bu 4 +follow only specified MD devices in command line. +.PP + +.B \-\-scan - +indicates system wide mode. Option causes the +.I monitor +to track all md devices that appear in +.B /proc/mdstat. +If it is not set, then at least one +.B device +must be specified. + +Monitor usage causes .I mdadm to periodically poll a number of md arrays and to report on any events noticed. -.I mdadm -will never exit once it decides that there are arrays to be checked, -so it should normally be run in the background. + +In both modes, +.I monitor +will work as long as there is an active array with redundancy and it is defined to follow (for +.B \-\-scan +every array is followed). As well as reporting events, .I mdadm @@ -2565,15 +2585,6 @@ or .B domain and if the destination array has a failed drive but no spares. -If any devices are listed on the command line, -.I mdadm -will only monitor those devices, otherwise, all arrays listed in the -configuration file will be monitored. Further, if -.B \-\-scan -is given, then any other md devices that appear in -.B /proc/mdstat -will also be monitored. - The result of monitoring the arrays is the generation of events. These events are passed to a separate program (if specified) and may be mailed to a given E-mail address. @@ -2586,16 +2597,34 @@ device if relevant (such as a component device that has failed). If .B \-\-scan -is given, then a program or an E-mail address must be specified on the -command line or in the config file. If neither are available, then +is given, then a +.B program +or an +.B e-mail +address must be specified on the +command line or in the config file. If neither are available, then .I mdadm will not monitor anything. -Without -.B \-\-scan, -.I mdadm -will continue monitoring as long as something was found to monitor. If -no program or email is given, then each event is reported to -.BR stdout . +For devices given directly in command line, without +.B program +or +.B email +specified, each event is reported to +.BR stdout. + +Note: For systems where +.If mdadm monitor +is configured via systemd, +.B mdmonitor(mdmonitor.service) +should be configured. The service is designed to be primary solution for array monitoring, +it is configured to work in system wide mode. +It is automatically started and stopped according to current state and types of MD arrays in system. +The service may require additional configuration, like +.B e-mail +or +.B delay. +That should be done in +.B mdadm.conf. The different events are: