summaryrefslogtreecommitdiffstats
path: root/Makefile (follow)
Commit message (Collapse)AuthorAgeFilesLines
* mdmonitor: Abandon custom configuration filesMariusz Tkaczyk2024-10-101-1/+0
| | | | | | | | | | | | | | | Operating system vendors are customizing mdmonitor service beacause the default form is not satifying for them (expect SUSE). As a result, support is complicated (maintainers have to check the system) and man page is not detailed. I propose to abandon custom configuration files via sysconfig and keep it inside mdadm.conf only. Detailed comment in service for OSV maintainers is added to help with transition. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* super-intel: move scsi_get_serial from sg_ioKinga Stefaniuk2024-10-081-2/+2
| | | | | | | scsi_get_serial() function is used only by super-intel.c. Move function to this file and remove sg_io.c file. Signed-off-by: Kinga Stefaniuk <kinga.stefaniuk@intel.com>
* Rename Monitor.c to mdmonitor.cKinga Stefaniuk2024-10-071-1/+1
| | | | | | | Rename Monitor.c to mdmonitor.c to avoid errors during compilation on case-insensitive filesystems. Signed-off-by: Kinga Stefaniuk <kinga.stefaniuk@intel.com>
* Makefile: add more compiler flagsKinga Stefaniuk2024-07-301-1/+22
| | | | | | | | | | | It is essential to avoid vulnerabilities in code as much as possible using safe compilation flags. It is easier if they are added to the Makefile and applied during compilation. Add new gcc flags and make them configurable, because they may not be supported for some compilers. Set FORTIFY_SOURCE with the highest supported value for platform. Signed-off-by: Kinga Stefaniuk <kinga.stefaniuk@intel.com>
* Makefile: Do not call gcc directlyGwendal Grignou2024-06-181-3/+3
| | | | | | | | | | | | When mdadm is compiled with clang, direct gcc will fail. Make sure to use $(CC) variable instead. Note that Clang does not support --help=warnings, --print-diagnostic-options should be used instead. So with Clang, the compilation will go through, but the extra warning flags will never be added. Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
* Makefile: fix make -s detectionValery Ushakov2024-05-231-1/+1
| | | | | | | | | Only check the first word of MAKEFLAGS for 's', that's where all the single letter options are collected. MAKEFLAGS contains _all_ make flags, so if any command line argument contains a letter 's', the silent test will be false positive. Think e.g. make 'DESTDIR=.../aports/main/mdadm/pkg/mdadm' install
* Makefile: Move -pie to LDFLAGSFabrice Fontaine2024-05-081-2/+2
| | | | | | | | | | Move -pie from LDLIBS to LDFLAGS and make LDFLAGS configurable to allow the user to drop it by setting their own LDFLAGS (e.g. PIE could be enabled or disabled by the buildsystem such as buildroot). Suggested-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Add reading Opal NVMe encryption informationBlazej Kucman2024-04-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | For NVMe devices with Opal support, encryption information, status and ability are determined based on Opal Level 0 discovery response. Technical documentation used is given in the implementation. Ability in general describes what type of encryption is supported, Status describes in what state the disk with encryption support is. The current patch includes only the implementation of reading encryption information, functions will be used in one of the next patches. Motivation for adding this functionality is to block mixing of disks in IMSM arrays with encryption enabled and disabled. The main goal is to not allow stealing data by rebuilding array to not encrypted drive which can be read elsewhere. Value ENA_OTHER from enum encryption_ability will be used in the next patch. Signed-off-by: Blazej Kucman <blazej.kucman@intel.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Mdmonitor: Improve udev event handlingMateusz Grzonka2023-11-211-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | Mdmonitor is waiting for udev queue to become empty. Even if the queue becomes empty, udev might still be processing last event. However we want to wait and wake up mdmonitor when udev finished processing events.. Also, the udev queue interface is considered legacy and should not be used outside of udev. Use udev monitor instead, and wake up mdmonitor on every event triggered by udev for md block device. We need to generate more change events from kernel, because they are missing in some situations, for example, when rebuild started. This will be addressed in a separate patch. Move udev specific code into separate functions, and place them in udev.c file. Also move use_udev() logic from lib.c into newly created file. Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com> Signed-off-by: Kinga Tanska <kinga.tanska@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* Add compiler defenses flagsMateusz Grzonka2023-09-011-12/+29
| | | | | | | | | | | | | | | | | | It is essential to avoid buffer overflows and similar bugs as much as possible. According to Intel rules we are obligated to verify certain compiler flags, so it will be much easier if they are added to the Makefile. Add gcc flags for prevention of buffer overflows, format string vulnerabilities, stack protection to prevent stack overwrites and aslr enablement through -fPIE. Also make the flags configurable. The changes were verified on gcc versions 7.5, 8.3, 9.2, 10 and 12.2. Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* mdmon: fix segfaultMateusz Kusiak2023-01-041-1/+1
| | | | | | | | | | Mdmon crashes if stat2devnm returns null. Use open_mddev to check if device is mddevice and get name using fd2devnm. Refactor container name handling. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* Makefile: Don't build static build with everything and everything-testLogan Gunthorpe2022-08-071-2/+2
| | | | | | | | | | | | | | | | Running the test suite requires building everything, but it seems to be difficult to build the static version of mdadm now seeing there is no readily available static udev library. The test suite doesn't need the static binary so just don't build it with the everything or everything-test targets. Leave the mdadm.static and install-static targets in place in case someone still has a use case for the static binary. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* mdadm: Respect config file location in manLukasz Florczak2022-04-051-1/+6
| | | | | | | | | | | | Default config file location could differ depending on OS (e.g. Debian family). This patch takes default config file into consideration when creating mdadm.man file as well as mdadm.conf.man. Rename mdadm.conf.5 to mdadm.conf.5.in. Now mdadm.conf.5 is generated automatically. Signed-off-by: Lukasz Florczak <lukasz.florczak@linux.intel.com> Acked-by: Coly Li <colyli@suse.de> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor: make libudev dependency optionalMariusz Tkaczyk2021-03-191-1/+6
| | | | | | | | | | | | Make -ludev configurable, enabled by default. To disable it, -DNO_LIBUDEV has to be set explicitly in CXFALGS. This patch restores commit cab9c67d461c ("mdmonitor: set small delay once") for configuration without libudev to bring minimal support in such case. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdmonitor: check if udev has finished events processingOleksandr Shchirskyi2021-03-081-1/+1
| | | | | | | | | If mdmonitor is awaken by event, wait for udev to finish events processing, to eliminate the race between udev and mdadm when spare has been added and need to be moved by mdmonitor Signed-off-by: Oleksandr Shchirskyi <oleksandr.shchirskyi@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Make target to install binaries onlyKinga Tanska2020-11-261-3/+5
| | | | | | | | Make install causes installation of binaries, udev and man. This commit contains new target make install-bin, which results in installation of binaries only. Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
* uuid.c: split uuid stuffs from util.cGuoqing Jiang2020-05-191-3/+3
| | | | | | | | | | | | | | | | | | | | Currently, 'make raid6check' is build broken since commit b06815989 ("mdadm: load default sysfs attributes after assemblation"). /usr/bin/ld: sysfs.o: in function `sysfsline': sysfs.c:(.text+0x2707): undefined reference to `parse_uuid' /usr/bin/ld: sysfs.c:(.text+0x271a): undefined reference to `uuid_zero' /usr/bin/ld: sysfs.c:(.text+0x2721): undefined reference to `uuid_zero' Apparently, the compile of mdadm or raid6check are coupled with uuid functions inside util.c. However, we can't just add util.o to CHECK_OBJS which raid6check is needed, because it caused other worse problems. So, let's introduce a uuid.c file which is indenpended file to fix the problem, all the contents are splitted from util.c. Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Makefile: add EXTRAVERSION supportTkaczyk Mariusz2020-05-151-1/+2
| | | | | | | | | Add optional EXTRAVERSION parameter to Makefile and allow to mark version by user friendly label. It might be useful when creating custom spins of mdadm, or labeling some instance in between major releases. Signed-off-by: Tkaczyk Mariusz <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Respect $(CROSS_COMPILE) when $(CC) is the defaultdann frazier2020-01-161-1/+3
| | | | | | | | | | | Commit 1180ed5 told make to only respect $(CROSS_COMPILE) when $(CC) was unset. But that will never be the case, as make provides a default value for $(CC). Change this logic to respect $(CROSS_COMPILE) when $(CC) is the default. Patch originally by Helmet Grohne. Fixes: 1180ed5 ("Makefile: make the CC definition conditional") Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor: add system timer to run --oneshot periodicallyNeilBrown2018-12-061-0/+1
| | | | | | | | | | | | | | | "mdadm --monitor --oneshot" can be used to get a warning if there are any degraded arrays. It can be helpful to get this warning periodically while the condition persists. This patch add a systemd service and timer which can be enabled with systemctl enable mdmonitor-oneshot.service and will then provide daily warnings. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdcheck: add systemd unit files to run mdcheck.NeilBrown2018-12-061-1/+4
| | | | | | | | | | | | | | | | | Having the mdcheck script is not use if is never run. This patch adds systemd unit files so that it can easily be run on the first Sunday of each month for 6 hours, then on every subsequent morning until the check is finished. The units still need to be enabled with systemctl enable mdcheck_start.timer The timer will only actually be started when an array which might need it becomes active. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* gcc-8 coverity hackJes Sorensen2018-06-041-4/+11
| | | | | | | Coverity still has issues with gcc-7, not to mention gcc-8. Hack around it, until they fix it. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Move mdadm_env.sh out of /usr/lib/systemdNeilBrown2017-10-101-1/+2
| | | | | | | | | | | | The systemd developers like to keep control of the lib/systemd namespace, and haven't approved of the use of lib/systemd/scripts. So we should stop using it. Move the mdadm_env.sh script, optionally sourced by mdmonitor.service, to a new directory /usr/lib/mdadm. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* udev rules: introduce rules for cluster-md to confirm deviceGuoqing Jiang2017-08-021-2/+4
| | | | | | | | | | | For cluster scenario, add device is different with native raid. When a node issues adds a device, then the node will broadcast a message with UUID to other nodes in the cluster. If receiving node can find the device with the specific UUID, it must confirm the device, otherwise reports it is missing. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Create: tell udev md device is not ready when first created.NeilBrown2017-05-021-2/+2
| | | | | | | | | | | | | | | | | | | | | When an array is created the content is not initialized, so it could have remnants of an old filesystem or md array etc on it. udev will see this and might try to activate it, which is almost certainly not what is wanted. So create a mechanism for mdadm to communicate with udev to tell it that the device isn't ready. This mechanism is the existance of a file /run/mdadm/created-mdXXX where mdXXX is the md device name. When creating an array, mdadm will create the file. A new udev rule file, 01-md-raid-creating.rules, will detect the precense of thst file and set ENV{SYSTEMD_READY}="0". This is fairly uniformly used to suppress actions based on the contents of the device. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Makefile: Default to -O2 optimizationJes Sorensen2017-04-211-0/+1
| | | | Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm: retire mdassemble in make everythingColy Li2017-04-201-9/+2
| | | | | | | | | make everything reports no rule to make mdassemble, because mdassemble is removed from mdadm. This patch removes mdassemble from "everything" in Makefile, now there is no failure when compiling a static mdadm binary. Signed-off-by: Coly Li <colyli@suse.de> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Retire mdassembleJes Sorensen2017-04-111-37/+0
| | | | | | | | mdassemble doesn't handle container based arrays, no support for sysfs, etc. It has not been actively maintained for years, so time to send it off to retirement. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: PPL supportArtur Paszkiewicz2017-03-291-2/+3
| | | | | | | | | | | | | | | | | | | Enable creating and assembling IMSM raid5 arrays with PPL. Update the IMSM metadata format to include new fields used for PPL. Add structures for PPL metadata. They are used also by super1 and shared with the kernel, so put them in md_p.h. Write the initial empty PPL header when creating an array. When assembling an array with PPL, validate the PPL header and in case it is not correct allow to overwrite it if --force was provided. Write the PPL location and size for a device to the new rdev sysfs attributes 'ppl_sector' and 'ppl_size'. Enable PPL in the kernel by writing to 'consistency_policy' before the array is activated. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* mdadm: Add Wimplicit-fallthrough=0 in MakefileXiao Ni2017-03-171-0/+5
| | | | | | | | | | | There are many errors like 'error: this statement may fall through'. But the logic is right. So add the flag Wimplicit-fallthrough=0 to disable the error messages. The method I use is from https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html #index-Wimplicit-fallthrough-375 Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* Makefile: Fix date to be output in ISO formatJes Sorensen2017-01-111-1/+1
| | | | | | | | Updated the static version in the release, but forgot to fix the Makefile generated version when extracting from git Reported-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* Makefile: make the CC definition conditionalMaxin B. John2016-02-081-1/+1
| | | | | | | | | By hardcoding CC's definition in the Makefile, all the external gcc parameters set by tune settings are lost. This causes compile failure with x32 toolchain Signed-off-by: Maxin B. John <maxin.john@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
* Assorted fixed for a "make everything" buildNeilBrown2016-01-281-4/+4
| | | | Signed-off-by: NeilBrown <neilb@suse.com>
* restripe: fix compilation of "make test"NeilBrown2016-01-131-1/+1
| | | | Signed-off-by: NeilBrown <neilb@suse.com>
* add crc32c and use it for r5l checksumSong Liu2015-10-301-1/+1
| | | | | | | | | | | | | In kernel space, r5l checksum will use crc32c: http://marc.info/?l=linux-raid&m=144598970529191 mdadm need to change too. This patch ports a simplified crc32c algorithm from kernel code, and used in super1.c:write_empty_r5l_meta_block(); Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Safeguard against writing to an active device of another nodeGuoqing Jiang2015-10-211-1/+2
| | | | | | | | | | | | | | Modifying an exiting device's superblock or creating a new superblock on an existing device needs to be checked because the device could be in use by another node in another array. So, we check this by taking all superblock locks in userspace so that we don't step onto an active device used by another node and safeguard against accidental edits. After the edit is complete, we release all locks and the lockspace so that it can be used by the kernel space. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Makefile: test -s flag and suppress echo when set.NeilBrown2015-08-051-3/+9
| | | | | | | | Some rules do their own tracing and so aren't affected by -s. So add a test for -s in MAKE_FLAGS and avoid echo when present. Signed-off-by: NeilBrown <neilb@suse.com>
* mdassemble: include mapfile support.NeilBrown2015-08-031-1/+1
| | | | | | | | This does make mdassemble a bit bigger, but it also means it actually works properly with named arrays. Ref: https://bbs.archlinux.org/viewtopic.php?id=198196 Signed-off-by: NeilBrown <neilb@suse.com>
* Set home-cluster while creating an arrayGuoqing Jiang2015-06-171-1/+5
| | | | | | | | | | | | | | | The home-cluster is stored in the bitmap super block of the array. The device can be assembled on a cluster with the cluster name same as the one recorded in the bitmap. If home-cluster is not specified, this is auto-detected using dlopen corosync cmap library. neilb: allow code to compile when corosync-devel is not installed. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Makefile: binaries shouldn't directly depend on check_rundirNeilBrown2014-11-251-3/+3
| | | | | | | | | | | | | | check_rundir always needs to be "built", so making mdadm and mdmon depend on it causes them to always be built. i.e. running make ; make will needlessly link the binaries a second time. So change the makefile to use "order-only" pre-requisites. Reported-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix parallel make problem.Samuli Suominen2014-08-211-9/+9
| | | | | | | | | | | | | | | When make is called with, for example, "make -j9 install install-system" i.e. both install and install-systemd targets at the same line and with high -j value, then the same install.tmp file was used, and udev rules ends up in systemd service files, or otherway around. For more information, see: http://www.spinics.net/lists/raid/msg46782.html http://bugs.gentoo.org/show_bug.cgi?id=517218 Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: don't include super0 and super1 in mdmonNeilBrown2014-08-071-1/+1
| | | | | | | They are no needed, and future patch will add a dependency yo super1 which mdmon doesn't have. Signed-off-by: NeilBrown <neilb@suse.de>
* Makefile: use "man -l" to format man pages.NeilBrown2014-07-031-6/+6
| | | | | | | | | | Formatting a man page is more than just "nroff -man". In particular, that doesn't invoke "tbl" when needed. So use "man -l" which performs correct formatting on a given file. Signed-off-by: NeilBrown <neilb@suse.de>
* Makefile: install mdadm-grow-continue@.serviceNeilBrown2014-06-101-1/+1
| | | | | | Forgot to add this to install-systemd target Signed-off-by: NeilBrown <neilb@suse.de>
* Make sure "make everything" builds again.NeilBrown2014-06-051-4/+4
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* install: use BINDIR consistently to locate mdadm and mdmonNeilBrown2014-05-221-8/+20
| | | | | | | | Every place where the paths for mdadm or mdmon is explicit, it should use the BINDIR setting, not "/sbin/". Reported-by: member graysky <graysky@archlinux.us> (https://bugs.archlinux.org/task/37330) Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: try to let "--grow --continue" from systemd complete a reshape.NeilBrown2014-05-151-0/+1
| | | | | | | | | | | If "--assemble" or "--incremental" is started by udev, then monitoring the reshape in the background won't work. So try asking systemd to start a grow-continue. If that fails, just do it the old way. Signed-off-by: NeilBrown <neilb@suse.de>
* systemd: various fixes for boot with container-arrays.NeilBrown2014-04-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 1/ Add systemd shutdown script to ensure DDF and IMSM are clean before we actually shutdown 2/ Get udev to tell systemd to run the mdmon@mdXXX.service units when a member array appears. If we boot off a member array (with dracut at least), the mdmon started in the initramfs will lose track of /sys etc, so we need to restart it. systemd will try to forget about it too (but not actually kill it because we said not to do this). Having udev tell it to start it will allow a new mdmon to run which can see /sys, and systemd will know about it. 3/ Always use --offroot and --takeover when starting mdmon with systemd --offroot is needed else shutdown will hang. --takeover is needed incase an mdmon was started earlier (e.g. in initramfs). Neither hurt if they aren't actually needed. Signed-off-by: NeilBrown <neilb@suse.de>
* Add mdmonitor.service systemd unit file.NeilBrown2013-12-111-0/+2
| | | | | | | | | | | | | | | | | | | | This systemd unit file runs mdadm in --monitor mode. It is started by a SYSTEMD_WANTS signal from udev whenever an md array is started that would benefit from mdadm --monitor. Commandline arguments can be provided by a script /usr/lib/systemd/scripts/mdadm_env.sh which should write an MDADM_MONITOR_ARGS=.... line to /run/sysconfig/mdadm A script to extra args from SUSE's /etc/sysconfig/mdadm file is provided. If no mdadm_env.sh is provided, then args are "--scan" which requires "mail" or "program" to be set in /etc/mdadm.conf. I believe this is suitable for Fedora. Signed-off-by: NeilBrown <neilb@suse.de>
* Systemd integration for starting newly-degraded arrays.NeilBrown2013-12-021-0/+2
| | | | | | | | | | | | | | | | Normally "mdadm -I" will not start an array if it has reason to expect further devices. This means that if a device is removed while the host is shut down, "mdadm -I" will never start the device. If the array is know to the host, it make sense to start the array anyway after a reasonable timeout. This patch adds systemd/udev infrastructure so that 30 seconds after a known array first becomes able to be assembled as a degraded array, the array will be assembled even if more devices are still expected. Signed-off-by: NeilBrown <neilb@suse.de>