]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bcachefs: fix incorrect usage of REQ_OP_FLUSH
authorChristoph Hellwig <hch@lst.de>
Thu, 11 Jan 2024 07:36:55 +0000 (08:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Feb 2024 18:14:31 +0000 (19:14 +0100)
commit4571eb9bead1116305cb4910b224836770dce4bb
treeb81e1db01b6282d491236777eb962efb9180a9f4
parent5b41d3fd04c6757b9c2a60a0c5b2609cae9999df
bcachefs: fix incorrect usage of REQ_OP_FLUSH

commit 3e44f325f6f75078cdcd44cd337f517ba3650d05 upstream.

REQ_OP_FLUSH is only for internal use in the blk-mq and request based
drivers. File systems and other block layer consumers must use
REQ_OP_WRITE | REQ_PREFLUSH as documented in
Documentation/block/writeback_cache_control.rst.

While REQ_OP_FLUSH appears to work for blk-mq drivers it does not
get the proper flush state machine handling, and completely fails
for any bio based drivers, including all the stacking drivers.  The
block layer will also get a check in 6.8 to reject this use case
entirely.

[Note: completely untested, but as this never got fixed since the
original bug report in November:

   https://bugzilla.kernel.org/show_bug.cgi?id=218184

and the the discussion in December:

    https://lore.kernel.org/all/20231221053016.72cqcfg46vxwohcj@moria.home.lan/T/

this seems to be best way to force it]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/bcachefs/fs-io.c
fs/bcachefs/journal_io.c