]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
Update bcachefs sources to 367a8fad45 bcachefs: Reset journal flush delay to default...
authorKent Overstreet <kent.overstreet@gmail.com>
Mon, 21 Mar 2022 07:06:23 +0000 (03:06 -0400)
committerKent Overstreet <kent.overstreet@gmail.com>
Mon, 21 Mar 2022 07:06:23 +0000 (03:06 -0400)
.bcachefs_revision
libbcachefs/journal_io.c
libbcachefs/opts.c
libbcachefs/super-io.c

index 3072ae814f4130934d8bbc4a5fead2c0a37297c9..9f55ecef644c900d15df1faea5ad6eaff87ecd01 100644 (file)
@@ -1 +1 @@
-0e705f5944069d3ded1d9238f7805dd210e79a25
+367a8fad45924ce9fbe808964d1783c391a11bea
index fca9bc47b889cee09a8faa32588d99e93de5aa77..e61b88930a7f007d872a8d120d0f7d7f7b899fed 100644 (file)
@@ -966,8 +966,16 @@ static void bch2_journal_read_device(struct closure *cl)
        }
        mutex_unlock(&jlist->lock);
 
-       BUG_ON(ja->bucket_seq[ja->cur_idx] &&
-              ja->sectors_free == ca->mi.bucket_size);
+       if (ja->bucket_seq[ja->cur_idx] &&
+           ja->sectors_free == ca->mi.bucket_size) {
+               bch_err(c, "ja->sectors_free == ca->mi.bucket_size");
+               bch_err(c, "cur_idx %u/%u", ja->cur_idx, ja->nr);
+               for (i = 0; i < 3; i++) {
+                       unsigned idx = ja->cur_idx - 1 + i;
+                       bch_err(c, "bucket_seq[%u] = %llu", idx, ja->bucket_seq[idx]);
+               }
+               ja->sectors_free = 0;
+       }
 
        /*
         * Set dirty_idx to indicate the entire journal is full and needs to be
index a71054cf5240007936083fa19b3d6f50a255c27f..77fbb7d2194e956738e91385066f99b7019fee24 100644 (file)
@@ -9,10 +9,10 @@
 #include "super-io.h"
 #include "util.h"
 
-#define x(t, n) #t,
+#define x(t, n) [n] = #t,
 
 const char * const bch2_metadata_versions[] = {
-       BCH_MEMBER_STATES()
+       BCH_METADATA_VERSIONS()
        NULL
 };
 
index c917bdda514531654248ebf65987d35d379d5afa..be61c20b06f350cc6aa7d76c6a2b362a1a08913b 100644 (file)
@@ -248,7 +248,8 @@ static int validate_sb_layout(struct bch_sb_layout *layout, struct printbuf *out
        return 0;
 }
 
-static int bch2_sb_validate(struct bch_sb_handle *disk_sb, struct printbuf *out)
+static int bch2_sb_validate(struct bch_sb_handle *disk_sb, struct printbuf *out,
+                           int rw)
 {
        struct bch_sb *sb = disk_sb->sb;
        struct bch_sb_field *f;
@@ -325,6 +326,18 @@ static int bch2_sb_validate(struct bch_sb_handle *disk_sb, struct printbuf *out)
                return -EINVAL;
        }
 
+       if (rw == READ) {
+               /*
+                * Been seeing a bug where these are getting inexplicably
+                * zeroed, so we'r now validating them, but we have to be
+                * careful not to preven people's filesystems from mounting:
+                */
+               if (!BCH_SB_JOURNAL_FLUSH_DELAY(sb))
+                       SET_BCH_SB_JOURNAL_FLUSH_DELAY(sb, 1000);
+               if (!BCH_SB_JOURNAL_RECLAIM_DELAY(sb))
+                       SET_BCH_SB_JOURNAL_RECLAIM_DELAY(sb, 1000);
+       }
+
        for (opt_id = 0; opt_id < bch2_opts_nr; opt_id++) {
                const struct bch_option *opt = bch2_opt_table + opt_id;
 
@@ -691,7 +704,7 @@ got_super:
        ret = 0;
        sb->have_layout = true;
 
-       ret = bch2_sb_validate(sb, &err);
+       ret = bch2_sb_validate(sb, &err, READ);
        if (ret) {
                printk(KERN_ERR "bcachefs (%s): error validating superblock: %s",
                       path, err.buf);
@@ -807,7 +820,7 @@ int bch2_write_super(struct bch_fs *c)
        for_each_online_member(ca, c, i) {
                printbuf_reset(&err);
 
-               ret = bch2_sb_validate(&ca->disk_sb, &err);
+               ret = bch2_sb_validate(&ca->disk_sb, &err, WRITE);
                if (ret) {
                        bch2_fs_inconsistent(c, "sb invalid before write: %s", err.buf);
                        percpu_ref_put(&ca->io_ref);