From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=109.224.244.106 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796396457; b=JXoazUvsXsYN2BFLPs0nvwBqTJSQl9+aFze7/r/v3HcXiALM+xdz08AyIEE6qzO4mycr RBS3B+1kltURbjdzToJGhxBxMAAGP7YG9YXJXBlTkMuNUkA7S07PQ6tl4yp0ojoS3EjCX j69C/rZIF86jJn1bXfX+9hPEm4wYRg74uw1k47czx+PK8nvsjoakfv3VIjyJJR3kNhR75 uux6krrUx2Aso/9LO4VgUcm0dBH/vltGaEzOxw8KS8q/p/T3IBkW3qZwzY4NWw7zUs/EK Za92/T6DqZoCRKgYpnnOswcIuieqq7FG1V/sGb6CM1a2l9F+h6kuqOKrgX0T+S0AZwQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796396457; h=DMARC-Filter:DKIM-Signature:X-Pm-Submission-Id:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=fnKR9FGvHkq1NTnQVJV13O8g1QZWiJkTDJTW2nfjTqA=; b=hhWXlJUq9iQnO6GkJRponm4GaSk1FgdjQXY28Eie/KCy6RCtqDFSd5VyQQ+zwFKzhaAN y9f0jZWAs0Q+1bNcNGUINVDvfOMk/4oHlpY8jaYaDcQhSjU3r7RtGIoSO9LPyX14ULJXp Z2JdJxdohTxOeNCyhmvHXUe7MpqPs0BF9uvQDGqPDHHY0TGxwqb5AYMM2OaiT0nJLa6Dy O1rAjhkrcsuuG+xz0n/OA028ecm9mVrPK58LPXrgKyyWm+Yu63N5TbIC0VaI4Dva6siN8 e81KbCmZb2SZ/IMoPFe4rPDGMW2l6JXVBhwmh8pXqpT133xCa5CoACKToWO4aj5pS8Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=raidlab.org; spf=pass smtp.mailfrom=raidlab.org; dkim=pass header.d=raidlab.org header.i=@raidlab.org header.a=rsa-sha256 header.s=protonmail header.b=1URkgcHA; arc=none smtp.remote-ip=109.224.244.106 Received: from mail-244106.protonmail.ch (mail-244106.protonmail.ch [109.224.244.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22665606A322; Fri, 4 Dec 2026 15:00:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 22665606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=raidlab.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raidlab.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=raidlab.org header.i=@raidlab.org header.a=rsa-sha256 header.s=protonmail header.b=1URkgcHA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raidlab.org; s=protonmail; t=1796396453; x=1796655653; bh=fnKR9FGvHkq1NTnQVJV13O8g1QZWiJkTDJTW2nfjTqA=; h=From:To:Cc:Subject:Date:Message-ID:From:To:Cc:Date:Subject: Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=1URkgcHA361OKCrt2EvqgriR8oOy0xGaT/3zJBWczuUP1FGu8BFhO2tQAejV2VQm4 Bv2PrUpl0Xl9kP9Td+eTg0JSpC5IhZPx9IO6Pl7J/O7fzar6MKLujbPKP41iDN0Ecs q7RcTqkwScKZJV0HYzEozJHeXwAw8Wa0p/37NVFnzNmxwjMlGPJxeNEOFb5DEyGUQA PgcwXmJCcpgb4AoZMpeAtwZ7Y4SiqFOkRgnsZLQNZJ5pbJBy2uy7ARxYtFspXYSlZY fuunHS5CKyrSMI39bKagu8SlyR5sUIulfIv4tYZfX4JNDytPmreN0Yr0pjmg5xEzbv +91zqpZL9Ogbw== X-Pm-Submission-Id: 4jgvnT3ttlz1DFFS From: Miroslav Cimerman To: Song Liu , Yu Kuai Cc: Li Nan , Xiao Ni , Tomasz Majchrzak , Shaohua Li , 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 Message-ID: <20261204150028.170721-1-mc@raidlab.org> X-Mailer: git-send-email 2.53.0 X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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