* [PATCH] imsm: fix: rebuild does not continue after reboot
@ 2012-04-20 11:45 Lukasz Dorau
2012-04-22 23:52 ` NeilBrown
0 siblings, 1 reply; 2+ messages in thread
From: Lukasz Dorau @ 2012-04-20 11:45 UTC (permalink / raw)
To: neilb; +Cc: linux-raid, dan.j.williams, ed.ciechanowski
If system is rebooted during rebuild, md driver changes sync_action
from 'recover' to 'idle' (during stopping all md devices).
If mdmon is still running then, it detects the change of sync_action state,
finishes rebuild and writes metadata to disks. After computer's restart
the RAID volume is in Normal state in OROM and rebuild seems to be finished.
After system's start-up RAID volume is in auto-read-only state
and metadata is in Dirty state. Rebuild seems to be finished but it is not.
Data is inconsistent (out-of-sync).
When mdmon detects the change of sync_action from 'recover' to 'idle',
it has to check if rebuild is really finished. Appropriate test was added.
Now mdmon examines each volume's member if it is being rebuilt.
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
---
super-intel.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index e405d97..1ad5e47 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -7273,6 +7273,8 @@ static void imsm_set_disk(struct active_array *a, int n, int state)
struct imsm_dev *dev = get_imsm_dev(super, inst);
struct imsm_map *map = get_imsm_map(dev, MAP_0);
struct imsm_disk *disk;
+ struct mdinfo *mdi;
+ int recovery_not_finished = 0;
int failed;
__u32 ord;
__u8 map_state;
@@ -7313,6 +7315,21 @@ static void imsm_set_disk(struct active_array *a, int n, int state)
dprintf("normal: ");
if (is_rebuilding(dev)) {
dprintf("while rebuilding");
+ /* check if recovery is really finished */
+ for (mdi = a->info.devs; mdi ; mdi = mdi->next)
+ if (mdi->recovery_start != MaxSector) {
+ recovery_not_finished = 1;
+ break;
+ }
+ if (recovery_not_finished) {
+ dprintf("\nimsm: Rebuild has not finished yet, "
+ "state not changed");
+ if (a->last_checkpoint < mdi->recovery_start) {
+ a->last_checkpoint = mdi->recovery_start;
+ super->updates_pending++;
+ }
+ break;
+ }
end_migration(dev, super, map_state);
map = get_imsm_map(dev, MAP_0);
map->failed_disk_num = ~0;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] imsm: fix: rebuild does not continue after reboot
2012-04-20 11:45 [PATCH] imsm: fix: rebuild does not continue after reboot Lukasz Dorau
@ 2012-04-22 23:52 ` NeilBrown
0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2012-04-22 23:52 UTC (permalink / raw)
To: Lukasz Dorau; +Cc: linux-raid, dan.j.williams, ed.ciechanowski
[-- Attachment #1: Type: text/plain, Size: 2355 bytes --]
On Fri, 20 Apr 2012 13:45:02 +0200 Lukasz Dorau <lukasz.dorau@intel.com>
wrote:
> If system is rebooted during rebuild, md driver changes sync_action
> from 'recover' to 'idle' (during stopping all md devices).
> If mdmon is still running then, it detects the change of sync_action state,
> finishes rebuild and writes metadata to disks. After computer's restart
> the RAID volume is in Normal state in OROM and rebuild seems to be finished.
> After system's start-up RAID volume is in auto-read-only state
> and metadata is in Dirty state. Rebuild seems to be finished but it is not.
> Data is inconsistent (out-of-sync).
>
> When mdmon detects the change of sync_action from 'recover' to 'idle',
> it has to check if rebuild is really finished. Appropriate test was added.
> Now mdmon examines each volume's member if it is being rebuilt.
>
> Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
> ---
> super-intel.c | 17 +++++++++++++++++
> 1 files changed, 17 insertions(+), 0 deletions(-)
>
> diff --git a/super-intel.c b/super-intel.c
> index e405d97..1ad5e47 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -7273,6 +7273,8 @@ static void imsm_set_disk(struct active_array *a, int n, int state)
> struct imsm_dev *dev = get_imsm_dev(super, inst);
> struct imsm_map *map = get_imsm_map(dev, MAP_0);
> struct imsm_disk *disk;
> + struct mdinfo *mdi;
> + int recovery_not_finished = 0;
> int failed;
> __u32 ord;
> __u8 map_state;
> @@ -7313,6 +7315,21 @@ static void imsm_set_disk(struct active_array *a, int n, int state)
> dprintf("normal: ");
> if (is_rebuilding(dev)) {
> dprintf("while rebuilding");
> + /* check if recovery is really finished */
> + for (mdi = a->info.devs; mdi ; mdi = mdi->next)
> + if (mdi->recovery_start != MaxSector) {
> + recovery_not_finished = 1;
> + break;
> + }
> + if (recovery_not_finished) {
> + dprintf("\nimsm: Rebuild has not finished yet, "
> + "state not changed");
> + if (a->last_checkpoint < mdi->recovery_start) {
> + a->last_checkpoint = mdi->recovery_start;
> + super->updates_pending++;
> + }
> + break;
> + }
> end_migration(dev, super, map_state);
> map = get_imsm_map(dev, MAP_0);
> map->failed_disk_num = ~0;
Applied, thanks.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-22 23:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-20 11:45 [PATCH] imsm: fix: rebuild does not continue after reboot Lukasz Dorau
2012-04-22 23:52 ` NeilBrown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.