Commit f548db4d312a for kernel

commit f548db4d312a4d71e4f65cc43c724cfd46784ab8
Author: Kent Overstreet <kent.overstreet@linux.dev>
Date:   Sat Mar 29 20:02:44 2025 -0400

    bcachefs: Silence errors after emergency shutdown

    We don't care about errors from asynchronous ops that were because we
    did an emergency shutdown; silence them.

    Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c
index 987fdfc043b8..bf7e1dac7f46 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -1268,7 +1268,8 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path,
 	bch2_btree_update_free(as, trans);
 	if (!bch2_err_matches(ret, ENOSPC) &&
 	    !bch2_err_matches(ret, EROFS) &&
-	    ret != -BCH_ERR_journal_reclaim_would_deadlock)
+	    ret != -BCH_ERR_journal_reclaim_would_deadlock &&
+	    ret != -BCH_ERR_journal_shutdown)
 		bch_err_fn_ratelimited(c, ret);
 	return ERR_PTR(ret);
 }
@@ -2302,7 +2303,9 @@ static void async_btree_node_rewrite_work(struct work_struct *work)

 	int ret = bch2_trans_do(c, bch2_btree_node_rewrite_key(trans,
 						a->btree_id, a->level, a->key.k, 0));
-	if (ret != -ENOENT)
+	if (ret != -ENOENT &&
+	    !bch2_err_matches(ret, EROFS) &&
+	    ret != -BCH_ERR_journal_shutdown)
 		bch_err_fn_ratelimited(c, ret);

 	spin_lock(&c->btree_node_rewrites_lock);
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index 24eaec1d406c..f461cb06df90 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -1623,7 +1623,8 @@ static CLOSURE_CALLBACK(journal_write_done)
 			       : j->noflush_write_time, j->write_start_time);

 	if (!w->devs_written.nr) {
-		bch_err(c, "unable to write journal to sufficient devices");
+		if (!bch2_journal_error(j))
+			bch_err(c, "unable to write journal to sufficient devices");
 		err = -BCH_ERR_journal_write_err;
 	} else {
 		bch2_devlist_to_replicas(&replicas.e, BCH_DATA_journal,