Skip to content

Commit e254de6

Browse files
committed
md/raid5-cache: disable reshape completely
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 setting 'consistency_policy' to 'resync' then do reshape. Reported-by: Xiao Ni <xni@redhat.com> Tested-by: Xiao Ni <xni@redhat.com> Signed-off-by: Shaohua Li <shli@fb.com>
1 parent 420f51f commit e254de6

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

drivers/md/raid5-log.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ extern int ppl_modify_log(struct r5conf *conf, struct md_rdev *rdev, bool add);
4646
extern void ppl_quiesce(struct r5conf *conf, int quiesce);
4747
extern int ppl_handle_flush_request(struct r5l_log *log, struct bio *bio);
4848

49+
static inline bool raid5_has_log(struct r5conf *conf)
50+
{
51+
return test_bit(MD_HAS_JOURNAL, &conf->mddev->flags);
52+
}
53+
4954
static inline bool raid5_has_ppl(struct r5conf *conf)
5055
{
5156
return test_bit(MD_HAS_PPL, &conf->mddev->flags);

drivers/md/raid5.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ static bool stripe_can_batch(struct stripe_head *sh)
733733
{
734734
struct r5conf *conf = sh->raid_conf;
735735

736-
if (conf->log || raid5_has_ppl(conf))
736+
if (raid5_has_log(conf) || raid5_has_ppl(conf))
737737
return false;
738738
return test_bit(STRIPE_BATCH_READY, &sh->state) &&
739739
!test_bit(STRIPE_BITMAP_PENDING, &sh->state) &&
@@ -7737,7 +7737,7 @@ static int raid5_resize(struct mddev *mddev, sector_t sectors)
77377737
sector_t newsize;
77387738
struct r5conf *conf = mddev->private;
77397739

7740-
if (conf->log || raid5_has_ppl(conf))
7740+
if (raid5_has_log(conf) || raid5_has_ppl(conf))
77417741
return -EINVAL;
77427742
sectors &= ~((sector_t)conf->chunk_sectors - 1);
77437743
newsize = raid5_size(mddev, sectors, mddev->raid_disks);
@@ -7788,7 +7788,7 @@ static int check_reshape(struct mddev *mddev)
77887788
{
77897789
struct r5conf *conf = mddev->private;
77907790

7791-
if (conf->log || raid5_has_ppl(conf))
7791+
if (raid5_has_log(conf) || raid5_has_ppl(conf))
77927792
return -EINVAL;
77937793
if (mddev->delta_disks == 0 &&
77947794
mddev->new_layout == mddev->layout &&

0 commit comments

Comments
 (0)