Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Miroslav Cimerman <mc@raidlab.org>
To: Song Liu <song@kernel.org>, Yu Kuai <yukuai@fygo.io>
Cc: Li Nan <magiclinan@didiglobal.com>, Xiao Ni <xiao@kernel.org>,
	Tomasz Majchrzak <tomasz.majchrzak@intel.com>,
	Shaohua Li <sh.li@alibaba-inc.com>,
	linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] md/raid5-ppl: flush the member disks for a flush request
Date: Fri,  4 Dec 2026 15:00:28 +0000	[thread overview]
Message-ID: <20261204150028.170721-1-mc@raidlab.org> (raw)

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


                 reply	other threads:[~2026-12-04 15:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261204150028.170721-1-mc@raidlab.org \
    --to=mc@raidlab.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=magiclinan@didiglobal.com \
    --cc=sh.li@alibaba-inc.com \
    --cc=song@kernel.org \
    --cc=tomasz.majchrzak@intel.com \
    --cc=xiao@kernel.org \
    --cc=yukuai@fygo.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox