Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: linux-raid@vger.kernel.org
Subject: mdadm: ARRAY <ignore> lines not correctly handled
Date: Sun, 11 Nov 2012 03:42:35 -0500	[thread overview]
Message-ID: <201211110342.36095.vapier@gentoo.org> (raw)

[-- Attachment #1: Type: Text/Plain, Size: 3168 bytes --]

the mdadm.conf man page states:
The ARRAY lines identify actual arrays.  The second word on the line may be 
the name of the device where the array is normally assembled, [...].  
Alternately the word <ignore> (complete with angle brackets) can be given in 
which case any array which matches the rest of the line will never be 
automatically assembled.

so let's say i have a raid that looks like:
/dev/md0:
        Version : 1.2
  Creation Time : Wed Oct 31 16:05:49 2012
     Raid Level : raid6
     Array Size : 1953522688 (1863.02 GiB 2000.41 GB)
  Used Dev Size : 976761344 (931.51 GiB 1000.20 GB)
   Raid Devices : 4
  Total Devices : 4
    Persistence : Superblock is persistent

    Update Time : Sun Nov 11 03:35:26 2012
          State : clean 
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0

         Layout : left-symmetric
     Chunk Size : 512K

           Name : vapier:0  (local to host vapier)
           UUID : 51b812dc:094ea54b:f8f7b331:9982b16c
         Events : 112048

    Number   Major   Minor   RaidDevice State
       0       8       32        0      active sync   /dev/sdc
       1       8        0        1      active sync   /dev/sda
       4       8       16        2      active sync   /dev/sdb
       5       8       64        3      active sync   /dev/sde

the man page says i should be able to prevent this from being auto-assembled 
via `mdamd -As` by doing something like:
ARRAY <ignore> uuid=51b812dc:094ea54b:f8f7b331:9982b16c

or perhaps:
DEVICE /dev/sd[abce]
ARRAY <ignore> devices=/dev/sda,/dev/sdb,/dev/sde,/dev/sdc

unfortunately, this turns out to not be the case.  mdadm goes ahead and auto-
assembles things anyways.  looking at the code, it seems that it's due to the 
code falling back if nothing was detected:
mdadm.c
...
    do {
        failures = 0;
        successes = 0;
        rv = 0;
        for (a = array_list; a ; a = a->next) {
            int r;
            if (a->assembled)
                continue;
            if (a->devname &&   
                strcasecmp(a->devname, "<ignore>") == 0)
                continue;

            r = Assemble(ss, a->devname,
                     a, NULL, c);
            if (r == 0) {
                a->assembled = 1;
                successes++;
            } else
                failures++;
            rv |= r;
            cnt++;
        }
    } while (failures && successes);
    if (c->homehost && cnt == 0) {
        /* Maybe we can auto-assemble something.
         * Repeatedly call Assemble in auto-assemble mode
         * until it fails
         */
        int rv2;
        int acnt;
        ident->autof = c->autof;
        do {
            struct mddev_dev *devlist = conf_get_devs();
            acnt = 0;
            do {
                rv2 = Assemble(ss, NULL,
                           ident,
                           devlist, c);
...

the idea is to be able to have a system with multiple raids (some of which are 
dormant/backups), blacklist the ones that you want to keep idle, and bring 
online all the rest.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

             reply	other threads:[~2012-11-11  8:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-11  8:42 Mike Frysinger [this message]
2012-11-22  6:05 ` mdadm: ARRAY <ignore> lines not correctly handled NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201211110342.36095.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox