Re: [PATCH 1/2] mdadm: Add takeover support for external meta

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Maciej,


On Fri, Apr 30, 2010 at 6:47 AM, Trela, Maciej <Maciej.Trela@xxxxxxxxx> wrote:
>
> When performing takeover 0->10 or 10->0 mdmon should update the
> external metadata (due to disk slot changes).
> To achieve that mdadm, after changing the level in md,
> sends update_level to mdmon.
>
> Signed-off-by: Maciej Trela <maciej.trela@xxxxxxxxx>
> ---
>  Grow.c        |   38 ++++++++++++++++-
>  managemon.c   |   14 ++++++-
>  mdadm.h       |    1 +
>  mdstat.c      |   24 ++++++++++
>  monitor.c     |    2 +-
>  super-intel.c |  133 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  6 files changed, 207 insertions(+), 5 deletions(-)
>
> diff --git a/Grow.c b/Grow.c
> index 6264996..17974fa 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -540,7 +540,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
>                        "       Please use a newer kernel\n");
>                return 1;
>        }
> -       sra = sysfs_read(fd, 0, GET_LEVEL);
> +       sra = sysfs_read(fd, 0, GET_VERSION | GET_LEVEL);
>        frozen = freeze_array(sra);
>        if (frozen < 0) {
>                fprintf(stderr, Name ": %s is performing resync/recovery and cannot"
> @@ -690,6 +690,42 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
>                                fprintf(stderr, Name " level of %s changed to %s\n",
>                                        devname, c);
>                        changed = 1;
> +
> +                       st = super_by_fd(fd);
> +                       if (st->ss->external) {
> +                               int dn = devname2devnum(sra->text_version + 1);
> +                               /* if raid0 was takeovered by any other
> +                                  personality start mdmon */
> +                               if ((level > 0) && (orig.level == 0)) {
> +                                       if (!mdmon_running(dn))
> +                                               start_mdmon(dn);
> +                                       ping_monitor(devnum2devname(dn));
> +                               }
> +                               /* inform mdmon about raid level change
> +                                * only for 0->10 and 10->0 transitions */

This seems wrong... we should be checking with the metadata handler
before allowing a level change to occur.  It's only luck that a
raid5-to-raid6 conversion is currently broken by an inability to set
stripe_cache_size.  So I would do the call to update_super() before
the level is changed to give the handler a chance to abort
orom/metadata incompatible level changes.

> +                               if ((level == 10) || (orig.level == 10)) {

Unnecessary parentheses... here and a few other places.

> +                                       struct mdinfo *new_info;
> +                                       struct mdinfo curr_info;
> +
> +                                       new_info = sysfs_read(fd, 0, GET_LEVEL | GET_LAYOUT
> +                                                             | GET_DISKS | GET_DEVS);
> +                                       int container_fd = open_dev_excl(dn);

Please no c++ style variable declarations mid-block.
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux