diff options
| author | NeilBrown <neilb@suse.de> | 2010-08-16 04:09:31 -0400 |
|---|---|---|
| committer | NeilBrown <neilb@suse.de> | 2010-08-17 21:39:38 -0400 |
| commit | 3a3a5ddb7a0f43c3dd0f98673f3d930a456725f8 (patch) | |
| tree | fa1e33c011c9f6350ce5118b89deafacbb1e0f2b | |
| parent | da5cabf80e2433131bf0ed8993abc0f7ea618c73 (diff) | |
Update recovery_offset even when external metadata is used.
The update of ->recovery_offset in sync_sbs is appropriate even then external
metadata is in use. However sync_sbs is only called when native
metadata is used.
So move that update in to the top of md_update_sb (which is the only
caller of sync_sbs) before the test on ->external.
This moves the update out of ->write_lock protection, but those fields
only need ->reconfig_mutex protection which they still have.
Also move the test on ->persistent up to where ->external is set as
for metadata update purposes they are the same.
Clear MD_CHANGE_DEVS and MD_CHANGE_CLEAN as they can only be confusing
if ->external is set or ->persistent isn't.
Finally move the update of ->utime down as it is only relevent (like
the ->events update) for native metadata.
Signed-off-by: NeilBrown <neilb@suse.de>
Reported-by: "Kwolek, Adam" <adam.kwolek@intel.com>
| -rw-r--r-- | drivers/md/md.c | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 11567c7999a2..c148b6302154 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -2136,16 +2136,6 @@ static void sync_sbs(mddev_t * mddev, int nospares) | |||
| 2136 | * with the rest of the array) | 2136 | * with the rest of the array) |
| 2137 | */ | 2137 | */ |
| 2138 | mdk_rdev_t *rdev; | 2138 | mdk_rdev_t *rdev; |
| 2139 | |||
| 2140 | /* First make sure individual recovery_offsets are correct */ | ||
| 2141 | list_for_each_entry(rdev, &mddev->disks, same_set) { | ||
| 2142 | if (rdev->raid_disk >= 0 && | ||
| 2143 | mddev->delta_disks >= 0 && | ||
| 2144 | !test_bit(In_sync, &rdev->flags) && | ||
| 2145 | mddev->curr_resync_completed > rdev->recovery_offset) | ||
| 2146 | rdev->recovery_offset = mddev->curr_resync_completed; | ||
| 2147 | |||
| 2148 | } | ||
| 2149 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 2139 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
| 2150 | if (rdev->sb_events == mddev->events || | 2140 | if (rdev->sb_events == mddev->events || |
| 2151 | (nospares && | 2141 | (nospares && |
| @@ -2167,12 +2157,27 @@ static void md_update_sb(mddev_t * mddev, int force_change) | |||
| 2167 | int sync_req; | 2157 | int sync_req; |
| 2168 | int nospares = 0; | 2158 | int nospares = 0; |
| 2169 | 2159 | ||
| 2170 | mddev->utime = get_seconds(); | ||
| 2171 | if (mddev->external) | ||
| 2172 | return; | ||
| 2173 | repeat: | 2160 | repeat: |
| 2161 | /* First make sure individual recovery_offsets are correct */ | ||
| 2162 | list_for_each_entry(rdev, &mddev->disks, same_set) { | ||
| 2163 | if (rdev->raid_disk >= 0 && | ||
| 2164 | mddev->delta_disks >= 0 && | ||
| 2165 | !test_bit(In_sync, &rdev->flags) && | ||
| 2166 | mddev->curr_resync_completed > rdev->recovery_offset) | ||
| 2167 | rdev->recovery_offset = mddev->curr_resync_completed; | ||
| 2168 | |||
| 2169 | } | ||
| 2170 | if (mddev->external || !mddev->persistent) { | ||
| 2171 | clear_bit(MD_CHANGE_DEVS, &mddev->flags); | ||
| 2172 | clear_bit(MD_CHANGE_CLEAN, &mddev->flags); | ||
| 2173 | wake_up(&mddev->sb_wait); | ||
| 2174 | return; | ||
| 2175 | } | ||
| 2176 | |||
| 2174 | spin_lock_irq(&mddev->write_lock); | 2177 | spin_lock_irq(&mddev->write_lock); |
| 2175 | 2178 | ||
| 2179 | mddev->utime = get_seconds(); | ||
| 2180 | |||
| 2176 | set_bit(MD_CHANGE_PENDING, &mddev->flags); | 2181 | set_bit(MD_CHANGE_PENDING, &mddev->flags); |
| 2177 | if (test_and_clear_bit(MD_CHANGE_DEVS, &mddev->flags)) | 2182 | if (test_and_clear_bit(MD_CHANGE_DEVS, &mddev->flags)) |
| 2178 | force_change = 1; | 2183 | force_change = 1; |
| @@ -2221,19 +2226,6 @@ repeat: | |||
| 2221 | MD_BUG(); | 2226 | MD_BUG(); |
| 2222 | mddev->events --; | 2227 | mddev->events --; |
| 2223 | } | 2228 | } |
| 2224 | |||
| 2225 | /* | ||
| 2226 | * do not write anything to disk if using | ||
| 2227 | * nonpersistent superblocks | ||
| 2228 | */ | ||
| 2229 | if (!mddev->persistent) { | ||
| 2230 | if (!mddev->external) | ||
| 2231 | clear_bit(MD_CHANGE_PENDING, &mddev->flags); | ||
| 2232 | |||
| 2233 | spin_unlock_irq(&mddev->write_lock); | ||
| 2234 | wake_up(&mddev->sb_wait); | ||
| 2235 | return; | ||
| 2236 | } | ||
| 2237 | sync_sbs(mddev, nospares); | 2229 | sync_sbs(mddev, nospares); |
| 2238 | spin_unlock_irq(&mddev->write_lock); | 2230 | spin_unlock_irq(&mddev->write_lock); |
| 2239 | 2231 | ||
