diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c index f5b46f382340..2defa811f48f 100644 --- a/fs/bcachefs/btree_gc.c +++ b/fs/bcachefs/btree_gc.c @@ -1976,10 +1976,10 @@ int bch2_gc_gens(struct bch_fs *c) NULL, NULL, BTREE_INSERT_NOFAIL, gc_btree_gens_key(&trans, &iter, k)); - if (ret) { + if (ret && ret != -EROFS) bch_err(c, "error recalculating oldest_gen: %s", bch2_err_str(ret)); + if (ret) goto err; - } } ret = for_each_btree_key_commit(&trans, iter, BTREE_ID_alloc, @@ -1989,10 +1989,10 @@ int bch2_gc_gens(struct bch_fs *c) NULL, NULL, BTREE_INSERT_NOFAIL, bch2_alloc_write_oldest_gen(&trans, &iter, k)); - if (ret) { + if (ret && ret != -EROFS) bch_err(c, "error writing oldest_gen: %s", bch2_err_str(ret)); + if (ret) goto err; - } c->gc_gens_btree = 0; c->gc_gens_pos = POS_MIN; diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c index 491fad4dfb28..27265ba35fac 100644 --- a/fs/bcachefs/io.c +++ b/fs/bcachefs/io.c @@ -675,15 +675,17 @@ static void __bch2_write_index(struct bch_write_op *op) op->written += sectors_start - keylist_sectors(keys); - if (ret) { + if (ret && !bch2_err_matches(ret, EROFS)) { struct bkey_i *k = bch2_keylist_front(&op->insert_keys); bch_err_inum_offset_ratelimited(c, k->k.p.inode, k->k.p.offset << 9, "write error while doing btree update: %s", bch2_err_str(ret)); - goto err; } + + if (ret) + goto err; } out: /* If some a bucket wasn't written, we can't erasure code it: */ diff --git a/fs/bcachefs/movinggc.c b/fs/bcachefs/movinggc.c index 09f4303de1f6..66f18f711d53 100644 --- a/fs/bcachefs/movinggc.c +++ b/fs/bcachefs/movinggc.c @@ -319,7 +319,7 @@ static int bch2_copygc(struct bch_fs *c) writepoint_ptr(&c->copygc_write_point), false, copygc_pred, NULL); - if (ret < 0) + if (ret < 0 && ret != -EROFS) bch_err(c, "error from bch2_move_data() in copygc: %s", bch2_err_str(ret)); if (ret) return ret;