bcachefs: Run freespace init in device hot add path
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 23 Mar 2023 00:48:37 +0000 (20:48 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:58 +0000 (17:09 -0400)
Like in the recovery, and device add, we have to check if devices don't
have the freespace btree initialized - this was missed in the device hot
add path.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/super.c

index a209de24064cb116eb61cd3926e19e3910eb6736..265ffa9bfd4cf55bb9d03036ca517f922b2dfef3 100644 (file)
@@ -1743,6 +1743,10 @@ int bch2_dev_online(struct bch_fs *c, const char *path)
        bch2_write_super(c);
        mutex_unlock(&c->sb_lock);
 
+       ret = bch2_fs_freespace_init(c);
+       if (ret)
+               bch_err(c, "device add error: error initializing free space: %s", bch2_err_str(ret));
+
        up_write(&c->state_lock);
        return 0;
 err: