diff options
author | Matthias Kaehlcke <mka@chromium.org> | 2017-10-05 21:28:47 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-13 12:01:03 +0300 |
commit | 03df2c59562a2d8851fea32f833e48193f6cd8ad (patch) | |
tree | b510f29ec0b8e7b97d22ddddc77a79d73c9b28af | |
parent | 487467e7d031e73907c820ef05ce0d4d18c24767 (diff) | |
download | linux-03df2c59562a2d8851fea32f833e48193f6cd8ad.tar.xz |
md: raid10: remove VLAIS
commit 584ed9fa9532f8b9d5955628ff87ee3b2ab9f5a9 upstream.
The raid10 driver can't be built with clang since it uses a variable
length array in a structure (VLAIS):
drivers/md/raid10.c:4583:17: error: fields must have a constant size:
'variable length array in structure' extension will never be supported
Allocate the r10bio struct with kmalloc instead of using the VLAIS
construct.
Shaohua: set the MD_RECOVERY_INTR bit
Neil Brown: use GFP_NOIO
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/md/raid10.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index e786546bf3b8..52ddfa0fca94 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -4591,15 +4591,18 @@ static int handle_reshape_read_error(struct mddev *mddev, /* Use sync reads to get the blocks from somewhere else */ int sectors = r10_bio->sectors; struct r10conf *conf = mddev->private; - struct { - struct r10bio r10_bio; - struct r10dev devs[conf->copies]; - } on_stack; - struct r10bio *r10b = &on_stack.r10_bio; + struct r10bio *r10b; int slot = 0; int idx = 0; struct page **pages; + r10b = kmalloc(sizeof(*r10b) + + sizeof(struct r10dev) * conf->copies, GFP_NOIO); + if (!r10b) { + set_bit(MD_RECOVERY_INTR, &mddev->recovery); + return -ENOMEM; + } + /* reshape IOs share pages from .devs[0].bio */ pages = get_resync_pages(r10_bio->devs[0].bio)->pages; @@ -4648,11 +4651,13 @@ static int handle_reshape_read_error(struct mddev *mddev, /* couldn't read this block, must give up */ set_bit(MD_RECOVERY_INTR, &mddev->recovery); + kfree(r10b); return -EIO; } sectors -= s; idx++; } + kfree(r10b); return 0; } |