summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/fs-io.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-01-11 08:36:55 +0100
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-22 12:37:51 -0500
commit3e44f325f6f75078cdcd44cd337f517ba3650d05 (patch)
treed695962261fe0027d03e0eca07a33598c4bc5bd8 /fs/bcachefs/fs-io.c
parent612e1110d689387aab81b2727895cd307d3cbbfd (diff)
downloadlinux-stable-3e44f325f6f75078cdcd44cd337f517ba3650d05.tar.gz
linux-stable-3e44f325f6f75078cdcd44cd337f517ba3650d05.tar.bz2
linux-stable-3e44f325f6f75078cdcd44cd337f517ba3650d05.zip
bcachefs: fix incorrect usage of REQ_OP_FLUSH
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>
Diffstat (limited to 'fs/bcachefs/fs-io.c')
-rw-r--r--fs/bcachefs/fs-io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index dc52918d06ef..8c70123b6a0c 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -79,7 +79,7 @@ void bch2_inode_flush_nocow_writes_async(struct bch_fs *c,
continue;
bio = container_of(bio_alloc_bioset(ca->disk_sb.bdev, 0,
- REQ_OP_FLUSH,
+ REQ_OP_WRITE|REQ_PREFLUSH,
GFP_KERNEL,
&c->nocow_flush_bioset),
struct nocow_flush, bio);