summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-08-29 01:38:29 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2020-08-29 01:38:29 +0200
commit4d41ead6ead97c3730bbd186a601a64828668f01 (patch)
tree55f4f0b65e35085e65653d79f12d690383dfe735 /drivers/md
parentMerge tag 'io_uring-5.9-2020-08-28' of git://git.kernel.dk/linux-block (diff)
parentMerge branch 'md-fixes' of https://git.kernel.org/pub/scm/linux/kernel/git/so... (diff)
downloadlinux-4d41ead6ead97c3730bbd186a601a64828668f01.tar.xz
linux-4d41ead6ead97c3730bbd186a601a64828668f01.zip
Merge tag 'block-5.9-2020-08-28' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: - nbd timeout fix (Hou) - device size fix for loop LOOP_CONFIGURE (Martijn) - MD pull from Song with raid5 stripe size fix (Yufen) * tag 'block-5.9-2020-08-28' of git://git.kernel.dk/linux-block: md/raid5: make sure stripe_size as power of two loop: Set correct device size when using LOOP_CONFIGURE nbd: restore default timeout when setting it to zero
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid5.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 8b743657b957..225380efd1e2 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -6514,9 +6514,12 @@ raid5_store_stripe_size(struct mddev *mddev, const char *page, size_t len)
/*
* The value should not be bigger than PAGE_SIZE. It requires to
- * be multiple of DEFAULT_STRIPE_SIZE.
+ * be multiple of DEFAULT_STRIPE_SIZE and the value should be power
+ * of two.
*/
- if (new % DEFAULT_STRIPE_SIZE != 0 || new > PAGE_SIZE || new == 0)
+ if (new % DEFAULT_STRIPE_SIZE != 0 ||
+ new > PAGE_SIZE || new == 0 ||
+ new != roundup_pow_of_two(new))
return -EINVAL;
err = mddev_lock(mddev);