linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Adam Kwolek <adam.kwolek@intel.com>
Cc: linux-raid@vger.kernel.org, dan.j.williams@intel.com,
	ed.ciechanowski@intel.com
Subject: Re: [PATCH 02/10] FIX: Problem with removing array after takeover
Date: Fri, 3 Dec 2010 14:46:21 +1100	[thread overview]
Message-ID: <20101203144621.03528cb9@notabene.brown> (raw)
In-Reply-To: <20101202081856.4639.29114.stgit@gklab-170-024.igk.intel.com>

On Thu, 02 Dec 2010 09:18:56 +0100 Adam Kwolek <adam.kwolek@intel.com> wrote:

> When array parameters are changed old array 'A' is going to be removed
> and new array 'B' is going to be serviced. If array B is raid0 array (takeovered),
> array 'A' will never be deleted and mdmon is not going to exit.
> Scenario:
> 1. managemon creates array 'B' and inserts it to begin of active arrays list
> 2. managemon sets field B->replaces = A
> 
> 3. monitor: finds that array 'B' is raid 0 array and removes it from list
>    information about removing array 'A' from list is lost
>    and array 'A' stays in list forever
> 
> To resolve this situation first try to remove replaced arrays and then proceed
> regular array servicing.
> 
> Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>

This doesn't look right.  You are duplicating a chunk of code, and having two
copies of it is dangerous and confusing.

Based on your description of the issue, maybe it would make sense to avoid
step 3.  i.e. if monitor find array 'B' which is RAID0, it doesn't remove it
from the list while it still has a 'replaces' pointer.  Obviously monitor
would need to be careful not to do anything else with the array.  I think the
'remove it if it is RAID0' is in code that I having accepted yet, so I cannot
easily check if that does make sense.. What do you think?

I won't apply this patch at this stage though.

Thanks,
NeilBrown



> ---
> 
>  monitor.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/monitor.c b/monitor.c
> index 59b4181..0fbe198 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -480,6 +480,22 @@ static int wait_and_act(struct supertype *container, int nowait)
>  
>  	for (ap = aap ; *ap ;) {
>  		a = *ap;
> +
> +		/* Remove array that current array points to remove
> +		 */
> +		if (a->replaces && !discard_this) {
> +			struct active_array **ap;
> +			for (ap = &a->next; *ap && *ap != a->replaces;
> +			     ap = & (*ap)->next)
> +				;
> +			if (*ap)
> +				*ap = (*ap)->next;
> +			discard_this = a->replaces;
> +			a->replaces = NULL;
> +			/* FIXME check if device->state_fd need to be cleared?*/
> +			signal_manager();
> +		}
> +
>  		/* once an array has been deactivated we want to
>  		 * ask the manager to discard it.
>  		 */


  reply	other threads:[~2010-12-03  3:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02  8:18 [PATCH 00/10] Pre-migration patch series Adam Kwolek
2010-12-02  8:18 ` [PATCH 01/10] FIX: Cannot exit monitor after takeover Adam Kwolek
2010-12-02  8:18 ` [PATCH 02/10] FIX: Problem with removing array " Adam Kwolek
2010-12-03  3:46   ` Neil Brown [this message]
2010-12-02  8:19 ` [PATCH 03/10] FIX: Add error code for raid_disks set Adam Kwolek
2010-12-02 18:56   ` Dan Williams
2010-12-02  8:19 ` [PATCH 04/10] Add support to skip slot configuration Adam Kwolek
2010-12-02  8:19 ` [PATCH 05/10] Add spares to raid0 array using takeover Adam Kwolek
2010-12-03  3:52   ` Neil Brown
2010-12-02  8:19 ` [PATCH 06/10] FIX: open backup file for reshape as function Adam Kwolek
2010-12-03  4:01   ` Neil Brown
2010-12-02  8:19 ` [PATCH 07/10] FIX: Do not use layout for raid4 and raid0 while geo map computing Adam Kwolek
2010-12-02  8:19 ` [PATCH 08/10] FIX: sync_completed_fd handler has to be closed Adam Kwolek
2010-12-02  8:19 ` [PATCH 09/10] FIX: Honor !reshape state on wait_reshape() entry Adam Kwolek
2010-12-03  4:11   ` Neil Brown
2010-12-02  8:19 ` [PATCH 10/10] FIX: wait_backup() sometimes hungs Adam Kwolek
2010-12-03  4:16   ` Neil Brown
2010-12-03  7:45     ` Kwolek, Adam
2010-12-03 10:35       ` Neil Brown
2010-12-03  4:19 ` [PATCH 00/10] Pre-migration patch series Neil Brown

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=20101203144621.03528cb9@notabene.brown \
    --to=neilb@suse.de \
    --cc=adam.kwolek@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --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;
as well as URLs for NNTP newsgroup(s).