id stringlengths 40 40 | instruction stringlengths 68 308 | input stringlengths 17 33.4k | output stringlengths 100 30k |
|---|---|---|---|
b56b787c7d5e8300dba41d80ddd41472a39ca86f | Analyze and fix the following issue in the Linux kernel code: bcachefs: In debug mode, run fsck again after fixing errors | Problem Details:
We want to ensure that fsck actually fixed all the errors it found - the
second fsck run should be clean.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index dcd4f9f410ae..55a233c2c7cc 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -1458,6 +1458,29 @@ use_clean:
if (ret)
goto err;
+ /* If we fixed errors, verify that fs is actually clean now: */
+ if (IS_ENABLED(CONFIG_BCA... |
bf5a261c7af80a2ac10bcc3ce0382cb238eccb8b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Assorted fixes for clang | Problem Details:
clang had a few more warnings about enum conversion, and also didn't
like the opts.c initializer.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 1f6a518cbe36..18b97416750f 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -79,36 +79,6 @@ static inline u64 alloc_field_v1_get(const struct bch_alloc *a,
return v;
}
-static inline void a... |
e8d2fe3b4bfad1c902f9b0acea1edc8d5291deb9 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Consolidate btree id properties | Problem Details:
This refactoring centralizes defining per-btree properties.
bch2_key_types_allowed was also about to overflow a u32, so expand that
to a u64.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h
index 5c308f8421c5..4e0673c668d3 100644
--- a/fs/bcachefs/bcachefs_format.h
+++ b/fs/bcachefs/bcachefs_format.h
@@ -2194,26 +2194,67 @@ LE32_BITMASK(JSET_NO_FLUSH, struct jset, flags, 5, 6);
/* Btree: */
-#define BCH_BTREE_IDS() ... |
3f4ab4c1e63ed2713e237b2af0d442380d8cdb49 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix minor memory leak on invalid bkey | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index 947c28b76ff0..368972a00f55 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -852,12 +852,11 @@ static inline int do_bch2_trans_commit(struct btree_trans *trans, unsigned flags
{
struct bc... |
4437590d5f1a44078d54c0b959f38e22a8703fc7 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix btree iter leak in __bch2_insert_snapshot_whiteouts() | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index 336a91e4fb20..947c28b76ff0 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -1327,7 +1327,7 @@ int __bch2_insert_snapshot_whiteouts(struct btree_trans *trans,
struct bpos new_pos)
{... |
2a89a3e9682b127c1978ac31eb38ef73a39a416e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a null ptr deref in check_xattr() | Problem Details:
We were attempting to initialize inode hash info when no inodes were
found.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index 022af0270692..5338765b3e68 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -1662,7 +1662,7 @@ static int check_dirent(struct btree_trans *trans, struct btree_iter *iter,
if (ret < 0)
goto err;
- if (dir->first_this_inode)
+ if (dir->f... |
20e6d9a8d4050220f4e0a0195d102abaf2c8439b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix lookup_inode_for_snapshot() | Problem Details:
This fixes a use-after-free.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index c8599978ae46..0d7344ff64c0 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -682,6 +682,7 @@ found:
if (snapshot != i->snapshot && !is_whiteout) {
struct inode_walker_entry new = *i;
+ size_t pos;
int ret;
new.snapshot = snaps... |
464ee1929b7761d2939ad76573e6679b4246dc82 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Improve key_visible_in_snapshot() | Problem Details:
Delete a redundant bch2_snapshot_is_ancestor() check, and convert some
assertions to debug assertions.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index e40040001ac1..93281b701473 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -517,15 +517,14 @@ static bool key_visible_in_snapshot(struct bch_fs *c, struct snapshots_seen *see
u32 id, u32 ancestor)
{
ssize_t i;
- u32 top = seen->i... |
813e0cecd1473d7328376f9ca56f9239bc5b8146 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Upgrade path fixes | Problem Details:
Some minor fixes to not print errors that are actually due to a verson
upgrade.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/backpointers.c b/fs/bcachefs/backpointers.c
index d412bae553a0..7c1e6546d054 100644
--- a/fs/bcachefs/backpointers.c
+++ b/fs/bcachefs/backpointers.c
@@ -477,7 +477,7 @@ missing:
prt_printf(&buf, "\nbp pos ");
bch2_bpos_to_text(&buf, bp_iter.pos);
- if (c->sb.version < bcachefs_me... |
b912913613a1195ba86cbb1bc9b1c12b4c6c4a14 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix build error on weird gcc | Problem Details:
fixes
./include/linux/stddef.h:8:14: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c
index 6a97af0f5896..6ee1e7bb5eba 100644
--- a/fs/bcachefs/super-io.c
+++ b/fs/bcachefs/super-io.c
@@ -1487,9 +1487,7 @@ static const struct bch_sb_field_ops *bch2_sb_field_ops[] = {
#undef x
};
-static const struct bch_sb_field_ops bch2_sb_field_n... |
6619d84626ff266721f4c3c24339c60ca8cb12e0 | Analyze and fix the following issue in the Linux kernel code: bcachefs: bch2_sb_maybe_downgrade(), bch2_sb_upgrade() | Problem Details:
Add some new helpers, and fix upgrade/downgrade in bch2_fs_initialize().
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 17ffac089a5d..9ca6c236f508 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -1166,8 +1166,7 @@ static void check_version_upgrade(struct bch_fs *c)
c->opts.fix_errors = FSCK_OPT_YES;
mutex_lock(&c->sb_lock);
- c->disk_... |
01e691e830edae9a145eeb70f8983223d606e2ca | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a write buffer flush deadlock | Problem Details:
We're not supposed to block if BTREE_INSERT_JOURNAL_RECLAIM && watermark
!= BCH_WATERMARK_reclaim.
This should really be a separate BTREE_INSERT_NONBLOCK flag - add some
comments to that effect, it's not important for this patch.
btree write buffer flush depends on this behaviour though - the first
l... | ```diff
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c
index 5592feff79d1..3659b2c08109 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -1158,6 +1158,17 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path,
... |
07f293c8630d5bdae1615e6add90c76fed333d20 | Analyze and fix the following issue in the Linux kernel code: bcachefs: bch2_xattr_set() now updates ctime | Problem Details:
Fixes fstests generic/728
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fs.h b/fs/bcachefs/fs.h
index 2e63cb6603bd..6170d214d648 100644
--- a/fs/bcachefs/fs.h
+++ b/fs/bcachefs/fs.h
@@ -196,6 +196,8 @@ int bch2_vfs_init(void);
#else
+#define bch2_inode_update_after_write(_trans, _inode, _inode_u, _fields) do {} while (0)
+
static inline void bch2_evic... |
e8ee5cc733319496cbe8a97bc75ccdb6058d2da7 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix try_decrease_writepoints() | Problem Details:
We were freeing open buckets on the writepoint list, but forgetting to
take them off the writepoint list - whoops
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c
index 06bfcc5a498a..fcb7311b1844 100644
--- a/fs/bcachefs/alloc_foreground.c
+++ b/fs/bcachefs/alloc_foreground.c
@@ -1193,6 +1193,7 @@ static bool try_decrease_writepoints(struct btree_trans *trans, unsigned old_nr)
bch2_trans_mutex... |
dbc7deb2afc71aa466c9ed4c3cefd838d823bff7 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Mark as EXPERIMENTAL | Problem Details:
As discussed on list, bcachefs is going to be marked as experimental for
a few releases, until the inevitable tide of new bug reports subsides.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/Kconfig b/fs/bcachefs/Kconfig
index bc56c6bf37d7..49776ba0a031 100644
--- a/fs/bcachefs/Kconfig
+++ b/fs/bcachefs/Kconfig
@@ -1,6 +1,6 @@
config BCACHEFS_FS
- tristate "bcachefs filesystem support"
+ tristate "bcachefs filesystem support (EXPERIMENTAL)"
depends on BLOCK
select EX... |
9a644843c4701f86594fe0386f00af6b847f747d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix error path in bch2_journal_flush_device_pins() | Problem Details:
We need to always call bch2_replicas_gc_end() after we've called
bch2_replicas_gc_start(), else we leave state around that needs to be
cleaned up.
Partial fix for: https://github.com/koverstreet/bcachefs/issues/560
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c
index 72486f1f8a8e..8de83e103751 100644
--- a/fs/bcachefs/journal_reclaim.c
+++ b/fs/bcachefs/journal_reclaim.c
@@ -845,10 +845,8 @@ int bch2_journal_flush_device_pins(struct journal *j, int dev_idx)
* expects to find devices marked f... |
d14bfd1010c4ce8bede5bd98d0b332e3b34b8bd5 | Analyze and fix the following issue in the Linux kernel code: bcachefs: mark active journal devices on journal replicas gc | Problem Details:
A simple device evacuate, remove, add test loop with concurrent
shutdowns occasionally reproduces a problem where the filesystem
fails to mount. The mount failure occurs because the filesystem was
uncleanly shut down, yet no member device is marked for journal data
in the superblock. An fsck detects th... | ```diff
diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c
index 2c7f8aca9319..5174b9497721 100644
--- a/fs/bcachefs/journal_reclaim.c
+++ b/fs/bcachefs/journal_reclaim.c
@@ -837,8 +837,20 @@ int bch2_journal_flush_device_pins(struct journal *j, int dev_idx)
mutex_lock(&c->replicas_gc_lock);
... |
65db60490a36cbfc0500cb86bf539614c89501d3 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a null ptr deref in bch2_fs_alloc() error path | Problem Details:
This fixes a null ptr deref in bch2_free_pending_node_rewrites() when
the list head wasn't initialized.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c
index 914cb80fc6d9..5d3a09039fab 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -2452,7 +2452,7 @@ void bch2_fs_btree_interior_update_exit(struct bch_fs *c)
mempool_exit(&c->bt... |
0b9fbce235c3ae545b6f31b8f2de2de030689595 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a format string warning | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index 7af65030f9d8..674018a58de5 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -1216,7 +1216,7 @@ static int check_overlapping_extents(struct btree_trans *trans,
if (ret)
break;
- if (fsck_err(c, buf.buf)) {
+ if (fsck_err(c, "%s", bu... |
e4eb661d3a5764273cb854d7c441819943692971 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix btree node write error message | Problem Details:
Error messages should include the error code, when available.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
index 27a2a7b31f37..19aca1c0f2a2 100644
--- a/fs/bcachefs/btree_io.c
+++ b/fs/bcachefs/btree_io.c
@@ -1777,7 +1777,7 @@ out:
err:
set_btree_node_noevict(b);
if (!bch2_err_matches(ret, EROFS))
- bch2_fs_fatal_error(c, "fatal error writing btree n... |
1fa3e87ac50a24a4f6a71986a4d9bc2f16d0667e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix leak in backpointers fsck | Problem Details:
We were forgetting to exit a printbuf - whoops.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/backpointers.c b/fs/bcachefs/backpointers.c
index 2641ebef6ae4..a270ff96e9b4 100644
--- a/fs/bcachefs/backpointers.c
+++ b/fs/bcachefs/backpointers.c
@@ -811,8 +811,10 @@ static int check_one_backpointer(struct btree_trans *trans,
if (fsck_err_on(!k.k, c,
"backpointer for missin... |
0ce4e0e759614ec19b140e8f19a67305c01cca78 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Add a missing rhashtable_destroy() call | Problem Details:
Fixes https://lore.kernel.org/linux-bcachefs/784c3e6a-75bd-e6ca-535a-43b3e1daf643@kernel.dk/T/#mbf7caf005f960018eba23b58795d06c06c947411
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/movinggc.c b/fs/bcachefs/movinggc.c
index 7ef78cccc65c..5ea512968f4d 100644
--- a/fs/bcachefs/movinggc.c
+++ b/fs/bcachefs/movinggc.c
@@ -369,6 +369,7 @@ static int bch2_copygc_thread(void *arg)
}
move_buckets_wait(&trans, &ctxt, &move_buckets, true);
+ rhashtable_destroy(&move_bu... |
8f507f89b8b87d2ee4adc990b96388001444967e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix check_pos_snapshot_overwritten() | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index b42b83c55c5b..259e5e47d2a7 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -1218,7 +1218,6 @@ static inline int check_pos_snapshot_overwritten(struct btree_trans *trans,
struct bpos... |
e9d017234ff96ed9820dc7cd3a4c940af44330bf | Analyze and fix the following issue in the Linux kernel code: bcachefs: BCH_ERR_fsck -> EINVAL | Problem Details:
When we return errors outside of bcachefs, we need to return a standard
error code - fix this for BCH_ERR_fsck.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/errcode.h b/fs/bcachefs/errcode.h
index 621ff4647205..1e06d95f3484 100644
--- a/fs/bcachefs/errcode.h
+++ b/fs/bcachefs/errcode.h
@@ -151,7 +151,7 @@
x(0, backpointer_to_overwritten_btree_node) \
x(0, lock_fail_root_changed) \
x(0, journal_reclaim_would_deadlock) \
- x... |
9473cff989c8519d01c6a285bd94d2ed35d30251 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix more lockdep splats in debug.c | Problem Details:
Similar to previous fixes, we can't incur page faults while holding
btree locks.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_iter.h b/fs/bcachefs/btree_iter.h
index d2af3f38e6f5..9ef9527dda6b 100644
--- a/fs/bcachefs/btree_iter.h
+++ b/fs/bcachefs/btree_iter.h
@@ -286,7 +286,7 @@ __always_inline
static inline int btree_trans_restart_nounlock(struct btree_trans *trans, int err)
{
BUG_ON(err <= 0);
- ... |
462f494bc56052e3d17c9ae48a6e407b3f9d2c0c | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix lockdep splat in bch2_readdir | Problem Details:
dir_emit() can fault (taking mmap_lock); thus we can't be holding btree
locks.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/dirent.c b/fs/bcachefs/dirent.c
index 1544fc56974f..610dd7425fb4 100644
--- a/fs/bcachefs/dirent.c
+++ b/fs/bcachefs/dirent.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "bcachefs.h"
+#include "bkey_buf.h"
#include "bkey_methods.h"
#include "btree_update.h"
#incl... |
a83e108fc1964b8273c6f51cc62588ee774a5a48 | Analyze and fix the following issue in the Linux kernel code: bcachefs: fiemap: Fix a lockdep splat | Problem Details:
As with the previous patch, we generally can't hold btree locks while
copying to userspace, as that may incur a page fault and require
mmap_lock.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index f417889eba08..9280f514bc9f 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -943,6 +943,7 @@ retry:
cur.k->k.p.offset += cur.k->k.size;
if (have_extent) {
+ bch2_trans_unlock(&trans);
ret = bch2_fill_extent(c, info,
bkey_i_to_s_c(... |
a5b696ee6e10103def82ea9abc18958912e81b00 | Analyze and fix the following issue in the Linux kernel code: bcachefs: seqmutex; fix a lockdep splat | Problem Details:
We can't be holding btree_trans_lock while copying to user space, which
might incur a page fault. To fix this, convert it to a seqmutex so we
can unlock/relock.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 0dfa42e297e0..4199b42db640 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -208,6 +208,7 @@
#include "fifo.h"
#include "nocow_locking_types.h"
#include "opts.h"
+#include "seqmutex.h"
#include "util.h"
#ifdef CONFIG_BC... |
6547ebabdaac4407ccc978f63f4dc4d9f8936783 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Don't call lock_graph_descend() with wait lock held | Problem Details:
This fixes a deadlock:
01305 WARNING: possible circular locking dependency detected
01305 6.3.0-ktest-gf4de9bee61af #5305 Tainted: G W
01305 ------------------------------------------------------
01305 cat/14658 is trying to acquire lock:
01305 ffffffc00982f460 (fs_reclaim){+.+.}-{0:0}, at: __k... | ```diff
diff --git a/fs/bcachefs/btree_locking.c b/fs/bcachefs/btree_locking.c
index dc3aa70a0380..e6fe2a987574 100644
--- a/fs/bcachefs/btree_locking.c
+++ b/fs/bcachefs/btree_locking.c
@@ -112,10 +112,8 @@ static noinline void lock_graph_pop_all(struct lock_graph *g)
lock_graph_up(g);
}
-static void lock_graph_... |
e96f5a61cb8008a1acae9a14cc9d382554da60b4 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_check_discard_freespace_key() | Problem Details:
We weren't correctly checking the freespace btree - it's an extents
btree, which means we need to iterate over each bucket in a freespace
extent.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index f774a660a681..6c8bcb210ad9 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -788,10 +788,12 @@ static int bch2_bucket_do_index(struct btree_trans *trans,
if (ca->mi.freespace_initialized &&
... |
25aa8c2167306a3919fb6503494cd6078e33a71e | Analyze and fix the following issue in the Linux kernel code: bcachefs: bch2_trans_unlock_noassert() | Problem Details:
This fixes a spurious assert in the btree node read path.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index 681a47b70a65..435e68888918 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -744,7 +744,7 @@ static noinline struct btree *bch2_btree_node_fill(struct btree_trans *trans,
/* Unlock before doing IO: */
if (tra... |
45a1ab57ddb53a8b392baab2142c909154a8d37c | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_btree_update_start() | Problem Details:
The calculation for number of nodes to allocate in
bch2_btree_update_start() was incorrect - this fixes a BUG_ON() on the
small nodes test.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c
index d2811c4756b7..e95e48857bb8 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -1077,7 +1077,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path,
... |
91ecd41b7f02b95279dddcb2193af454efd39497 | Analyze and fix the following issue in the Linux kernel code: bcachefs: bch2_extent_ptr_desired_durability() | Problem Details:
This adds a new helper for getting a pointer's durability irrespective
of the device state, and uses it in the the data update path.
This fixes a bug where we do a data update but request 0 replicas to be
allocated, because the replica being rewritten is on a device marked as
failed.
Signed-off-by: K... | ```diff
diff --git a/fs/bcachefs/data_update.c b/fs/bcachefs/data_update.c
index c89ee14f8b6b..9f7a30c7ad36 100644
--- a/fs/bcachefs/data_update.c
+++ b/fs/bcachefs/data_update.c
@@ -474,7 +474,7 @@ int bch2_data_update_init(struct btree_trans *trans,
if (crc_is_compressed(p.crc))
reserve_sectors += k.k->size;... |
995f9128e03f769e4cdbcf6dbea8f0db5ce75c69 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix try_decrease_writepoints() | Problem Details:
- We may need to drop btree locks before taking the writepoint_lock, as
is done in other places.
- We should be using open_bucket_free_unused(), so that we don't waste
space.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c
index 95829bbfe033..3c5100c26916 100644
--- a/fs/bcachefs/alloc_foreground.c
+++ b/fs/bcachefs/alloc_foreground.c
@@ -35,6 +35,15 @@
#include <linux/rculist.h>
#include <linux/rcupdate.h>
+static void bch2_trans_mutex_lock_norelock... |
25c70097a65a22a5799442c8935fa927d91bddaf | Analyze and fix the following issue in the Linux kernel code: bcachefs: Delete weird hacky transaction restart injection | Problem Details:
since we currently don't have a good fault injection library,
bch2_btree_insert_node() was randomly injecting faults based on
local_clock().
At the very least this should have been a debug mode only thing, but
this is a brittle method so let's just delete it.
Signed-off-by: Kent Overstreet <kent.over... | ```diff
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c
index 66da1da2f075..d2811c4756b7 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -1674,9 +1674,6 @@ static int bch2_btree_insert_node(struct btree_update *as, struct btree_trans *... |
99a3d39893615ac107a4f82e86d4c26792131b91 | Analyze and fix the following issue in the Linux kernel code: bcachefs: ec: Fix a lost wakeup | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index dfc0a61afa51..b7e3889b114b 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -1146,6 +1146,7 @@ err:
mutex_lock(&c->ec_stripe_new_lock);
list_del(&s->list);
mutex_unlock(&c->ec_stripe_new_lock);
+ wake_up(&c->ec_stripe_new_wait);
ec_stripe_b... |
954ed17e029fbf810826739aa190cd559b6e4036 | Analyze and fix the following issue in the Linux kernel code: bcachefs: fix NULL pointer dereference in try_alloc_bucket | Problem Details:
On Mon, 29 May 2023, Mikulas Patocka wrote:
> The oops happens in set_btree_iter_dontneed and it is caused by the fact
> that iter->path is NULL. The code in try_alloc_bucket is buggy because it
> sets "struct btree_iter iter = { NULL };" and then jumps to the "err"
> label that tries to dereference v... | ```diff
diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c
index a7e6852271d2..95829bbfe033 100644
--- a/fs/bcachefs/alloc_foreground.c
+++ b/fs/bcachefs/alloc_foreground.c
@@ -371,7 +371,8 @@ static struct open_bucket *try_alloc_bucket(struct btree_trans *trans, struct bc
if (!ob)
iter.p... |
b0e8c75e40a863dd40ecdf8fd6f8cdceacb965e5 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix subvol deletion deadlock | Problem Details:
d_prune_aliases() may call bch2_evict_inode(), which needs
c->vfs_inodes_list_lock.
Fix this by always calling igrab() before putting the inodes onto our
disposal list, and then calling d_prune_aliases() with
c->vfs_inodes_lock dropped.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index ba7aff6b8a51..f417889eba08 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -1481,22 +1481,14 @@ again:
continue;
if (!(inode->v.i_state & I_DONTCACHE) &&
- !(inode->v.i_state & I_FREEING)) {
+ !(inode->v.i_state & I_FREEING) &&
+ ... |
4f2c166ebe5baef20e28866b27dd97b0caa585f1 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_fsck_ask_yn() | Problem Details:
- getline() output includes a newline, without stripping that we were
just looping
- Make the prompt clearer
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/error.c b/fs/bcachefs/error.c
index 545c55dabc27..b08cd23dee00 100644
--- a/fs/bcachefs/error.c
+++ b/fs/bcachefs/error.c
@@ -85,12 +85,13 @@ enum ask_yn bch2_fsck_ask_yn(void)
bool ret;
while (true) {
- fputs(" (y,n,Y,N) ", stdout);
+ fputs(" (y,n, or Y,N for all errors of this... |
4c4a8f20d1767b2ed927d25ccc363de72d48d28f | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix error handling in promote path | Problem Details:
The promote path had a BUG_ON() for unknown error type, which we're now
seeing: change it to a WARN_ON() - because we're curious what this is -
and otherwise handle it in the normal error path.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index 0f8d52912c2d..199a8348355a 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -2057,14 +2057,16 @@ static struct promote_op *__promote_alloc(struct btree_trans *trans,
.write_flags = BCH_WRITE_ALLOC_NOWAIT|BCH_WRITE_CACHED,
},
btree_id, k)... |
e1d29c5fa1205c75dd96303f76d7aa4991555aaa | Analyze and fix the following issue in the Linux kernel code: bcachefs: Ensure bch2_btree_node_get() calls relock() after unlock() | Problem Details:
Fix a bug where bch2_btree_node_get() might call bch2_trans_unlock() (in
fill) without calling bch2_trans_relock(); this is a bug when it's done
in the core btree code.
Also, twea bch2_btree_node_mem_alloc() to drop btree locks before doing
a blocking memory allocation.
Signed-off-by: Kent Overstreet... | ```diff
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index 58ef9e7b4bdf..681a47b70a65 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -587,9 +587,10 @@ struct btree *bch2_btree_node_mem_alloc(struct btree_trans *trans, bool pcpu_rea
goto got_node;
}
- b = __btree... |
ad520141b155786800261cc7e02ec02f0afe2643 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix corruption with writeable snapshots | Problem Details:
When partially overwriting an extent in an older snapshot, the existing
extent has to be split.
If the existing extent was overwritten in a different (sibling)
snapshot, we have to ensure that the split won't be visible in the
sibling snapshot.
data_update.c already has code for this,
bch2_insert_sna... | ```diff
diff --git a/fs/bcachefs/btree_update.h b/fs/bcachefs/btree_update.h
index 1ac3a81e0af6..e90cf292f80b 100644
--- a/fs/bcachefs/btree_update.h
+++ b/fs/bcachefs/btree_update.h
@@ -4,6 +4,7 @@
#include "btree_iter.h"
#include "journal.h"
+#include "journal.h"
struct bch_fs;
struct btree;
@@ -83,6 +84,28 @... |
f154c3eb429a340d66a06e8f8d2221d28d25ab45 | Analyze and fix the following issue in the Linux kernel code: bcachefs: trans_for_each_path_safe() | Problem Details:
bch2_btree_trans_to_text() is used on btree_trans objects that are owned
by different threads - when printing out deadlock cycles - so we need a
safe version of trans_for_each_path(), else we race with seeing a
btree_path that was just allocated and not fully initialized:
Signed-off-by: Kent Overstree... | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index f0d0b64a55a4..4830d203b37b 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -2914,6 +2914,10 @@ static void bch2_trans_alloc_paths(struct btree_trans *trans, struct bch_fs *c)
#endif
if (!p)
p = mempool_alloc(&tr... |
e7ffda565a762a6bdf782b4978af5ccfe4ab5d0d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a quota read bug | Problem Details:
bch2_fs_quota_read() could see an inode that's been deleted
(KEY_TYPE_inode_generation) - bch2_fs_quota_read_inode() needs to check
for that instead of erroring.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/quota.c b/fs/bcachefs/quota.c
index 310eb9d26571..56ba82cae19d 100644
--- a/fs/bcachefs/quota.c
+++ b/fs/bcachefs/quota.c
@@ -576,6 +576,13 @@ static int bch2_fs_quota_read_inode(struct btree_trans *trans,
le32_to_cpu(s_t.master_subvol),
k.k->p.offset,
}, &u);
+ /*
+ *... |
c26463ce9940d150dfeaac0a1a0747db9b1ca600 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix move_extent_fail counter | Problem Details:
fail counters need to be events, not numbers of sectors - or the
calculations the tests use for determining if we've had too many
slowpath events don't work.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/data_update.c b/fs/bcachefs/data_update.c
index c709538ce9c2..ae7e60d6e583 100644
--- a/fs/bcachefs/data_update.c
+++ b/fs/bcachefs/data_update.c
@@ -374,7 +374,7 @@ nowork:
&m->ctxt->stats->sectors_raced);
}
- this_cpu_add(c->counters[BCH_COUNTER_move_extent_fail], new-... |
fc0ee376bb5b08844198fba13fb809102afd0b29 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Don't reuse reflink btree keyspace | Problem Details:
We've been seeing difficult to debug "missing indirect extent" bugs,
that fsck doesn't seem to find.
One possibility is that there was a missing indirect extent, but then a
new indirect extent was created at the location of the previous indirect
extent.
This patch eliminates that possibility by alway... | ```diff
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 39fd15447753..0dfa42e297e0 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -963,7 +963,6 @@ struct bch_fs {
struct bio_set ec_bioset;
/* REFLINK */
- u64 reflink_hint;
reflink_gc_table reflink_gc_table;
size_t ... |
c4687a4a7536c3b2139faa63e66afd1d3da5bf15 | Analyze and fix the following issue in the Linux kernel code: six locks: Fix an unitialized var | Problem Details:
In the conversion to atomic_t, six_lock_slowpath() ended up calling
six_lock_wakeup() in the failure path with a state variable that was
never initialized - whoops.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/six.c b/fs/bcachefs/six.c
index fa508ab2108c..9a5fcd7d3566 100644
--- a/fs/bcachefs/six.c
+++ b/fs/bcachefs/six.c
@@ -451,7 +451,6 @@ static int six_lock_slowpath(struct six_lock *lock, enum six_lock_type type,
six_lock_should_sleep_fn should_sleep_fn, void *p,
unsigne... |
1fb4fe63178881a0ac043a5c05288d9fff85d6b8 | Analyze and fix the following issue in the Linux kernel code: six locks: Kill six_lock_state union | Problem Details:
As suggested by Linus, this drops the six_lock_state union in favor of
raw bitmasks.
On the one hand, bitfields give more type-level structure to the code.
However, a significant amount of the code was working with
six_lock_state as a u64/atomic64_t, and the conversions from the
bitfields to the u64 w... | ```diff
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index 5801f4ff9097..58ef9e7b4bdf 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -735,7 +735,7 @@ static noinline struct btree *bch2_btree_node_fill(struct btree_trans *trans,
set_btree_node_read_in_flight(b);
six... |
0157f9c5a7c77b1cb89756351929dba4b28d5f75 | Analyze and fix the following issue in the Linux kernel code: six locks: Remove hacks for percpu mode lost wakeup | Problem Details:
The lost wakeup bug hasn't been observed in awhile, and we're trying to
provoke it and determine if it still exists.
This patch removes some defenses that were added to attempt to track it
down; if it still exists, this should make it easier to see it.
Signed-off-by: Kent Overstreet <kent.overstreet@... | ```diff
diff --git a/fs/bcachefs/six.c b/fs/bcachefs/six.c
index f75387b9da88..32ad545ba570 100644
--- a/fs/bcachefs/six.c
+++ b/fs/bcachefs/six.c
@@ -144,17 +144,8 @@ static int __do_six_trylock_type(struct six_lock *lock,
* lock, issue a wakeup because we might have caused a
* spurious trylock failure:
*/... |
962210b281b327b236215c736b9f648369f0d39d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a buffer overrun in bch2_fs_usage_read() | Problem Details:
We were copying the size of a struct bch_fs_usage_online to a struct
bch_fs_usage, which is 8 bytes smaller.
This adds some new helpers so we can do this correctly, and get rid of
some magic +1s too.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index bce42eef6f57..bd144182c1e1 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -137,17 +137,17 @@ u64 bch2_fs_usage_read_one(struct bch_fs *c, u64 *v)
struct bch_fs_usage_online *bch2_fs_usage_read(struct bch_fs *c)
{
struct bch_... |
0b438c5bfaebda3fdf6edc35d9572d4e2f66aef1 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Clear btree_node_just_written() when node reused or evicted | Problem Details:
This fixes the following bug:
Journal reclaim attempts to flush a node, but races with the node being
evicted from the btree node cache; when we lock the node, the data
buffers have already been freed.
We don't evict a node that's dirty, so calling btree_node_write() is
fine - it's a noop - except th... | ```diff
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index 46a8a29ddef7..76e08f2f6689 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -55,6 +55,8 @@ static void btree_node_data_free(struct bch_fs *c, struct btree *b)
EBUG_ON(btree_node_write_in_flight(b));
+ clear_b... |
faa62a2036a491a919deffd980abc867be51b6f1 | Analyze and fix the following issue in the Linux kernel code: bcachefs: alloc_v4_u64s() fix | Problem Details:
With the recent bkey_ops.min_val_size addition, bkey values are
automatically extended to the size of the current version.
The check in bch2_alloc_v4_invalid() needs to be updated to take this
into account.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index dcdef3bcd4c4..f774a660a681 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -269,9 +269,9 @@ int bch2_alloc_v4_invalid(const struct bch_fs *c, struct bkey_s_c k,
struct bkey_s_c_alloc_v4 a = b... |
a49bd8c007e4f4840f8c4d7fe7d62c7bdc7fffca | Analyze and fix the following issue in the Linux kernel code: bcachefs: Delete an incorrect bch2_trans_unlock() | Problem Details:
These deletes a bch2_trans_unlock() call from __bch2_move_data(). It was
redundant; bch2_move_extent() has the correct unlock call, and it was
buggy because when move_extent calls bch2_extent_drop_ptrs() we don't
want the transaction to be unlocked yet - this fixes a btree_iter.c
assertion.
Fixes http... | ```diff
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index 7e22176a5c7e..2ec30a3fd193 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -583,7 +583,6 @@ static int __bch2_move_data(struct moving_context *ctxt,
*/
bch2_bkey_buf_reassemble(&sk, c, k);
k = bkey_i_to_s_c(sk.k);
- bch2_trans_unl... |
73da30e8e0f8ffcc91691934f202ab6e2f985604 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix check_overlapping_extents() | Problem Details:
A error check had a flipped conditional - whoops.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index eb3609aa4593..1b3ee66265c9 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -1176,7 +1176,7 @@ static int check_overlapping_extents(struct btree_trans *trans,
goto err;
bkey_reassemble(update, k);
ret = bch2_trans_update_extent(t... |
cb1b479dc1c78d1d224e4aa6aba212a7bd3263a4 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix quotas + snapshots | Problem Details:
Now that we can reliably designate and find the master subvolume out of
a tree of snapshots, we can finally make quotas work with snapshots:
That is - quotas will now _ignore_ snapshot subvolumes, and only be in
effect for the master (non snapshot) subvolume.
Signed-off-by: Kent Overstreet <kent.over... | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index ea5039254609..64897cee8494 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -333,6 +333,9 @@ static int bch2_quota_reservation_add(struct bch_fs *c,
{
int ret;
+ if (test_bit(EI_INODE_SNAPSHOT, &inode->ei_flags))
+ return 0;
+
mut... |
3c434cdff0a47df50779bd55a023c363f658c69a | Analyze and fix the following issue in the Linux kernel code: bcachefs: fix accounting corruption race between reclaim and dev add | Problem Details:
When a device is removed from a bcachefs volume, the associated
content is removed from the various btrees. The alloc tree uses the
key cache, so when keys are removed the deletes exist in cache for a
period of time until reclaim comes along and flushes outstanding
updates.
When a device is re-added t... | ```diff
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index b8299914a0ab..be4c5df42be8 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -1501,21 +1501,31 @@ static noinline int flush_new_cached_update(struct btree_trans *trans,
unsigned lon... |
6b52bcde4a2f3c073151356bf960596d2da9716e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Always run topology error when CONFIG_BCACHEFS_DEBUG=y | Problem Details:
Improved test coverage.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c
index d9f1e011ed71..eedcc09bacff 100644
--- a/fs/bcachefs/btree_gc.c
+++ b/fs/bcachefs/btree_gc.c
@@ -1799,9 +1799,10 @@ again:
bch2_mark_superblocks(c);
- if (BCH_SB_HAS_TOPOLOGY_ERRORS(c->disk_sb.sb) &&
- !test_bit(BCH_FS_INITIAL_GC_DONE, ... |
a0668d77f04dd95a394cf421125a2cfd6ab68fad | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a userspace build error | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h
index a57accc592db..8e37ce01a728 100644
--- a/fs/bcachefs/util.h
+++ b/fs/bcachefs/util.h
@@ -838,4 +838,6 @@ static inline int u8_cmp(u8 l, u8 r)
return cmp_int(l, r);
}
+#include <linux/uuid.h>
+
#endif /* _BCACHEFS_UTIL_H */
``` |
c8d5b71411473187db4fbc6ca419496b716778b8 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Make sure hash info gets initialized in fsck | Problem Details:
We had some bugs with setting/using first_this_inode in the inode
walker in the dirents/xattr code.
This patch changes to not clear first_this_inode until after
initializing the new hash info.
Also, we fix an error message to not print on transaction restart, and
add a comment to related fsck error c... | ```diff
diff --git a/fs/bcachefs/error.c b/fs/bcachefs/error.c
index aa640284ed19..545c55dabc27 100644
--- a/fs/bcachefs/error.c
+++ b/fs/bcachefs/error.c
@@ -158,6 +158,11 @@ int bch2_fsck_err(struct bch_fs *c, unsigned flags, const char *fmt, ...)
mutex_lock(&c->fsck_error_lock);
s = fsck_err_get(c, fmt);
if (s... |
251babb55d53d79bba9568d6516fd11128c34606 | Analyze and fix the following issue in the Linux kernel code: bcachefs: fix NULL bch_dev deref when checking bucket_gens keys | Problem Details:
fsck removes bucket_gens keys for devices that do not exist in the
volume (i.e., if the device was removed). In 'fsck -n' mode, the
associated fsck_err_on() wrapper returns false to skip the key
removal. This proceeds on to the rest of the function, which
eventually segfaults on a NULL bch_dev because ... | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 4032d1940884..968b6103e979 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -1362,17 +1362,21 @@ static int bch2_check_bucket_gens_key(struct btree_trans *trans,
u64 start = bucket_gens_pos_to... |
e3dc75eb551599c356a9a3f8c00ae6396164457d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a null ptr deref in fsck check_extents() | Problem Details:
It turns out, in rare situations we need to be passing in a disk
reservation, which will be used internally by the transaction commit
path when needed. Pass one in...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index ed2523ac2249..6319f2f7b16f 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -3,6 +3,7 @@
#include "bcachefs.h"
#include "bkey_buf.h"
#include "btree_update.h"
+#include "buckets.h"
#include "darray.h"
#include "dirent.h"
#include "error... |
615fccada50247abbc61c6c0a0d9c717b3fb6290 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a slab-out-of-bounds | Problem Details:
In __bch2_alloc_to_v4_mut(), we overrun the buffer we allocate if the
alloc key had backpointers stored in it (which we no longer support).
Fix this with a max() call.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 06032556d5c4..4032d1940884 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -479,7 +479,7 @@ __bch2_alloc_to_v4_mut(struct btree_trans *trans, struct bkey_s_c k)
{
struct bkey_i_alloc_v4 *ret... |
6b9857b208d7566d8bfd332a543b1dca92202c2b | Analyze and fix the following issue in the Linux kernel code: bcachefs: use u64 for folio end pos to avoid overflows | Problem Details:
Some of the folio_end_*() helpers are prone to overflow of signed
64-bit types because the mapping is only limited by the max value of
loff_t and the associated helpers return the start offset of the
next folio. Therefore, a folio_end_pos() of the max allowable folio in a
mapping returns a value that o... | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index acb2135a3235..7823141ea98b 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -78,7 +78,13 @@ static inline struct folio_vec bio_iter_iovec_folio(struct bio *bio,
#define bio_for_each_folio(bvl, bio, iter) \
__bio_for_each_folio(bvl, ... |
4ad6aa46e1c19c04e5542e8cca859d9aaa9e70b6 | Analyze and fix the following issue in the Linux kernel code: bcachefs: fix truncate overflow if folio is beyond EOF | Problem Details:
generic/083 occasionally reproduces a panic caused by an overflow
when accessing the bch_folio_sector array of the folio being
processed by __bch2_truncate_folio(). The immediate cause of the
overflow is that the folio offset is beyond i_size, and therefore
the sector index calculation underflows on su... | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index e805d8ce7bba..8477e1df3397 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2783,7 +2783,7 @@ retry:
goto err;
for_each_btree_key_upto_norestart(&trans, iter, BTREE_ID_extents, start, end, 0, k, ret)
- if (bkey_extent_is_data(k.k... |
34fdcf0632a5e549c5bfed1847a6d6995606ec17 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Check for folios that don't have bch_folio attached | Problem Details:
With large folios, it's now incidentally possible to end up with a
clean, uptodate folio in the page cache that doesn't have a bch_folio
attached, if a folio has to be split.
This patch fixes __bch2_truncate_folio() to check for this; other code
paths appear to handle it.
Signed-off-by: Kent Overstre... | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index af5f21a7a6d0..e805d8ce7bba 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -926,6 +926,8 @@ static void bch2_set_folio_dirty(struct bch_fs *c,
WARN_ON((u64) folio_pos(folio) + offset + len >
round_up((u64) i_size_read(&inode->v), bl... |
c437e1537916e3c0fcc04387888e402a5940e49c | Analyze and fix the following issue in the Linux kernel code: bcachefs: Add a bch_page_state assert | Problem Details:
Seeing an odd bug with page/folio state not being properly initialized,
this is to help track it down.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index d98b654c92b1..e25dbbf46107 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2682,6 +2682,8 @@ static int __bch2_truncate_page(struct bch_inode_info *inode,
goto unlock;
}
+ BUG_ON(!s->uptodate);
+
if (index != start >> PAGE_SHI... |
349b1d832ba534b802a28f316e40128c54643c32 | Analyze and fix the following issue in the Linux kernel code: bcachefs: use reservation for log messages during recovery | Problem Details:
If we block on journal reservation attempting to log journal
messages during recovery, particularly for the first message(s)
before we start doing actual work, chances are the filesystem ends
up deadlocked.
Allow logged messages to use reserved journal space to mitigate this
problem. In the worst case... | ```diff
diff --git a/fs/bcachefs/btree_update.h b/fs/bcachefs/btree_update.h
index 63ff824a72da..5d5321dd42e8 100644
--- a/fs/bcachefs/btree_update.h
+++ b/fs/bcachefs/btree_update.h
@@ -95,6 +95,7 @@ void bch2_trans_commit_hook(struct btree_trans *,
int __bch2_trans_commit(struct btree_trans *, unsigned);
int bch2... |
1546cf972709d9b10c39fdb3bff9da3f22a57226 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_get_key_or_hole() | Problem Details:
This fixes an off by one error, due to confusing closed vs. half open
intervals.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index aea6caa791ea..e5cbb4bce1ee 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -962,10 +962,17 @@ struct bkey_s_c bch2_get_key_or_hole(struct btree_iter *iter, struct bpos end, s
struct bpos nex... |
11f117374a2a353c378f8eccff8904d209643695 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Call bch2_path_put_nokeep() before bch2_path_put() | Problem Details:
bch2_path_put_nokeep() is sketchy, and we should consider removing it:
it unconditionally frees btree_paths once their ref hits 0.
The assumption is that we only use it for paths that have never been
visible outside the btree core btree code; i.e. higher level code will
never be making assumptions abo... | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 7b3e7f9368d1..0a62f55a3aa8 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -2722,12 +2722,12 @@ static inline void btree_path_list_add(struct btree_trans *trans,
void bch2_trans_iter_exit(struct btree_trans *trans,... |
030e9f9264a9d6bbbdb29ed20429bf943ed34315 | Analyze and fix the following issue in the Linux kernel code: bcachefs: drop unnecessary journal stuck check from space calculation | Problem Details:
The journal stucking check in bch2_journal_space_available() is
particularly aggressive and can lead to premature shutdown in some
rare cases. This is difficult to reproduce, but also comes along
with a fatal error and so is worthwhile to be cautious.
For example, we've seen instances where the journa... | ```diff
diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c
index a484a62f9cbd..29d843e6d6d4 100644
--- a/fs/bcachefs/journal_reclaim.c
+++ b/fs/bcachefs/journal_reclaim.c
@@ -210,24 +210,7 @@ void bch2_journal_space_available(struct journal *j)
clean = j->space[journal_space_clean].total;
t... |
db1bf7290591115e4d37428ff822c20a1694a69b | Analyze and fix the following issue in the Linux kernel code: bcachefs: refactor journal stuck checking into standalone helper | Problem Details:
bcachefs checks for journal stuck conditions both in the journal
space calculation code and the journal reservation slow path. The
logic in both places is rather tricky and can result in
non-deterministic failure characteristics and debug output.
In preparation to condense journal stuck handling to a ... | ```diff
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index 43bb1d4002bd..433c97844f36 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -75,6 +75,67 @@ static void journal_pin_list_init(struct journal_entry_pin_list *p, int count)
p->devs.nr = 0;
}
+/*
+ * Detect stuck journal conditi... |
23fd4f4dc622c36124515401d223607baec01a0d | Analyze and fix the following issue in the Linux kernel code: bcachefs: gracefully unwind journal res slowpath on shutdown | Problem Details:
bcachefs detects journal stuck conditions in a couple different
places. If the logic in the journal reservation slow path happens to
detect the problem, I've seen instances where the filesystem remains
deadlocked even though it has been shut down. This is occasionally
reproduced by generic/333, and usu... | ```diff
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index 801f09593e6b..43bb1d4002bd 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -162,6 +162,7 @@ void bch2_journal_halt(struct journal *j)
__journal_entry_close(j, JOURNAL_ENTRY_ERROR_VAL);
if (!j->err_seq)
j->err_seq = journal... |
873555f04d81b49a96ea03b37dcd499c13e67742 | Analyze and fix the following issue in the Linux kernel code: bcachefs: more aggressive fast path write buffer key flushing | Problem Details:
The btree write buffer flush code is prone to causing journal
deadlock due to inefficient use and release of reservation space.
Reservation is not pre-reserved for write buffered keys (as is done
for key cache keys, for example), because the write buffer flush
side uses a fast path that attempts insert... | ```diff
diff --git a/fs/bcachefs/btree_write_buffer.c b/fs/bcachefs/btree_write_buffer.c
index 80f4b9839bc2..9983a47853b9 100644
--- a/fs/bcachefs/btree_write_buffer.c
+++ b/fs/bcachefs/btree_write_buffer.c
@@ -109,9 +109,9 @@ int __bch2_btree_write_buffer_flush(struct btree_trans *trans, unsigned commit_f
struct jou... |
8bff9875a695ce9c6635693ff45fb3196688c1c6 | Analyze and fix the following issue in the Linux kernel code: bcachefs: use dedicated workqueue for tasks holding write refs | Problem Details:
A workqueue resource deadlock has been observed when running fsck
on a filesystem with a full/stuck journal. fsck is not currently
able to repair the fs due to fairly rapid emergency shutdown, but
rather than exit gracefully the fsck process hangs during the
shutdown sequence. Fortunately this is easil... | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 17bcebbd1f2a..23de3ecc6a1e 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -1760,7 +1760,7 @@ static void bch2_do_discards_work(struct work_struct *work)
void bch2_do_discards(struct bch_fs *c... |
ffc76edbbea3a55876fcd91d10db4ce38b27cac6 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_verify_bucket_evacuated() | Problem Details:
We were going into an infinite loop when printing out backpointers, due
to never incrementing bp_offset - whoops.
Also limit the number of backpointers we print to 10; this is debug code
and we only need to print a sample, not all of them.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index ff4a74de728d..9717fdce3ba5 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -627,6 +627,7 @@ void bch2_verify_bucket_evacuated(struct btree_trans *trans, struct bpos bucket,
struct printbuf buf = PRINTBUF;
struct bch_backpointer bp;
u64... |
d59ca7e8c072b4587113ced8e00358368f315626 | Analyze and fix the following issue in the Linux kernel code: bcachefs: verify_bucket_evacuated() -> set_btree_iter_dontneed() | Problem Details:
This should help with excessive 'would deadlock' transaction restarts.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index d94cefec9880..ff4a74de728d 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -629,6 +629,8 @@ void bch2_verify_bucket_evacuated(struct btree_trans *trans, struct bpos bucket,
u64 bp_offset = 0;
int ret;
+ bch2_trans_begin(trans);
+
bch... |
3e36e572f14bfa2bac80c3ba07af67e204eb7820 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an unhandled transaction restart error | Problem Details:
This is a bit awkward: we're passing around a btree_trans, but we're not
in a context where transaction restarts are handled - we should try to
come up with a better way to denote situations like this.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index 4a9ffca7be62..d94cefec9880 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -713,6 +713,11 @@ int __bch2_evacuate_bucket(struct btree_trans *trans,
bch2_bkey_buf_init(&sk);
+ /*
+ * We're not run in a context that handles transaction r... |
dc6274bcb87dbf50c62d9dbacba770bae2f10279 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix nocow write path closure bug | Problem Details:
With regular waitlists, we need to ensure we always call finish_wait().
With closures, the equivalent is that we need to call closure_sync()
before returning with a stack-allocated closure.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index ad22557197a6..cc2dfcf16dee 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -453,13 +453,13 @@ retry:
opts.data_replicas,
opts.data_replicas,
RESERVE_none, 0, &cl, &wp);
- if (bch2_err_matches(ret, BCH_ERR_operation_blocked)) {
+ if ... |
ac77810cb4ffd16976487d787e2f81ba9cb5fd0c | Analyze and fix the following issue in the Linux kernel code: bcachefs: Nocow write error path fix | Problem Details:
The nocow write error path was iterating over pointers in an extent,
aftre we'd dropped btree locks - oops.
Fortunately we'd already stashed what we need in nocow_lock_bucket, so
use that instead.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index 0c2d42eaba56..ad22557197a6 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -1481,7 +1481,7 @@ static void bch2_nocow_write(struct bch_write_op *op)
struct btree_iter iter;
struct bkey_s_c k;
struct bkey_ptrs_c ptrs;
- const struct bch_extent_p... |
abab7609de92c973bfa3ad069a622c0a107b6386 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_extent_fallocate() in nocow mode | Problem Details:
When we allocate disk space, we need to be incrementing the WRITE io
clock, which perhaps should be renamed to sectors allocated - copygc
uses this io clock to know when to run.
Also, we should be incrementing the same clock when allocating btree
nodes.
Signed-off-by: Kent Overstreet <kent.overstreet... | ```diff
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c
index d64a86f39595..a58d2a142b67 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -11,6 +11,7 @@
#include "btree_iter.h"
#include "btree_locking.h"
#include "buckets.h"
+#includ... |
9edbcc72f6987bbb58f113d04e7704b7a84106a6 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_evict_subvolume_inodes() | Problem Details:
This fixes a bug in bch2_evict_subvolume_inodes(): d_mark_dontcache()
doesn't handle the case where i_count is already 0, we need to grab and
put the inode in order for it to be dropped.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 05fc0f7434dd..c1f27b4910a0 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -971,6 +971,10 @@ struct bch_fs {
reflink_gc_table reflink_gc_table;
size_t reflink_gc_nr;
+ /* fs.c */
+ struct list_head vfs_inodes_list;
+ ... |
e1e7ecafe6482464ccc510afb38e1b9b306ce5dc | Analyze and fix the following issue in the Linux kernel code: bcachefs: Improve error handling in bch2_ioctl_subvolume_destroy() | Problem Details:
Pure style fixes
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fs-ioctl.c b/fs/bcachefs/fs-ioctl.c
index b51053130f28..269af9393824 100644
--- a/fs/bcachefs/fs-ioctl.c
+++ b/fs/bcachefs/fs-ioctl.c
@@ -451,19 +451,20 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp,
return ret;
if (path.dentry->d_sb->s_fs_info !... |
2d33036ca9360bacef23ba32e7768ff9ea87f2be | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix for 'missing subvolume' error | Problem Details:
Subvolumes, including their root inodes, get deleted asynchronously
after an unlink. But we still need to ensure that we tell the VFS the
inode has been deleted, otherwise VFS writeback could fire after
asynchronous deletion has finished, and try to write to an
inode/subvolume that no longer exists.
S... | ```diff
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 15ab77ebb8c6..828887abc261 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -442,19 +442,27 @@ int __bch2_unlink(struct inode *vdir, struct dentry *dentry,
bch2_trans_init(&trans, c, 4, 1024);
ret = commit_do(&trans, NULL, NULL,
- BTREE... |
56cc033dfcf002eb8a957097fe7290546829b7c0 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Don't run transaction hooks multiple times | Problem Details:
transaction hooks aren't supposed to run unless we know the transaction
is going to commit succesfully: this fixes a bug with attempting to
delete a subvolume multiple times.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index 19efd484fc9d..f608e1c92285 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -622,14 +622,6 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
prefetch(&trans->c... |
26559553e47c9f2a14b5254cb307fc755ac316c8 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Add a fallback when journal_keys doesn't fit in ram | Problem Details:
We may end up in a situation where allocating the buffer for the sorted
journal_keys fails - but it would likely succeed, post compaction where
we drop duplicates.
We've had reports of this allocation failing, so this adds a slowpath to
do the compaction incrementally.
This is only a band-aid fix; we... | ```diff
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 73f7663cbd3f..6aa99f57a001 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -476,6 +476,26 @@ void bch2_journal_keys_free(struct journal_keys *keys)
keys->nr = keys->gap = keys->size = 0;
}
+static void __journal_keys_sor... |
b40901b0f7182557851c8e9af31bacfbbd76b1ec | Analyze and fix the following issue in the Linux kernel code: bcachefs: New erasure coding shutdown path | Problem Details:
This implements a new shutdown path for erasure coding, which is needed
for the upcoming BCH_WRITE_WAIT_FOR_EC write path.
The process is:
- Cancel new stripes being built up
- Close out/cancel open buckets on write points or the partial list
that are for stripes
- Shutdown rebalance/copygc
- T... | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index e5abe6406afe..17bcebbd1f2a 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -2158,44 +2158,7 @@ void bch2_dev_allocator_remove(struct bch_fs *c, struct bch_dev *ca)
*/
bch2_recalc_capacity(... |
872c0311675bdb73b29ee74c7f27afc82d4918e9 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_check_extents_to_backpointers() | Problem Details:
In rare cases, bch2_check_extents_to_backpointers() would incorrectly
flag an extent has having a missing backpointer when we just needed to
flush the btree write buffer - we weren't tracking the last flushed
position correctly.
This adds a level field to the last_flushed pos, fixing a bug where we'd
... | ```diff
diff --git a/fs/bcachefs/backpointers.c b/fs/bcachefs/backpointers.c
index a40c26125d2a..8517c5635226 100644
--- a/fs/bcachefs/backpointers.c
+++ b/fs/bcachefs/backpointers.c
@@ -549,13 +549,18 @@ int bch2_check_btree_backpointers(struct bch_fs *c)
bch2_check_btree_backpointer(&trans, &iter, k)));
}
+st... |
c639c29ce6882f4f77a81d778ef4741d5a5979d9 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an assert in copygc thread shutdown path | Problem Details:
We're not supposed to have nested (locked) btree_trans on the stack:
this means copygc shutdown needs to exit our btree_trans before exiting
the move_ctxt, which calls bch2_write().
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/movinggc.c b/fs/bcachefs/movinggc.c
index 4d8d013fe4fc..4762594f6287 100644
--- a/fs/bcachefs/movinggc.c
+++ b/fs/bcachefs/movinggc.c
@@ -334,8 +334,8 @@ static int bch2_copygc_thread(void *arg)
wake_up(&c->copygc_running_wq);
}
- bch2_moving_ctxt_exit(&ctxt);
bch2_trans_exit(&... |
3997989ae1541dea4bb144bd2bf8b7dc6cae743f | Analyze and fix the following issue in the Linux kernel code: bcachefs: Don't use BTREE_ITER_INTENT in make_extent_indirect() | Problem Details:
This is a workaround for a btree path overflow - searching with
BTREE_ITER_INTENT periodically saves the iterator position for updates,
which eventually overflows.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/reflink.c b/fs/bcachefs/reflink.c
index d2e6adc13fb1..d8426e754cdf 100644
--- a/fs/bcachefs/reflink.c
+++ b/fs/bcachefs/reflink.c
@@ -189,7 +189,7 @@ static int bch2_make_extent_indirect(struct btree_trans *trans,
for_each_btree_key_norestart(trans, reflink_iter, BTREE_ID_reflink,
... |
aebe7a679cbdd827769e85f632562a66d2a2b9f3 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix stripe create error path | Problem Details:
If we errored out on a new stripe before fully allocating it, we
shouldn't be zeroing out unwritten data.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index 9ee29dac48ba..74cfd9edd680 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -1078,13 +1078,15 @@ static void ec_stripe_create(struct ec_stripe_new *s)
closure_sync(&s->iodone);
- for (i = 0; i < nr_data; i++)
- if (s->blocks[i]) {
- ob = c->... |
ae1f56238d55ad6d16564455559d1fa9a8cea2f6 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Mark new snapshots earlier in create path | Problem Details:
This fixes a null ptr deref when creating new snapshots:
bch2_create_trans() will lookup the subvolume and find the _new_
snapshot in the BCH_CREATE_SUBVOL path that's being created in that
transaction.
We have to call bch2_mark_snapshot() earlier so that it's properly
initialized, instead of leaving ... | ```diff
diff --git a/fs/bcachefs/subvolume.c b/fs/bcachefs/subvolume.c
index d76239654a89..bcc67c0f5dfc 100644
--- a/fs/bcachefs/subvolume.c
+++ b/fs/bcachefs/subvolume.c
@@ -513,7 +513,9 @@ int bch2_snapshot_node_create(struct btree_trans *trans, u32 parent,
n->v.pad = 0;
SET_BCH_SNAPSHOT_SUBVOL(&n->v, true);
... |
46e14854fca4a262a823079c1958a204f983fa4e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix next_bucket() | Problem Details:
This fixes an infinite loop in bch2_get_key_or_real_bucket_hole().
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index ce0ea4886288..e5abe6406afe 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -1006,7 +1006,7 @@ static bool next_bucket(struct bch_fs *c, struct bpos *bucket)
iter = bucket->inode;
ca = __bch... |
adac06fad3333f9b9638ad9271346065d69e9c79 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Verbose on by default when CONFIG_BCACHEFS_DEBUG=y | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/opts.h b/fs/bcachefs/opts.h
index afbf82d62977..719693b333da 100644
--- a/fs/bcachefs/opts.h
+++ b/fs/bcachefs/opts.h
@@ -92,6 +92,12 @@ enum opt_type {
#define RATELIMIT_ERRORS_DEFAULT false
#endif
+#ifdef CONFIG_BCACHEFS_DEBUG
+#define BCACHEFS_VERBOSE_DEFAULT true
+#else
+#define... |
4b5b13da527b1ce02ee9a96382684496e8d83696 | Analyze and fix the following issue in the Linux kernel code: six locks: be more careful about lost wakeups | Problem Details:
This is a workaround for a lost wakeup bug we've been seeing - we still
need to discover the actual bug.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/six.c b/fs/bcachefs/six.c
index e1e9df0368b6..b54a2ac480c8 100644
--- a/fs/bcachefs/six.c
+++ b/fs/bcachefs/six.c
@@ -142,8 +142,17 @@ static int __do_six_trylock_type(struct six_lock *lock,
* lock, issue a wakeup because we might have caused a
* spurious trylock failure:
*/... |
2640faeb1741db94b717d2678f6cd644f90e3061 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Journal resize fixes | Problem Details:
- Fix a sleeping-in-atomic bug due to calling
bch2_journal_buckets_to_sb() under the journal lock.
- Additionally, now we mark buckets as journal buckets before adding
them to the journal in memory and the superblock. This ensures that
if we crash part way through we'll never be writing to jo... | ```diff
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index c7139dd8e1dc..19b4e2bde399 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -1855,7 +1855,7 @@ static int __bch2_trans_mark_metadata_bucket(struct btree_trans *trans,
if (IS_ERR(a))
return PTR_ERR(a);
- if (a->v.data_type &... |
26bab33b6974d42f5db6d2b7c2198e3af4993cf8 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix "btree node in stripe" error | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index f131a70f282f..e9470c06b1fa 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -915,6 +915,9 @@ static int ec_stripe_update_extent(struct btree_trans *trans,
b = bch2_backpointer_get_node(trans, &node_iter, bucket, *bp_offset, bp);
bch2_trans_iter... |
8fcdf81418f16ef878de7a7535e90599e396fd69 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Improved copygc pipelining | Problem Details:
This improves copygc pipelining across multiple buckets: we now track
each in flight bucket we're evacuating, with separate moving_contexts.
This means that whereas previously we had to wait for outstanding moves
to complete to ensure we didn't try to evacuate the same bucket twice,
we can now just ch... | ```diff
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index 89d6635e2169..3a650bc4173a 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -40,18 +40,19 @@ static void progress_list_del(struct bch_fs *c, struct bch_move_stats *stats)
}
struct moving_io {
- struct list_head list;
- struct closure cl;... |
5be6a274ff7a7cd9640555db63d60127c6434e1a | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix stripe reuse path | Problem Details:
It's possible that we reuse a stripe that doesn't have quite the same
configuration as the stripe_head we're allocating from. In that case, we
have to make sure that the new stripe uses the settings from the stripe
we resue, not the stripe head, and make sure the buffer is allocated
correctly.
This fi... | ```diff
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index 6bf14f975d93..a2facb2f9fc1 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -213,8 +213,9 @@ static void ec_stripe_buf_exit(struct ec_stripe_buf *buf)
}
}
+/* XXX: this is a non-mempoolified memory allocation: */
static int ec_stripe_buf_init(s... |
9d32097f3b6617680c75ccbb5cd36d89bcff0dfc | Analyze and fix the following issue in the Linux kernel code: bcachefs: More stripe create cleanup/fixes | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c
index df4cdd16c08d..f6db56765f38 100644
--- a/fs/bcachefs/btree_gc.c
+++ b/fs/bcachefs/btree_gc.c
@@ -1702,11 +1702,12 @@ static int bch2_gc_write_stripes_key(struct btree_trans *trans,
return 0;
inconsistent:
if (fsck_err_on(true, c,
- "stripe... |
3329cf1bb91d6293a96cf35ad72b2a2e1e1c0e3d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Centralize btree node lock initialization | Problem Details:
This fixes some confusion in the lockdep code due to initializing btree
node/key cache locks with the same lockdep key, but different names.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index 76cad6109297..9b331c319acc 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -119,8 +119,7 @@ static struct btree *__btree_node_mem_alloc(struct bch_fs *c, gfp_t gfp)
return NULL;
bkey_btree_ptr_init(&b->key)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.