linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Zhou Jifeng" <zhoujifeng@kylinos.com.cn>
To: "Kent Overstreet" <kent.overstreet@linux.dev>
Cc: "Coly Li" <colyli@kernel.org>,
	linux-bcache <linux-bcache@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] bcache: enhancing the security of dirty data writeback
Date: Fri, 1 Aug 2025 11:30:43 +0800	[thread overview]
Message-ID: <tencent_22DE1AC52BA931BD442CE823@qq.com> (raw)
In-Reply-To: <zcxdklyr2ugq7cfbed4olcsfcboy3nksxtpjs2g76bauvef5cq@4akbspw3ydiw>

On Fri, 1 Aug 2025 at 10:37, Kent Overstreet <kent.overstreet@linux.dev> wrote:
>
> On Fri, Aug 01, 2025 at 10:27:21AM +0800, Zhou Jifeng wrote:
> > In the writeback mode, the current bcache code uses the
> > REQ_OP_WRITE operation to handle dirty data, and clears the bkey
> > dirty flag in the btree during the bio completion callback. I think
> > there might be a potential risk: if in the event of an unexpected
> > power outage, the data in the HDD hardware cache may not have
> > had time to be persisted, then the data in the HDD hardware cache
> > that is pending processing may be lost. Since at this time the bkey
> > dirty flag in the btree has been cleared, the data status recorded
> > by the bkey does not match the actual situation of the SSD and
> > HDD.
> > Am I understanding this correctly?
>
> For what you're describing, we need to make sure the backing device is
> flushed when we're flushing the journal.
>
> It's possible that this isn't handled correctly in bcache; bcachefs
> does, and I wrote that code after bcache - but the bcache version would
> look quite different.
>
> You've read that code more recently than I have - have you checked for
> that?

In the `write_dirty_finish` function, there is an attempt to update the
`bkey` status, but I did not observe any logging writing process. In the
core function `journal_write_unlocked` of bcache for writing logs, I
also couldn't find the code logic for sending a FLUSH command to the
backend HDD.

  reply	other threads:[~2025-08-01  3:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31  6:21 [PATCH] bcache: enhancing the security of dirty data writeback Zhou Jifeng
2025-07-31 15:49 ` Kent Overstreet
2025-08-01  2:27   ` Zhou Jifeng
2025-08-01  2:37     ` Kent Overstreet
2025-08-01  3:30       ` Zhou Jifeng [this message]
2025-08-01  3:41         ` Kent Overstreet
2025-08-01  6:10           ` Zhou Jifeng
2025-08-02 17:29             ` Coly Li
2025-08-02 18:49               ` Kent Overstreet
2025-08-04  3:47               ` Zhou Jifeng
2025-08-04  4:17                 ` Kent Overstreet
2025-08-04 15:31                   ` Coly Li
2025-08-04 16:07                     ` Kent Overstreet
2025-08-05  1:17                       ` Zhou Jifeng
2025-08-05  1:31                         ` Kent Overstreet
2025-08-05  3:31                           ` Coly Li
2025-08-05  3:34                             ` Kent Overstreet
2025-08-05  4:57 ` Coly Li
2025-08-05  9:37   ` Zhou Jifeng
2025-08-05 16:29     ` Coly Li
2025-08-06 11:19       ` Zhou Jifeng
2025-08-06 16:10         ` Coly Li
2025-08-07  2:01           ` Zhou Jifeng
2025-08-13  2:12             ` [PATCH v2] " Zhou Jifeng
2025-08-13  7:11               ` Zhou Jifeng

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=tencent_22DE1AC52BA931BD442CE823@qq.com \
    --to=zhoujifeng@kylinos.com.cn \
    --cc=colyli@kernel.org \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).