Commit 50c37b13 authored by NeilBrown's avatar NeilBrown

md: don't require sync_min to be a multiple of chunk_size.

There is really no need for sync_min to be a multiple of
chunk_size, and values read from here often aren't.
That means you cannot read a value and expect to be able
to write it back later.

So remove the chunk_size check, and round down to a multiple
of 4K, to be sure everything works with 4K-sector devices.
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent d51e4fe6
...@@ -4427,7 +4427,6 @@ min_sync_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -4427,7 +4427,6 @@ min_sync_store(struct mddev *mddev, const char *buf, size_t len)
{ {
unsigned long long min; unsigned long long min;
int err; int err;
int chunk;
if (kstrtoull(buf, 10, &min)) if (kstrtoull(buf, 10, &min))
return -EINVAL; return -EINVAL;
...@@ -4441,16 +4440,8 @@ min_sync_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -4441,16 +4440,8 @@ min_sync_store(struct mddev *mddev, const char *buf, size_t len)
if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
goto out_unlock; goto out_unlock;
/* Must be a multiple of chunk_size */ /* Round down to multiple of 4K for safety */
chunk = mddev->chunk_sectors; mddev->resync_min = round_down(min, 8);
if (chunk) {
sector_t temp = min;
err = -EINVAL;
if (sector_div(temp, chunk))
goto out_unlock;
}
mddev->resync_min = min;
err = 0; err = 0;
out_unlock: out_unlock:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment