aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <[email protected]>2020-08-03 13:58:36 -0400
committerKent Overstreet <[email protected]>2023-10-22 17:08:43 -0400
commit768b42a7eb91b556cfe7c467c0e7337602eb6f29 (patch)
treede46e4da586f23d63eeb0553a6bb746aa66cc264
parent79e72a90936e9d19caf0ced4113e8d7659ebb2af (diff)
bcachefs: Don't disallow btree writes to RO devices
There's an inherent race with setting devices RO when they have dirty btree nodes on them. We already check if a btree node is on an RO device before we dirty it, so this patch just allows those writes so that we don't have errors forcing the entire filesystem read only when trying to remove a device. Signed-off-by: Kent Overstreet <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
-rw-r--r--fs/bcachefs/io.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index d9e35329f707..0f4c5c3c408c 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -481,7 +481,8 @@ void bch2_submit_wbio_replicas(struct bch_write_bio *wbio, struct bch_fs *c,
n->c = c;
n->dev = ptr->dev;
- n->have_ioref = bch2_dev_get_ioref(ca, WRITE);
+ n->have_ioref = bch2_dev_get_ioref(ca,
+ type == BCH_DATA_btree ? READ : WRITE);
n->submit_time = local_clock();
n->bio.bi_iter.bi_sector = ptr->offset;