public inbox for linux-raid@vger.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: rgoldwyn@suse.de, linux-raid@vger.kernel.org
Cc: pawel.baldysiak@intel.com, Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: Re: [PATCH] Fix remove_and_add_spares removes drive added as spare in slot_store
Date: Fri, 18 Dec 2015 12:10:43 +1100	[thread overview]
Message-ID: <87a8p88sto.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <1450359905-8042-1-git-send-email-rgoldwyn@suse.de>

[-- Attachment #1: Type: text/plain, Size: 1732 bytes --]

On Fri, Dec 18 2015, rgoldwyn@suse.de wrote:

> From: Goldwyn Rodrigues <rgoldwyn@suse.com>
>
> Commit 2910ff17d154baa5eb50e362a91104e831eb2bb6
> introduced a regression which would remove a recently added spare via
> slot_store. Revert part of the patch which touches slot_store() and add
> the disk directly using pers->hot_add_disk()
>
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
> Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
> ---
>  drivers/md/md.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index a71b36f..0444afa 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -2726,6 +2726,7 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len)
>  		/* Activating a spare .. or possibly reactivating
>  		 * if we ever get bitmaps working here.
>  		 */
> +		int err;
>  
>  		if (rdev->raid_disk != -1)
>  			return -EBUSY;
> @@ -2747,9 +2748,15 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len)
>  			rdev->saved_raid_disk = -1;
>  		clear_bit(In_sync, &rdev->flags);
>  		clear_bit(Bitmap_sync, &rdev->flags);
> -		remove_and_add_spares(rdev->mddev, rdev);
> -		if (rdev->raid_disk == -1)
> -			return -EBUSY;
> +		err = rdev->mddev->pers->
> +			hot_add_disk(rdev->mddev, rdev);
> +		if (err) {
> +			rdev->raid_disk = -1;
> +			return err;
> +		} else
> +			sysfs_notify_dirent_safe(rdev->sysfs_state);
> +		if (sysfs_link_rdev(rdev->mddev, rdev))
> +			/* failure here is OK */;
>  		/* don't wakeup anyone, leave that to userspace. */
>  	} else {
>  		if (slot >= rdev->mddev->raid_disks &&
> -- 
> 2.6.2

applied, thanks.

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

      reply	other threads:[~2015-12-18  1:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17 13:45 [PATCH] Fix remove_and_add_spares removes drive added as spare in slot_store rgoldwyn
2015-12-18  1:10 ` NeilBrown [this message]

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=87a8p88sto.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=pawel.baldysiak@intel.com \
    --cc=rgoldwyn@suse.com \
    --cc=rgoldwyn@suse.de \
    /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