]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
md/raid5: suspend the array for calls to log_exit()
authorLogan Gunthorpe <logang@deltatee.com>
Wed, 8 Jun 2022 16:27:49 +0000 (10:27 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 2 Aug 2022 23:14:31 +0000 (17:14 -0600)
The raid5-cache code relies on there being no IO in flight when
log_exit() is called. There are two places where this is not
guaranteed so add mddev_suspend() and mddev_resume() calls to these
sites.

The site in raid5_change_consistency_policy() is in the error path,
and another similar call site already has suspend/resume calls just
below it; so it should be equally safe to make that change here.

There is one remaining site in raid5_remove_disk() that we call log_exit()
without suspending the array. Unfortunately, as the comment stated, we
cannot call mddev_suspend from raid5d.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/raid5.c

index 5cabdbbac48bd57fd222c04e71905bdfe0990e8e..9950f576a34ee7c184f66b0c18be70e726d42512 100644 (file)
@@ -8704,8 +8704,11 @@ static int raid5_change_consistency_policy(struct mddev *mddev, const char *buf)
                        err = log_init(conf, NULL, true);
                        if (!err) {
                                err = resize_stripes(conf, conf->pool_size);
-                               if (err)
+                               if (err) {
+                                       mddev_suspend(mddev);
                                        log_exit(conf);
+                                       mddev_resume(mddev);
+                               }
                        }
                } else
                        err = -EINVAL;