diff options
author | NeilBrown <neilb@suse.de> | 2011-01-13 17:14:34 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-01-13 17:14:34 -0500 |
commit | 75d3da43cb74d2e5fb87816dbfecb839cd97c7f4 (patch) | |
tree | 27074aceb801ada315329591f32c938b36150ed9 /drivers | |
parent | a6ff7e089c7fca813c956ccbed824087e89a3a49 (diff) |
md: Don't let implementation detail of curr_resync leak out through sysfs.
mddev->curr_resync has artificial values of '1' and '2' which are used
by the code which ensures only one resync is happening at a time on
any given device.
These values are internal and should never be exposed to user-space
(except when translated appropriately as in the 'pending' status in
/proc/mdstat).
Unfortunately they are as ->curr_resync is assigned to
->curr_resync_completed and that value is directly visible through
sysfs.
So change the assignments to ->curr_resync_completed to get the same
valued from elsewhere in a form that doesn't have the magic '1' or '2'
values.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/bitmap.c | 2 | ||||
-rw-r--r-- | drivers/md/md.c | 5 | ||||
-rw-r--r-- | drivers/md/raid5.c | 4 |
3 files changed, 5 insertions, 6 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 6cf587196b99..9a35320fb59f 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -1546,7 +1546,7 @@ void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector) | |||
1546 | wait_event(bitmap->mddev->recovery_wait, | 1546 | wait_event(bitmap->mddev->recovery_wait, |
1547 | atomic_read(&bitmap->mddev->recovery_active) == 0); | 1547 | atomic_read(&bitmap->mddev->recovery_active) == 0); |
1548 | 1548 | ||
1549 | bitmap->mddev->curr_resync_completed = bitmap->mddev->curr_resync; | 1549 | bitmap->mddev->curr_resync_completed = sector; |
1550 | set_bit(MD_CHANGE_CLEAN, &bitmap->mddev->flags); | 1550 | set_bit(MD_CHANGE_CLEAN, &bitmap->mddev->flags); |
1551 | sector &= ~((1ULL << CHUNK_BLOCK_SHIFT(bitmap)) - 1); | 1551 | sector &= ~((1ULL << CHUNK_BLOCK_SHIFT(bitmap)) - 1); |
1552 | s = 0; | 1552 | s = 0; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index b98a85fd10b6..42b1d9ead7f2 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -6824,7 +6824,7 @@ void md_do_sync(mddev_t *mddev) | |||
6824 | desc, mdname(mddev)); | 6824 | desc, mdname(mddev)); |
6825 | mddev->curr_resync = j; | 6825 | mddev->curr_resync = j; |
6826 | } | 6826 | } |
6827 | mddev->curr_resync_completed = mddev->curr_resync; | 6827 | mddev->curr_resync_completed = j; |
6828 | 6828 | ||
6829 | while (j < max_sectors) { | 6829 | while (j < max_sectors) { |
6830 | sector_t sectors; | 6830 | sector_t sectors; |
@@ -6842,8 +6842,7 @@ void md_do_sync(mddev_t *mddev) | |||
6842 | md_unplug(mddev); | 6842 | md_unplug(mddev); |
6843 | wait_event(mddev->recovery_wait, | 6843 | wait_event(mddev->recovery_wait, |
6844 | atomic_read(&mddev->recovery_active) == 0); | 6844 | atomic_read(&mddev->recovery_active) == 0); |
6845 | mddev->curr_resync_completed = | 6845 | mddev->curr_resync_completed = j; |
6846 | mddev->curr_resync; | ||
6847 | set_bit(MD_CHANGE_CLEAN, &mddev->flags); | 6846 | set_bit(MD_CHANGE_CLEAN, &mddev->flags); |
6848 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); | 6847 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); |
6849 | } | 6848 | } |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 9212c077095c..d223a6c0ccc4 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -4236,7 +4236,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped | |||
4236 | wait_event(conf->wait_for_overlap, | 4236 | wait_event(conf->wait_for_overlap, |
4237 | atomic_read(&conf->reshape_stripes)==0); | 4237 | atomic_read(&conf->reshape_stripes)==0); |
4238 | mddev->reshape_position = conf->reshape_progress; | 4238 | mddev->reshape_position = conf->reshape_progress; |
4239 | mddev->curr_resync_completed = mddev->curr_resync; | 4239 | mddev->curr_resync_completed = sector_nr; |
4240 | conf->reshape_checkpoint = jiffies; | 4240 | conf->reshape_checkpoint = jiffies; |
4241 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 4241 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
4242 | md_wakeup_thread(mddev->thread); | 4242 | md_wakeup_thread(mddev->thread); |
@@ -4337,7 +4337,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped | |||
4337 | wait_event(conf->wait_for_overlap, | 4337 | wait_event(conf->wait_for_overlap, |
4338 | atomic_read(&conf->reshape_stripes) == 0); | 4338 | atomic_read(&conf->reshape_stripes) == 0); |
4339 | mddev->reshape_position = conf->reshape_progress; | 4339 | mddev->reshape_position = conf->reshape_progress; |
4340 | mddev->curr_resync_completed = mddev->curr_resync + reshape_sectors; | 4340 | mddev->curr_resync_completed = sector_nr; |
4341 | conf->reshape_checkpoint = jiffies; | 4341 | conf->reshape_checkpoint = jiffies; |
4342 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 4342 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
4343 | md_wakeup_thread(mddev->thread); | 4343 | md_wakeup_thread(mddev->thread); |