]> git.ipfire.org Git - thirdparty/mdadm.git/commit
mdadm: add --no-devices to avoid component devices detail information
authorColy Li <colyli@suse.de>
Wed, 31 Jul 2019 05:29:29 +0000 (13:29 +0800)
committerJes Sorensen <jsorensen@fb.com>
Mon, 12 Aug 2019 20:16:36 +0000 (16:16 -0400)
commitd11abe4bd5cad39803726ddff1888674e417bda5
treee93976438518db6defd35a3533d7ecfb3e3f13bd
parent452dc4d13a012cdcb05088c0dbc699959c4d6c73
mdadm: add --no-devices to avoid component devices detail information

When people assemble a md raid device with a large number of
component deivces (e.g. 1500 DASD disks), the raid device detail
information generated by 'mdadm --detail --export $devnode' is very
large. It is because the detail information contains information of
all the component disks (even the missing/failed ones).

In such condition, when udev-md-raid-arrays.rules is triggered and
internally calls "mdadm --detail --no-devices --export $devnode",
user may observe systemd error message ""invalid message length". It
is because the following on-stack raw message buffer in systemd code
is not big enough,
        systemd/src/libudev/libudev-monitor.c
        _public_ struct udev_device *udev_monito ...
                struct ucred *cred;
                union {
                        struct udev_monitor_netlink_header nlh;
                        char raw[8192];
                } buf;
Even change size of raw[] from 8KB to larger size, it may still be not
enough for detail message of a md raid device with much larger number of
component devices.

To fix this problem, an extra option '--no-devices' is added (the
original idea is proposed by Neil Brown). When printing detailed
information of a md raid device, if '--no-devices' is specified, then
all component devices information will not be printed, then the output
message size can be restricted to a small number, even with the systemd
only has 8KB on-disk raw buffer, the md raid array udev rules can work
correctly without failure message.

Signed-off-by: Coly Li <colyli@suse.de>
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Detail.c
ReadMe.c
mdadm.c
mdadm.h