]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
Update bcachefs sources to 44ac32df8e0c bcachefs: Split brain detection
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 24 Dec 2023 00:55:43 +0000 (19:55 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 24 Dec 2023 13:48:31 +0000 (08:48 -0500)
.bcachefs_revision
libbcachefs/opts.h
libbcachefs/recovery.c
libbcachefs/super.c

index e9e23c9256f3a5e711793ab20048e7e947db7a21..89cd41bc3f917811112c03c4d3eebd2f9f87b8fa 100644 (file)
@@ -1 +1 @@
-72740a707b64a4fb5f2bb559d8db27a66abc97cc
+44ac32df8e0c112b76c841088d93c7e923aada80
index cf69b92cbd03ebd5639e7f31872ba8d0d8044ffd..42cad83efb48337a2d4462ca6fd24d7946671b6c 100644 (file)
@@ -389,7 +389,7 @@ enum fsck_err_opts {
          BCH2_NO_SB_OPT,               BCH_SB_SECTOR,                  \
          "offset",     "Sector offset of superblock")                  \
        x(read_only,                    u8,                             \
-         OPT_FS,                                                       \
+         OPT_FS|OPT_MOUNT,                                             \
          OPT_BOOL(),                                                   \
          BCH2_NO_SB_OPT,               false,                          \
          NULL,         NULL)                                           \
index 69eec4eb5ed18885e22130ecc330fd85a475e6f8..ec206139ecd1ed709c9893bf249b827ac85b35ce 100644 (file)
@@ -737,7 +737,7 @@ int bch2_fs_recovery(struct bch_fs *c)
                goto err;
        }
 
-       if (c->opts.fsck || !(c->opts.nochanges && c->opts.norecovery))
+       if (!(c->opts.nochanges && c->opts.norecovery))
                check_version_upgrade(c);
 
        if (c->opts.fsck && c->opts.norecovery) {
@@ -979,7 +979,9 @@ out:
                bch2_journal_keys_put_initial(c);
        kfree(clean);
 
-       if (!ret && test_bit(BCH_FS_need_delete_dead_snapshots, &c->flags)) {
+       if (!ret &&
+           test_bit(BCH_FS_need_delete_dead_snapshots, &c->flags) &&
+           !c->opts.nochanges) {
                bch2_fs_read_write_early(c);
                bch2_delete_dead_snapshots_async(c);
        }
index e7b81dbda55f332934e4d5c3fb8d0d184d01c2c9..0f189c9d56b5dfe1bc49a5b10bafe8e1f51861de 100644 (file)
@@ -433,16 +433,6 @@ static int __bch2_fs_read_write(struct bch_fs *c, bool early)
        if (test_bit(BCH_FS_rw, &c->flags))
                return 0;
 
-       if (c->opts.norecovery)
-               return -BCH_ERR_erofs_norecovery;
-
-       /*
-        * nochanges is used for fsck -n mode - we have to allow going rw
-        * during recovery for that to work:
-        */
-       if (c->opts.nochanges && (!early || c->opts.read_only))
-               return -BCH_ERR_erofs_nochanges;
-
        bch_info(c, "going read-write");
 
        ret = bch2_sb_members_v2_init(c);
@@ -510,6 +500,12 @@ err:
 
 int bch2_fs_read_write(struct bch_fs *c)
 {
+       if (c->opts.norecovery)
+               return -BCH_ERR_erofs_norecovery;
+
+       if (c->opts.nochanges)
+               return -BCH_ERR_erofs_nochanges;
+
        return __bch2_fs_read_write(c, false);
 }
 
@@ -1033,7 +1029,7 @@ int bch2_fs_start(struct bch_fs *c)
 
        set_bit(BCH_FS_started, &c->flags);
 
-       if (c->opts.read_only || c->opts.nochanges) {
+       if (c->opts.read_only) {
                bch2_fs_read_only(c);
        } else {
                ret = !test_bit(BCH_FS_rw, &c->flags)
@@ -1996,6 +1992,11 @@ struct bch_fs *bch2_fs_open(char * const *devices, unsigned nr_devices,
                BUG_ON(darray_push(&sbs, sb));
        }
 
+       if (opts.nochanges && !opts.read_only) {
+               ret = -BCH_ERR_erofs_nochanges;
+               goto err_print;
+       }
+
        darray_for_each(sbs, sb)
                if (!best || sb_cmp(sb->sb, best->sb) > 0)
                        best = sb;