Skip to contentSkip to conversation

bcachefs: Add missing error handling

PATCH In review Alan Huang 2 participants 3 messages Apr 12, 2025 – Apr 13, 2025

lore
Share & tools
lore

Alan Huang

author
#0 lore raw

PATCH 1/1 bcachefs: Add missing error handling

---
 fs/bcachefs/recovery.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/bcachefs/recovery.c +4 -1
index d2b07f602da9..606d684e6f23 100644
@@ -1125,7 +1125,10 @@ int bch2_fs_initialize(struct bch_fs *c)
 	 * journal_res_get() will crash if called before this has
 	 * set up the journal.pin FIFO and journal.cur pointer:
 	 */
-	bch2_fs_journal_start(&c->journal, 1);
+	ret = bch2_fs_journal_start(&c->journal, 1);
+	if (ret)
+		goto err;
+
 	set_bit(BCH_FS_accounting_replay_done, &c->flags);
 	bch2_journal_set_replay_done(&c->journal);
 
Signature · 1 line
2.48.1
#1 lore raw
Quoted 2 lines · Alan Huang

This was a silly mistake.

In the past I've thought about going through and marking huge swaths of functions as __must_check, maybe that would actually be worth doing?

Quoted 23 lines
---
 fs/bcachefs/recovery.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/bcachefs/recovery.c +4 -1
index d2b07f602da9..606d684e6f23 100644
@@ -1125,7 +1125,10 @@ int bch2_fs_initialize(struct bch_fs *c)
 	 * journal_res_get() will crash if called before this has
 	 * set up the journal.pin FIFO and journal.cur pointer:
 	 */
-	bch2_fs_journal_start(&c->journal, 1);
+	ret = bch2_fs_journal_start(&c->journal, 1);
+	if (ret)
+		goto err;
+
 	set_bit(BCH_FS_accounting_replay_done, &c->flags);
 	bch2_journal_set_replay_done(&c->journal);
 
Signature · 1 line
2.48.1
author
#2 lore raw
Quoted 9 lines · Kent Overstreet
Quoted 2 lines · Alan Huang

This was a silly mistake.

In the past I've thought about going through and marking huge swaths of functions as __must_check, maybe that would actually be worth doing?

Yeah, that’s a good idea.

Quoted 24 lines
Quoted 24 lines

---
fs/bcachefs/recovery.c | 5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)
fs/bcachefs/recovery.c +4 -1
index d2b07f602da9..606d684e6f23 100644
@@ -1125,7 +1125,10 @@ int bch2_fs_initialize(struct bch_fs *c)
 * journal_res_get() will crash if called before this has
 * set up the journal.pin FIFO and journal.cur pointer:
 */
- bch2_fs_journal_start(&c->journal, 1);
+ ret = bch2_fs_journal_start(&c->journal, 1);
+ if (ret)
+ goto err;
+
 set_bit(BCH_FS_accounting_replay_done, &c->flags);
 bch2_journal_set_replay_done(&c->journal);
 
Signature · 1 line
2.48.1