From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-eopbgr710090.outbound.protection.outlook.com ([40.107.71.90]:26752 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733152AbeIXUvk (ORCPT ); Mon, 24 Sep 2018 16:51:40 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Shaohua Li , Sasha Levin Subject: [PATCH AUTOSEL 4.18 45/76] md/raid5-cache: disable reshape completely Date: Mon, 24 Sep 2018 14:48:29 +0000 Message-ID: <20180924144751.164410-44-alexander.levin@microsoft.com> References: <20180924144751.164410-1-alexander.levin@microsoft.com> In-Reply-To: <20180924144751.164410-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Shaohua Li [ Upstream commit e254de6bcf3f5b6e78a92ac95fb91acef8adfe1a ] We don't support reshape yet if an array supports log device. Previously we determine the fact by checking ->log. However, ->log could be NULL after a = log device is removed, but the array is still marked to support log device. Don= 't allow reshape in this case too. User can disable log device support by sett= ing 'consistency_policy' to 'resync' then do reshape. Reported-by: Xiao Ni Tested-by: Xiao Ni Signed-off-by: Shaohua Li Signed-off-by: Sasha Levin --- drivers/md/raid5-log.h | 5 +++++ drivers/md/raid5.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/md/raid5-log.h b/drivers/md/raid5-log.h index a001808a2b77..bfb811407061 100644 --- a/drivers/md/raid5-log.h +++ b/drivers/md/raid5-log.h @@ -46,6 +46,11 @@ extern int ppl_modify_log(struct r5conf *conf, struct md= _rdev *rdev, bool add); extern void ppl_quiesce(struct r5conf *conf, int quiesce); extern int ppl_handle_flush_request(struct r5l_log *log, struct bio *bio); =20 +static inline bool raid5_has_log(struct r5conf *conf) +{ + return test_bit(MD_HAS_JOURNAL, &conf->mddev->flags); +} + static inline bool raid5_has_ppl(struct r5conf *conf) { return test_bit(MD_HAS_PPL, &conf->mddev->flags); diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 49107c52c8e6..9050bfc71309 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -735,7 +735,7 @@ static bool stripe_can_batch(struct stripe_head *sh) { struct r5conf *conf =3D sh->raid_conf; =20 - if (conf->log || raid5_has_ppl(conf)) + if (raid5_has_log(conf) || raid5_has_ppl(conf)) return false; return test_bit(STRIPE_BATCH_READY, &sh->state) && !test_bit(STRIPE_BITMAP_PENDING, &sh->state) && @@ -7739,7 +7739,7 @@ static int raid5_resize(struct mddev *mddev, sector_t= sectors) sector_t newsize; struct r5conf *conf =3D mddev->private; =20 - if (conf->log || raid5_has_ppl(conf)) + if (raid5_has_log(conf) || raid5_has_ppl(conf)) return -EINVAL; sectors &=3D ~((sector_t)conf->chunk_sectors - 1); newsize =3D raid5_size(mddev, sectors, mddev->raid_disks); @@ -7790,7 +7790,7 @@ static int check_reshape(struct mddev *mddev) { struct r5conf *conf =3D mddev->private; =20 - if (conf->log || raid5_has_ppl(conf)) + if (raid5_has_log(conf) || raid5_has_ppl(conf)) return -EINVAL; if (mddev->delta_disks =3D=3D 0 && mddev->new_layout =3D=3D mddev->layout && --=20 2.17.1