Linux RAID subsystem development
 help / color / mirror / Atom feed
* [PATCH] md/raid5-ppl: flush the member disks for a flush request
@ 2026-12-04 15:00 Miroslav Cimerman
  0 siblings, 0 replies; only message in thread
From: Miroslav Cimerman @ 2026-12-04 15:00 UTC (permalink / raw)
  To: Song Liu, Yu Kuai
  Cc: Li Nan, Xiao Ni, Tomasz Majchrzak, Shaohua Li, linux-raid,
	linux-kernel

With PPL, ppl_handle_flush_request() completes an empty flush at once
and clears REQ_PREFLUSH on a write with data. Neither sends a flush to
the member disks. Commit 1532d9e87e8b ("raid5-ppl: PPL support for disks
with write-back cache enabled") did this because "PPL assures all data
is flushed to disk at request completion". PPL does not do that in two
cases:

- handle_stripe_clean_event() completes the write bios before
  log_stripe_write_finished() starts the PPL flush of the members.
- A stripe whose parity disk is not in sync, for example on a degraded
  array, gets no PPL entry, and PPL starts no flush for it.

In both cases, an fsync can return while the data is still in the
volatile caches of the members, and a power failure loses it.

Remove ppl_handle_flush_request(). Flush requests then go to
md_flush_request(), the same path that raid5 without a log uses.

Found with FuzzyRAID, a fault injection tester for RAID.

Fixes: 1532d9e87e8b ("raid5-ppl: PPL support for disks with write-back cache enabled")
Cc: stable@vger.kernel.org
Signed-off-by: Miroslav Cimerman <mc@raidlab.org>
---
Reproduced on md-7.5 with null_blk members that have a volatile cache:
a degraded RAID5 with PPL, a 4 KiB O_DIRECT write and fsync to a stripe
whose parity disk is missing, then a power-off of the members. Without
this patch, the block reads back zeros. With it, the block keeps the
new data.

The cost is one more flush per member disk per flush request, the same
as on raid5 without a log.

Prepared with help from an LLM.

 drivers/md/raid5-log.h |  3 ---
 drivers/md/raid5-ppl.c | 10 ----------
 2 files changed, 13 deletions(-)

diff --git a/drivers/md/raid5-log.h b/drivers/md/raid5-log.h
index c8332502669e..13668aa9b2c2 100644
--- a/drivers/md/raid5-log.h
+++ b/drivers/md/raid5-log.h
@@ -41,7 +41,6 @@ void ppl_write_stripe_run(struct r5conf *conf);
 void ppl_stripe_write_finished(struct stripe_head *sh);
 int ppl_modify_log(struct r5conf *conf, struct md_rdev *rdev, bool add);
 void ppl_quiesce(struct r5conf *conf, int quiesce);
-int ppl_handle_flush_request(struct bio *bio);
 extern struct md_sysfs_entry ppl_write_hint;
 
 static inline bool raid5_has_log(struct r5conf *conf)
@@ -107,8 +106,6 @@ static inline int log_handle_flush_request(struct r5conf *conf, struct bio *bio)
 
 	if (conf->log)
 		ret = r5l_handle_flush_request(conf->log, bio);
-	else if (raid5_has_ppl(conf))
-		ret = ppl_handle_flush_request(bio);
 
 	return ret;
 }
diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c
index 0530632f9d2a..1f824f484b96 100644
--- a/drivers/md/raid5-ppl.c
+++ b/drivers/md/raid5-ppl.c
@@ -679,16 +679,6 @@ void ppl_quiesce(struct r5conf *conf, int quiesce)
 	}
 }
 
-int ppl_handle_flush_request(struct bio *bio)
-{
-	if (bio->bi_iter.bi_size == 0) {
-		bio_endio(bio);
-		return 0;
-	}
-	bio->bi_opf &= ~REQ_PREFLUSH;
-	return -EAGAIN;
-}
-
 void ppl_stripe_write_finished(struct stripe_head *sh)
 {
 	struct ppl_io_unit *io;

base-commit: c526b7cd32f75fea6021ffdab287b81cf38ddeb7
-- 
2.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-04 15:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 15:00 [PATCH] md/raid5-ppl: flush the member disks for a flush request Miroslav Cimerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox