]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
md-cluster: Improve md_reload_sb to be less error prone
authorGoldwyn Rodrigues <rgoldwyn@suse.com>
Fri, 21 Aug 2015 15:33:39 +0000 (10:33 -0500)
committerGoldwyn Rodrigues <rgoldwyn@suse.com>
Mon, 12 Oct 2015 06:34:48 +0000 (01:34 -0500)
commit70bcecdb1534a7dcd82503b705c27a048d568c9d
tree62139e038abf1eabe175920911215825eaeba83b
parent2910ff17d154baa5eb50e362a91104e831eb2bb6
md-cluster: Improve md_reload_sb to be less error prone

md_reload_sb is too simplistic and it explicitly needs to determine
the changes made by the writing node. However, there are multiple areas
where a simple reload could fail.

Instead, read the superblock of one of the "good" rdevs and update
the necessary information:

- read the superblock into a newly allocated page, by temporarily
  swapping out rdev->sb_page and calling ->load_super.
- if that fails return
- if it succeeds, call check_sb_changes
  1. iterates over list of active devices and checks the matching
   dev_roles[] value.
    If that is 'faulty', the device must be  marked as faulty
 - call md_error to mark the device as faulty. Make sure
   not to set CHANGE_DEVS and wakeup mddev->thread or else
   it would initiate a resync process, which is the responsibility
   of the "primary" node.
 - clear the Blocked bit
 - Call remove_and_add_spares() to hot remove the device.
If the device is 'spare':
 - call remove_and_add_spares() to get the number of spares
   added in this operation.
 - Reduce mddev->degraded to mark the array as not degraded.
  2. reset recovery_cp
- read the rest of the rdevs to update recovery_offset. If recovery_offset
  is equal to MaxSector, call spare_active() to set it In_sync

This required that recovery_offset be initialized to MaxSector, as
opposed to zero so as to communicate the end of sync for a rdev.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
drivers/md/md-cluster.c
drivers/md/md.c
drivers/md/md.h
drivers/md/raid1.c