id stringlengths 40 40 | instruction stringlengths 68 308 | input stringlengths 17 33.4k | output stringlengths 100 30k |
|---|---|---|---|
bd2bb273a09b93e2a7d79d30458ab5f6f0b3757a | Analyze and fix the following issue in the Linux kernel code: bcachefs: Don't deadlock when btree node reuse changes lock ordering | Problem Details:
Btree node lock ordering is based on the logical key. However, 'struct
btree' may be reused for a different btree node under memory pressure.
This patch uses the new six lock callback to check if a btree node is no
longer the node we wanted to lock before blocking.
Signed-off-by: Kent Overstreet <kent... | ```diff
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index d31017de53aa..9423cff1539f 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -678,6 +678,14 @@ static noinline struct btree *bch2_btree_node_fill(struct bch_fs *c,
return b;
}
+static int lock_node_check_fn(str... |
515282ac7d847d567dd3ba802edf34316368bb14 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a deadlock | Problem Details:
__bch2_btree_node_lock() was incorrectly using iter->pos as a proxy for
btree node lock ordering, this caused an off by one error that was
triggered by bch2_btree_node_get_sibling() getting the previous node.
This refactors the code to compare against btree node keys directly.
Signed-off-by: Kent Ove... | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index bed0bb67a85d..35fe7db50fb5 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -101,7 +101,7 @@ bool __bch2_btree_node_relock(struct btree_iter *iter, unsigned level)
if (six_relock_type(&b->c.lock, want, iter->l[leve... |
966885ee409d128e2561e4c3546f4187ee173389 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a linked list bug | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 4f244f983f35..8f4087db7b67 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -803,7 +803,7 @@ void bch2_btree_interior_update_will_free_node(struct btree_update *as,
* oper... |
40ca39b56448ecf05e7b4b6c921968e8648f8f0b | Analyze and fix the following issue in the Linux kernel code: bcachefs: btree_update_nodes_written() requires alloc reserve | Problem Details:
Also, in the btree_update_start() path, if we already have a journal
pre-reservation we don't want to take another - that's a deadlock.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 7d63c457a3bf..4f244f983f35 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -529,6 +529,8 @@ static void btree_update_nodes_written(struct btree_update *as)
*/
ret = bch... |
f96c0df4dbb0ed845bbc51f341d00bc90368c93c | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a deadlock in bch2_btree_node_get_sibling() | Problem Details:
There was a bad interaction with bch2_btree_iter_set_pos_same_leaf(),
which can leave a btree node locked that is just outside iter->pos,
breaking the lock ordering checks in __bch2_btree_node_lock(). Ideally
we should get rid of this corner case, but for now fix it locally with
verbose comments.
Sign... | ```diff
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index ef7ca552a0a3..fa55bab5944e 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -851,6 +851,18 @@ struct btree *bch2_btree_node_get_sibling(struct bch_fs *c,
if (!parent)
return NULL;
+ /*
+ * There's a corner ... |
495aabede3ff594c5eda98cb9f4463502cb48cad | Analyze and fix the following issue in the Linux kernel code: bcachefs: Add debug code to print btree transactions | Problem Details:
Intented to help debug deadlocks, since we can't use lockdep to check
btree node lock ordering.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index a90072508819..dd34f30f01e5 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -628,6 +628,9 @@ struct bch_fs {
struct workqueue_struct *btree_interior_update_worker;
struct work_struct btree_interior_update_work;
+ /* btre... |
039fc4c5221f7433d8383e25a7c70b30793b4916 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fixes for going RO | Problem Details:
Now that interior btree updates are fully transactional, we don't need
to write out alloc info in a loop. However, interior btree updates do
put more things in the journal, so we still need a loop in the RO
sequence.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overst... | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 38173f662d1e..09a719b256b3 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -869,6 +869,15 @@ static int bch2_invalidate_one_bucket2(struct btree_trans *trans,
if (!invalidating_cached_data)
... |
beb6db68a555d14b4b3a7b894d6d635774bcdafd | Analyze and fix the following issue in the Linux kernel code: bcachefs: fsck_error_lock requires GFP_NOFS | Problem Details:
this fixes a lockdep splat
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/error.c b/fs/bcachefs/error.c
index 5a5cfee623e2..1662a36244cd 100644
--- a/fs/bcachefs/error.c
+++ b/fs/bcachefs/error.c
@@ -85,7 +85,7 @@ enum fsck_err_ret bch2_fsck_err(struct bch_fs *c, unsigned flags,
if (s->fmt == fmt)
goto found;
- s = kzalloc(sizeof(*s), GFP_KERNEL);
+ ... |
b29303966b9e07dda5f21c667909eb87849453f2 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix reading of alloc info after unclean shutdown | Problem Details:
When updates to interior nodes started being journalled, that meant that
after an unclean shutdown, until journal replay is done we can't walk
the btree without overlaying the updates from the journal.
The initial btree gc was changed to walk the btree overlaying keys from
the journal - but bch2_alloc... | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 559b9be50952..a08ae42cc073 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -208,29 +208,25 @@ void bch2_alloc_to_text(struct printbuf *out, struct bch_fs *c,
get_alloc_field(a.v, &d,... |
692c3f0601bd1b04b914a40907a36e4c36dc8edd | Analyze and fix the following issue in the Linux kernel code: bcachefs: fix memalloc_nofs_restore() usage | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 4ff57925fb2c..ef7ca552a0a3 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -554,7 +554,6 @@ out_unlock:
list_del_init(&b->list);
mutex_unlock(&bc->lock);
- memalloc_nofs_restore(flags);
out:
b->flags = 0... |
aafcf9bc12f479b47f4bc1f008f4002dd1af91b8 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Better error messages on bucket sector count overflows | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 59af44f7eab6..1a97a74b36c8 100644
--- a/fs/bcachefs/btree_gc.c
+++ b/fs/bcachefs/btree_gc.c
@@ -581,8 +581,10 @@ static int bch2_gc_done(struct bch_fs *c,
#define copy_bucket_field(_f) \
if (dst->b[b].mark._f != src->b[b].mark._f) { \
... |
dc744b51f97ce043d07ebfdd0397b323396c7683 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Handle printing of null bkeys | Problem Details:
This fixes a null ptr deref.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bkey_methods.c b/fs/bcachefs/bkey_methods.c
index 55ef4032b37c..36e0c5152b47 100644
--- a/fs/bcachefs/bkey_methods.c
+++ b/fs/bcachefs/bkey_methods.c
@@ -176,13 +176,17 @@ void bch2_bpos_to_text(struct printbuf *out, struct bpos pos)
void bch2_bkey_to_text(struct printbuf *out, const... |
22d8a33d30d7a28d0dd972f36cc48b80f585d67b | Analyze and fix the following issue in the Linux kernel code: bcachefs: fix stack corruption | Problem Details:
When a bkey_on_stack is passed to bch_read_indirect_extent, there is no
guarantee that it will be big enough to hold the bkey. And
bch_read_indirect_extent is not aware of bkey_on_stack to call realloc
on it. This cause a stack corruption.
This commit makes bch_read_indirect_extent aware of bkey_on_st... | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 9644d4624f80..7ce6d71aca29 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -788,7 +788,7 @@ retry:
sectors = k.k->size - offset_into_extent;
ret = bch2_read_indirect_extent(trans,
- &offset_into_extent, sk.k);
+ &offset_i... |
a1b0da4555c16bf274f705dc76c9b297f54bf6c8 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Wrap vmap() in memalloc_nofs_save()/restore() | Problem Details:
vmalloc() and vmap() don't take GFP_NOFS - this should be pushed further
up the IO path, but for now just doing the simple fix.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/compress.c b/fs/bcachefs/compress.c
index 20bde73a17a8..6115e0294e4d 100644
--- a/fs/bcachefs/compress.c
+++ b/fs/bcachefs/compress.c
@@ -7,6 +7,7 @@
#include "super-io.h"
#include <linux/lz4.h>
+#include <linux/sched/mm.h>
#include <linux/zlib.h>
#include <linux/zstd.h>
@@ -63,... |
0d0e77f45fe806a80af76501d5422437692e158b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix another iterator counting bug | Problem Details:
We were marking the end of where we could insert incorrectly for
indirect extents.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/extent_update.c b/fs/bcachefs/extent_update.c
index d0af1bc17018..fd011df3cb99 100644
--- a/fs/bcachefs/extent_update.c
+++ b/fs/bcachefs/extent_update.c
@@ -76,7 +76,8 @@ static int count_iters_for_insert(struct btree_trans *trans,
if (*nr_iters >= max_iters) {
struct bpos p... |
d3baf289dce56f78700ca9dc64153263652c9a0a | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix setquota | Problem Details:
We were returning -EINTR because we were failing to retry the btree
transaction.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/quota.c b/fs/bcachefs/quota.c
index e7787c5063ce..d3032a46e7f3 100644
--- a/fs/bcachefs/quota.c
+++ b/fs/bcachefs/quota.c
@@ -710,25 +710,15 @@ found:
return ret;
}
-static int bch2_set_quota(struct super_block *sb, struct kqid qid,
- struct qc_dqblk *qdq)
+static int bch2_set_... |
4167b4cdba30fb8db190a3439324f413dc08a0c0 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a workqueue deadlock | Problem Details:
writes running out of a workqueue (via dio path) could block and prevent
other writes from calling bch2_write_index() and completing.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index 3dcb166afa23..7df2b6c3f168 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -604,7 +604,9 @@ static void bch2_write_index(struct closure *cl)
__bch2_write_index(op);
- if (!op->error && (op->flags & BCH_WRITE_FLUSH)) {
+ if (!(op->flags & BCH_W... |
a9310ab06c0b4a0c199e569dd34579b74b9142d0 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fixes for startup on very full filesystems | Problem Details:
- Always pass BTREE_INSERT_USE_RESERVE when writing alloc btree keys
- Don't strand buckest on the copygc freelist until after recovery is
done and we're starting copygc.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 9ce53164d9ac..559b9be50952 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -315,7 +315,9 @@ retry:
bch2_trans_update(trans, iter, &a->k_i,
BTREE_TRIGGER_NORUN);
ret = bch2_trans_commi... |
d9b59a57cc81b1a73ff094401e9d65326cf0156b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix initialization of bounce mempools | Problem Details:
When they were converted to kvpmalloc pools they weren't converted to
pass the actual size of the allocation. Oops.
Also, validate the real length in the zstd decompression path.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/compress.c b/fs/bcachefs/compress.c
index 41d0b49d354f..20bde73a17a8 100644
--- a/fs/bcachefs/compress.c
+++ b/fs/bcachefs/compress.c
@@ -191,20 +191,21 @@ static int __bio_uncompress(struct bch_fs *c, struct bio *src,
}
case BCH_COMPRESSION_TYPE_zstd: {
ZSTD_DCtx *ctx;
- size_t... |
bc970cecd86d5a77f58e3be017fd80276e71677e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix two more deadlocks | Problem Details:
Deadlock on shutdown:
btree_update_nodes_written() unblocks btree nodes from being written;
after doing so, it has to check if they were marked as needing to be
written and if so kick off those writes - if that doesn't happen, we'll
never release journal pins and shutdown will get stuck when flushing ... | ```diff
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
index 04537eb06e4a..32bd193a85c5 100644
--- a/fs/bcachefs/btree_io.c
+++ b/fs/bcachefs/btree_io.c
@@ -1626,6 +1626,11 @@ void __bch2_btree_node_write(struct bch_fs *c, struct btree *b,
* reflect that those writes were done and the data flushed from... |
5b6d505a77f87a4e7d13430920499c6e58928f27 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix another deadlock in btree_update_nodes_written() | Problem Details:
We also can't be blocking on btree node write locks while holding
btree_interior_update_lock.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 153d13b9c96e..1f0d95558858 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -609,6 +609,19 @@ static void bch2_btree_update_free(struct btree_update *as)
mutex_unlock(&c->b... |
6f2b9074d7511e23fec4e6a3e3f47184480b0a58 | Analyze and fix the following issue in the Linux kernel code: bcachefs: More fixes for counting extent update iterators | Problem Details:
This is unfortunately really fragile - hopefully we'll be able to think
of a new approach at some point.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/extent_update.c b/fs/bcachefs/extent_update.c
index 2a7d913bdda3..d0af1bc17018 100644
--- a/fs/bcachefs/extent_update.c
+++ b/fs/bcachefs/extent_update.c
@@ -34,16 +34,10 @@ static int count_iters_for_insert(struct btree_trans *trans,
unsigned offset,
struct bpos *end,
... |
bbe65614b7bffaeff5213cb782743e7de3be48d1 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a deadlock | Problem Details:
btree_node_lock_increment() was incorrectly skipping over the current
iter when checking if we should increment a node we already have locked.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_locking.h b/fs/bcachefs/btree_locking.h
index a164924ca656..3b199e2e1e9e 100644
--- a/fs/bcachefs/btree_locking.h
+++ b/fs/bcachefs/btree_locking.h
@@ -164,8 +164,7 @@ static inline bool btree_node_lock_increment(struct btree_iter *iter,
struct btree_iter *linked;
trans_for_... |
41697f382cffc0e396dd832d19c78e69cdd10aa3 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix for the bkey compat path | Problem Details:
In the write path, we were calling bch2_bkey_ops.compat() in the wrong
place.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bkey_methods.c b/fs/bcachefs/bkey_methods.c
index c97e1e9002cb..55ef4032b37c 100644
--- a/fs/bcachefs/bkey_methods.c
+++ b/fs/bcachefs/bkey_methods.c
@@ -283,49 +283,64 @@ void __bch2_bkey_compat(unsigned level, enum btree_id btree_id,
const struct bkey_ops *ops;
struct bkey uk;
s... |
94035eed52f58a321fa28e938898535973bec847 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a locking bug in bch2_journal_pin_copy() | Problem Details:
There was a race where the src pin would be flushed - releasing the last
pin on that sequence number - before adding the new journal pin. Oops.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 5233cb82d422..341106ab4a77 100644
--- a/fs/bcachefs/journal_reclaim.c
+++ b/fs/bcachefs/journal_reclaim.c
@@ -322,14 +322,12 @@ void bch2_journal_pin_drop(struct journal *j,
spin_unlock(&j->lock);
}
-void __bch2_journal_pin_ad... |
58fb3e519a7612a01d9fc969aa4eca56b30d898e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix another deadlock in the btree interior update path | Problem Details:
Can't take read locks on btree nodes while holding
btree_interior_update_lock. Also, fix a bug where we were leaking
journal prereservations.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 daa4c0716c05..772595b3da9f 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -609,33 +609,11 @@ static void bch2_btree_update_free(struct btree_update *as)
mutex_unlock(&c->... |
1eba942d1c48a9d3dadbb04f65be7705f506e40b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a locking bug in bch2_btree_ptr_debugcheck() | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c
index 1189c6107c88..52beaab227ef 100644
--- a/fs/bcachefs/extents.c
+++ b/fs/bcachefs/extents.c
@@ -179,7 +179,7 @@ void bch2_btree_ptr_debugcheck(struct bch_fs *c, struct bkey_s_c k)
return;
bch2_fs_inconsistent_on(!test_bit(BCH_FS_REBUILD_REPLI... |
e77e4efce31f3739fa85a84c5197b7cd18747a64 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Account for ioclock slop when throttling rebalance thread | Problem Details:
This should fix an issue where the rebalance thread was spinning
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/rebalance.c b/fs/bcachefs/rebalance.c
index a0a75cfa41cb..eb3f7d02c791 100644
--- a/fs/bcachefs/rebalance.c
+++ b/fs/bcachefs/rebalance.c
@@ -204,17 +204,21 @@ static int bch2_rebalance_thread(void *arg)
prev_run_time;
if (w.dev_most_full_percent < 20 && throttle > 0) {
- r->... |
0f9dda478fb50bb7c55e4760158a6ef7cca7cb04 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a deadlock on starting an interior btree update | Problem Details:
Not legal to block on a journal prereservation with btree locks held.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 6220ec9b540b..e4c1b90f3cb5 100644
--- a/fs/bcachefs/btree_gc.c
+++ b/fs/bcachefs/btree_gc.c
@@ -935,7 +935,7 @@ static void bch2_coalesce_nodes(struct bch_fs *c, struct btree_iter *iter,
return;
}
- as = bch2_btree_update_start(c, iter->b... |
1e3b1f9a229df5cd8f21e2f6306fbcf25374f42a | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a debug mode assertion | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 8b31f4d63094..677be20f7965 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -45,6 +45,8 @@ static void btree_node_interior_verify(struct btree *b)
while (1) {
k = bch2... |
2aec5955bb7c800a4eec685dcd58976013da1275 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a debug assertion | Problem Details:
This assertion was passing the wrong btree node type when inserting into
interior nodes.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 b9283ced4cae..a93bc1890263 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -250,7 +250,8 @@ static inline void btree_insert_entry_checks(struct btree_trans *trans,
BUG_ON(bkey_cmp(inser... |
8707ab0df25955f4e11bf60643e08c018a72e6fc | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix another error path locking bug | Problem Details:
btree_update_nodes_written() was leaking a btree node lock on failure to
get a journal reservation.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 d5bea4f8ea02..8b31f4d63094 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -725,7 +725,7 @@ again:
bch2_journal_res_put(&c->journal, &res);
bch2_journal_preres_put(&c-... |
75923ba7ad56f7236ae3979577011f5220d07d50 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a null ptr deref during journal replay | Problem Details:
We were calling bch2_extent_can_insert() incorrectly; it should only be
called when the extents-to-keys pass is running because that's when we
could be splitting a compressed extent. Calling bch2_extent_can_insert()
without passing in a disk reservation was causing a null ptr deref.
Signed-off-by: Ken... | ```diff
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index 1e6675f68b4a..b9283ced4cae 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -309,7 +309,7 @@ btree_key_can_insert(struct btree_trans *trans,
if (unlikely(btree_node_old_extent_overwrite(b)... |
0329b1507d37c8a7f87dace9ad888cc5abb7c8a8 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Trace where btree iterators are allocated | Problem Details:
This will help with iterator overflow bugs.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 4ce6a66edcd5..7b12bd163df7 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1912,13 +1912,14 @@ static struct btree_iter *btree_trans_iter_alloc(struct btree_trans *trans)
struct btree_iter *iter;
trans_for_... |
283eda5798bc5f4f593817e057c14f02790e5bdb | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix fallocate FL_INSERT_RANGE | Problem Details:
This was another bug because of bch2_btree_iter_set_pos() invalidating
iterators.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 726c55072b7b..e713c83530cc 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2484,10 +2484,8 @@ reassemble:
bkey_on_stack_reassemble(©, c, k);
if (insert &&
- bkey_cmp(bkey_start_pos(k.k), move_pos) < 0) {
+ bkey_cmp... |
501e1bda3e58db75eaf938fde70b03639dd6282a | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix journalling of interior node updates | Problem Details:
We weren't journalling updates done while splitting/compacting nodes -
oops.
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 e8dd19cae7ca..d5bea4f8ea02 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -27,43 +27,37 @@ static void btree_update_drop_new_node(struct bch_fs *, struct btree *);
/* De... |
b58a181d5c4a145730f202ac0375fa463c88f710 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix iterating of journal keys within a btree node | Problem Details:
Extent btrees no longer have weird special behaviour for min_key.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index c0e6cfa36c89..8e9d412a6000 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -183,17 +183,12 @@ void bch2_btree_and_journal_iter_init_node_iter(struct btree_and_journal_iter *i
struct journal_keys *journal_keys,
s... |
11f6ed36b959131a0d990253f07e5105fc4d8901 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a locking bug | Problem Details:
Dropping the wrong kind of lock can't lead to anything good...
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_io.h b/fs/bcachefs/btree_io.h
index fa996fdc5474..f3d7ec749b61 100644
--- a/fs/bcachefs/btree_io.h
+++ b/fs/bcachefs/btree_io.h
@@ -114,7 +114,7 @@ static inline void btree_node_write_if_need(struct bch_fs *c, struct btree *b,
break;
}
- six_unlock_read(&b->c.lock);
+ s... |
1d60b99999bc2abd4020b758794ced8af43394ae | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix inodes pass in fsck | Problem Details:
It wasn't updated for the patch that switched inodes to using the offset
field of struct bkey.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index c7508e81188c..3ab621c62c43 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -1353,18 +1353,18 @@ static int bch2_gc_walk_inodes(struct bch_fs *c,
bch2_trans_init(&trans, c, BTREE_ITER_MAX, 0);
iter = bch2_trans_get_iter(&trans, BTREE_ID... |
e5e6aaa7979ab588868f686c8bd8997264492610 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix ec_stripe_update_ptrs() | Problem Details:
bch2_btree_iter_set_pos() invalidates the key returned by peek().
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index bc11f7e056eb..909a4a5036ab 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -804,8 +804,6 @@ static int ec_stripe_update_ptrs(struct bch_fs *c,
continue;
}
- bch2_btree_iter_set_pos(iter, bkey_start_pos(k.k));
-
dev = s->key.v.ptrs[idx].... |
a0e491c099a25d06759bf8e6e9bcc6fd7c4229a5 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Don't allocate memory while holding journal reservation | Problem Details:
This fixes a lockdep splat - allocating memory can call
bch2_clear_page_bits() which takes mark_lock.
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 f09423c83c4a..e8dd19cae7ca 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -713,13 +713,6 @@ again:
bch2_btree_add_journal_pin(c, b, res.seq);
six_unlock_write(&b->c... |
2c31e6572ec6f3fede0d4bb54f342bafba90fe70 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Reduce max nr of btree iters when lockdep is on | Problem Details:
This is so we don't overflow MAX_LOCK_DEPTH.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h
index a794f9fe4fce..71b6b36e513d 100644
--- a/fs/bcachefs/btree_types.h
+++ b/fs/bcachefs/btree_types.h
@@ -275,7 +275,11 @@ struct btree_insert_entry {
struct btree_iter *iter;
};
+#ifndef CONFIG_LOCKDEP
#define BTREE_ITER_MAX 64
+#else
... |
22f776985f34334b3bbba75b71ecca711f34e3f4 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Use kvpmalloc mempools for compression bounce | Problem Details:
This fixes an issue where mounting would fail because of memory
fragmentation - previously the compression bounce buffers were using
get_free_pages().
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/compress.c b/fs/bcachefs/compress.c
index 117afac3db1a..89eb03a988f1 100644
--- a/fs/bcachefs/compress.c
+++ b/fs/bcachefs/compress.c
@@ -17,7 +17,6 @@ struct bbuf {
BB_NONE,
BB_VMAP,
BB_KMALLOC,
- BB_VMALLOC,
BB_MEMPOOL,
} type;
int rw;
@@ -33,17 +32,7 @@ static stru... |
56a40fbc4e398c00e8b667f9c30b40b7695065f3 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Various fixes for interior update path | Problem Details:
The locking was wrong, and we could get a use after free in the error
path where we weren't taking the entrie being freed off the unwritten
list.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 68deb4eb31a6..3f9605f2f1f4 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -581,7 +581,7 @@ err_free:
/* Asynchronous interior node update machinery */
-static void bch... |
f1d786a0dbc4483d176985ebe8f82fb7cdeec429 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Add an option for keeping journal entries after startup | Problem Details:
This will be used by the userspace debug tools.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 32cdf87ee55d..5304b6762179 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -523,6 +523,18 @@ struct journal_seq_blacklist_table {
} entries[0];
};
+struct journal_keys {
+ struct journal_key {
+ enum btree_id btree_id... |
2f194e1697f733a2eae1d040eabe71b05c049e0b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an assertion when nothing to replay | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index b4d9e1f98059..27c9ba3382f9 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -449,7 +449,8 @@ static int bch2_journal_replay(struct bch_fs *c,
sort(keys.d, keys.nr, sizeof(keys.d[0]), journal_sort_seq_cmp, NULL);
- replay... |
0728eed7b6ec673d2b6e0f86b6daf240a2948292 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a locking bug in fsck | Problem Details:
This works around a btree locking issue - we can't be holding read locks
while taking write locks, which currently means we can't have live
iterators holding read locks at commit time.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index 902c8da9dc15..936e6366cb04 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -478,7 +478,8 @@ static int check_extents(struct bch_fs *c)
bch_verbose(c, "checking extents");
iter = bch2_trans_get_iter(&trans, BTREE_ID_EXTENTS,
- POS... |
fa4dc3987b8e75ec1bfd327bb05755d153c276d6 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix count_iters_for_insert() | Problem Details:
This fixes a transaction iterator overflow.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/extent_update.c b/fs/bcachefs/extent_update.c
index beb3b694e33c..8e5070d5a39b 100644
--- a/fs/bcachefs/extent_update.c
+++ b/fs/bcachefs/extent_update.c
@@ -44,6 +44,10 @@ static int count_iters_for_insert(struct btree_trans *trans,
* extent we're inserting and overwriting:
*/
... |
8666a9ad6facc153d143728c8b47aae1e8111cd6 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an iterator bug | Problem Details:
We were incorrectly not restarting the transaction when re-traversing
iterators.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 5f918c6c3efb..8b1395ef4d0e 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1068,7 +1068,14 @@ retry_all:
goto retry_all;
}
- ret = hweight64(trans->iters_live) > 1 ? -EINTR : 0;
+ if (hweight64(trans->iters_l... |
716254b8a1af9b687547f60b9dc8f925237654d3 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix another iterator leak | Problem Details:
This updates bch2_rbio_narrow_crcs() to the current style for
transactional btree code, and fixes a rare panic on iterator overflow.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index 717332072d87..2ec7203e5824 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -1701,33 +1701,39 @@ static void bch2_rbio_error(struct bch_read_bio *rbio, int retry,
}
}
-static void bch2_rbio_narrow_crcs(struct bch_read_bio *rbio)
+static int __bc... |
286d8ad040ddb9a496ac4a8551d72b827e604243 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a use after free in dio write path | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 4a20bb11151c..726c55072b7b 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -1787,7 +1787,7 @@ static long bch2_dio_write_loop(struct dio_write *dio)
struct bio_vec *bv;
unsigned unaligned;
u64 new_i_size;
- bool sync;
+ bool sync =... |
7d6f9b6409ef8c587d7395ba6c5674cae878c886 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix build when CONFIG_BCACHEFS_DEBUG=n | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 6b62ff80ff90..6daca5afb486 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -261,7 +261,7 @@ bool __bch2_btree_node_lock(struct btree *b, struct bpos pos,
/* Btree iterator locking: */
#ifdef CONFIG_BCACHEFS_DEBUG
... |
2dac0eae78f4e3419320cafb3bd0de2a6a4b5dba | Analyze and fix the following issue in the Linux kernel code: bcachefs: Iterator debug code improvements | Problem Details:
More aggressively checking iterator invariants, and fixing the resulting
bugs. Also greatly simplifying iter_next() and iter_next_slot() - they
were hyper optimized before, but the optimizations were getting too
brittle.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Ov... | ```diff
diff --git a/fs/bcachefs/bset.c b/fs/bcachefs/bset.c
index fca713fe50fc..09711352094c 100644
--- a/fs/bcachefs/bset.c
+++ b/fs/bcachefs/bset.c
@@ -1665,7 +1665,8 @@ struct bkey_packed *bch2_btree_node_iter_prev_all(struct btree_node_iter *iter,
struct bset_tree *t;
unsigned end = 0;
- bch2_btree_node_iter... |
f6d0368e06be2c889a4ce1097e20606cededd775 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Traverse iterator in journal replay | Problem Details:
This fixes a bug where we end up spinning in journal replay - in theory
this shouldn't be necessary though, transaction reset should be
re-traversing all iterators.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 3b9c20cf389a..712a6b1fd968 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -417,15 +417,17 @@ static int __bch2_journal_replay_key(struct btree_trans *trans,
enum btree_id id, struct bkey_i *k)
{
struct btree_ite... |
24e0c3f8da000a30ab9397af5f977bd4cd0422e0 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_dump_bset() | Problem Details:
It's used in the write path when the bset isn't in the btree node
buffer.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bset.c b/fs/bcachefs/bset.c
index b8fe361978ef..fca713fe50fc 100644
--- a/fs/bcachefs/bset.c
+++ b/fs/bcachefs/bset.c
@@ -67,8 +67,8 @@ void bch2_dump_bset(struct btree *b, struct bset *i, unsigned set)
_n = bkey_next_skip_noops(_k, vstruct_last(i));
bch2_bkey_to_text(&PBUF(buf)... |
27beb810235615820584e15afc31e130e90793f8 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix another iterator leak | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 1871485c079d..3b9c20cf389a 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -424,6 +424,7 @@ static int __bch2_journal_replay_key(struct btree_trans *trans,
return PTR_ERR(iter);
bch2_trans_update(trans, iter, k, BTREE_... |
e65fcb4362d5480b6a62be32014c8643f70a8bfc | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix off by one error in bch2_extent_crc_append() | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c
index cff4955d203b..1ac4f0522043 100644
--- a/fs/bcachefs/extents.c
+++ b/fs/bcachefs/extents.c
@@ -344,7 +344,7 @@ enum merge_result bch2_extent_merge(struct bch_fs *c,
crc_r.uncompressed_size > c->sb.encoded_extent_max)
return BCH_MERGE_N... |
7699cdd58727cdb1960e6f2ccd8aeea510a0589b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix extent_sort_fix_overlapping() | Problem Details:
Recently the extent update path started emmiting 0 size whiteouts on
extent overwrite, as part of transitioning to moving extent handling
out of the core btree code.
Unfortunately, this broke the old code path that handles overlapping
extents when reading in btree nodes - it relies on sorting incommin... | ```diff
diff --git a/fs/bcachefs/bkey_sort.c b/fs/bcachefs/bkey_sort.c
index 7cbb57042af1..68965a0f973a 100644
--- a/fs/bcachefs/bkey_sort.c
+++ b/fs/bcachefs/bkey_sort.c
@@ -311,6 +311,25 @@ static inline int extent_sort_fix_overlapping_cmp(struct btree *b,
cmp_int((unsigned long) r, (unsigned long) l);
}
+/*
+ ... |
38f0664a5f596faf7d0a247697d6f21a85133cb9 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix error message on bucket sector count overflow | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index 9fae7d9fb495..7e0412dac5ff 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -1444,8 +1444,7 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans,
struct bkey_s_c k;
struct bkey_alloc_unpacked u;
struct bkey_i_allo... |
7f81d4cf69c857881cd5139cbe064512a60dae78 | Analyze and fix the following issue in the Linux kernel code: bcachefs: fix setting btree_node_accessed() | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 40281a9acbbc..cb843a362cb4 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -748,7 +748,7 @@ lock_node:
}
/* avoid atomic set bit if it's not needed: */
- if (btree_node_accessed(b))
+ if (!btree_node_accesse... |
00aad62aaf56fe589eb79e31b73af9fed98a40c2 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix incorrect initialization of btree_node_old_extent_overwrite() | Problem Details:
b->level and b->btree_id weren't set when the code was checking
btree_node_is_extents()
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 677cb76731c1..b159ce9b3b7a 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -370,6 +370,9 @@ static struct btree *bch2_btree_node_alloc(struct btree_update *as, unsigned lev
... |
b606c8aa568e9f4f10f1b7504f8b96628d933a0e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix traversing to interior nodes | Problem Details:
NULL is used to mean "reach end of traversal" - we were only
initializing the leaf node in the iterator to the right sentinal value.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index f002ddc18cbb..bf68ab7257ce 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1732,8 +1732,7 @@ static inline void bch2_btree_iter_init(struct btree_trans *trans,
iter->nodes_locked = 0;
iter->nodes_intent_locked =... |
1f49dafcd3191de1db9b6105983696b5bc7aedad | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_ptr_swab for indirect extents | Problem Details:
bch2_ptr_swab was never updated when the code for generic keys with
pointers was added - it assumed the entire val was only used for
pointers.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bkey_methods.c b/fs/bcachefs/bkey_methods.c
index 320e17d108d2..c064cf468a9b 100644
--- a/fs/bcachefs/bkey_methods.c
+++ b/fs/bcachefs/bkey_methods.c
@@ -202,15 +202,12 @@ void bch2_bkey_val_to_text(struct printbuf *out, struct bch_fs *c,
bch2_val_to_text(out, c, k);
}
-void bch2_b... |
7d4aed1ea408f45aef8ddf5f28d8c10680b4f214 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an uninitialized field in bch_write_op | Problem Details:
Regression from "bcachefs: Track incompressible data"
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/io.h b/fs/bcachefs/io.h
index fa5841a86fcb..bc9f9fec2fd7 100644
--- a/fs/bcachefs/io.h
+++ b/fs/bcachefs/io.h
@@ -82,6 +82,7 @@ static inline void bch2_write_op_init(struct bch_write_op *op, struct bch_fs *c,
op->nr_replicas = 0;
op->nr_replicas_required = c->opts.data_replicas_req... |
4dba7c301782de9cba75b7895a5068c0bf07a551 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an in iterator leak | Problem Details:
This should fix a transaction iterator overflow bug during fsck.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/str_hash.h b/fs/bcachefs/str_hash.h
index 35f4232d0755..cf6ecd963a7b 100644
--- a/fs/bcachefs/str_hash.h
+++ b/fs/bcachefs/str_hash.h
@@ -319,13 +319,16 @@ int bch2_hash_delete(struct btree_trans *trans,
u64 inode, const void *key)
{
struct btree_iter *iter;
+ int ret;
it... |
ab05de4ce4a1b806773e59b97a59bcfabba57d8d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Track incompressible data | Problem Details:
This fixes the background_compression option: wihout some way of marking
data as incompressible, rebalance will keep rewriting incompressible
data over and over.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 0a623ed3caa6..dbc9c15514bd 100644
--- a/fs/bcachefs/bcachefs_format.h
+++ b/fs/bcachefs/bcachefs_format.h
@@ -1298,7 +1298,8 @@ LE64_BITMASK(BCH_SB_ERASURE_CODE, struct bch_sb, flags[3], 0, 16);
x(reflink, 6) \
x(new_siphash... |
952070908f9f47acb9e9ebd642570dd75f672edc | Analyze and fix the following issue in the Linux kernel code: bcachefs: Don't modify existing key in place in sort_repack_merge() | Problem Details:
This fixes a nasty memory corruption with other threads that are still
reading the btree node being compacted.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bkey_sort.c b/fs/bcachefs/bkey_sort.c
index 1c8e5a80e32a..7cbb57042af1 100644
--- a/fs/bcachefs/bkey_sort.c
+++ b/fs/bcachefs/bkey_sort.c
@@ -210,28 +210,38 @@ bch2_sort_repack_merge(struct bch_fs *c,
bool filter_whiteouts)
{
struct bkey_packed *prev = NULL, *k_packed;
- st... |
a965ef4986243bb0490d5af0ae202e81871554e1 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_sort_keys() to not modify src keys | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bkey_sort.c b/fs/bcachefs/bkey_sort.c
index 18f842012f05..1c8e5a80e32a 100644
--- a/fs/bcachefs/bkey_sort.c
+++ b/fs/bcachefs/bkey_sort.c
@@ -254,23 +254,18 @@ unsigned bch2_sort_keys(struct bkey_packed *dst,
sort_iter_sort(iter, sort_keys_cmp);
while ((in = sort_iter_next(iter, s... |
5525f632dc123ed32f17c649a54d07794a873822 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Change btree split threshold to be in u64s | Problem Details:
This fixes a bug with very small btree nodes where splitting would end
up with one of the new nodes empty.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_cache.h b/fs/bcachefs/btree_cache.h
index 4598a4c57aa1..adacb0a06703 100644
--- a/fs/bcachefs/btree_cache.h
+++ b/fs/bcachefs/btree_cache.h
@@ -75,7 +75,7 @@ static inline unsigned btree_blocks(struct bch_fs *c)
return c->opts.btree_node_size >> c->block_bits;
}
-#define BTRE... |
b2ca9903cd7a3fd2193aaf123718bcbc9e9e66e9 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix extent_to_replicas() | Problem Details:
This needs to match bch2_mark_extent()/bch2_trans_mark_extent() in
buckets.c
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/replicas.c b/fs/bcachefs/replicas.c
index eef9f54808fb..66787d0c5c63 100644
--- a/fs/bcachefs/replicas.c
+++ b/fs/bcachefs/replicas.c
@@ -84,10 +84,10 @@ static void extent_to_replicas(struct bkey_s_c k,
if (p.ptr.cached)
continue;
- if (p.has_ec)
+ if (!p.has_ec)
+ r->devs... |
e7808eef95213678a5c4d009aef636e9037588fb | Analyze and fix the following issue in the Linux kernel code: bcachefs: Kill bch2_fs_bug() | Problem Details:
These have all been converted to fsck/inconsistent errors
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bkey_methods.c b/fs/bcachefs/bkey_methods.c
index ed448fad83c5..320e17d108d2 100644
--- a/fs/bcachefs/bkey_methods.c
+++ b/fs/bcachefs/bkey_methods.c
@@ -156,7 +156,7 @@ void bch2_bkey_debugcheck(struct bch_fs *c, struct btree *b, struct bkey_s_c k)
char buf[160];
bch2_bkey_val_... |
31ba2cd33037e1011947b7abbfd70921c735841d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Hacky fixes for device removal | Problem Details:
The device remove test was sporadically failing, because we hadn't
finished dropping btree sector counts for the device when
bch2_replicas_gc2() was called - mainly due to in flight journal writes.
We don't yet have a good mechanism for flushing the counts that
correspend to open journal entries yet.
... | ```diff
diff --git a/fs/bcachefs/migrate.c b/fs/bcachefs/migrate.c
index 0e3f63c1d65c..1ef62a189e33 100644
--- a/fs/bcachefs/migrate.c
+++ b/fs/bcachefs/migrate.c
@@ -53,9 +53,6 @@ static int __bch2_dev_usrdata_drop(struct bch_fs *c, unsigned dev_idx, int flags
while ((k = bch2_btree_iter_peek(iter)).k &&
!(... |
d5cdf033cd371eb55f7337ac08bb4ac48135ce8b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an iterator error path | Problem Details:
On transaction restart (-EINTR), we need to traverse all iterators.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index d1218d34232d..f37109150e42 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1027,10 +1027,7 @@ retry_all:
for (i = 0; i < nr_sorted; i++) {
iter = &trans->iters[sorted[i]];
- do {
- ret = btree_iter_traverse... |
9ad26b2b568f75ee6872a3afa70fa8005994efe8 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Make sure bch2_read_extent obeys BCH_READ_MUST_CLONE | Problem Details:
This fixes the bch2_read_retry_nodecode() path, we were resubmitting a
bio without properly reinitializing it.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index 1fab0bdcf9ae..a419024ce039 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -1981,7 +1981,7 @@ int __bch2_read_extent(struct bch_fs *c, struct bch_read_bio *orig,
goto hole;
iter.bi_size = pick.crc.compressed_size << 9;
- goto noclone;
+ g... |
bcd6f3e06fe4f039e1526a0ff5bc3ebbc2405e10 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Use KEY_TYPE_deleted whitouts for extents | Problem Details:
Previously, partial overwrites of existing extents were handled
implicitly by the btree code; when reading in a btree node, we'd do a
mergesort of the different bsets and detect and fix partially
overlapping extents during that mergesort.
That approach won't work with snapshots: this changes extents t... | ```diff
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h
index 535ba2788315..0a623ed3caa6 100644
--- a/fs/bcachefs/bcachefs_format.h
+++ b/fs/bcachefs/bcachefs_format.h
@@ -1286,6 +1286,7 @@ LE64_BITMASK(BCH_SB_ERASURE_CODE, struct bch_sb, flags[3], 0, 16);
* reflink: gates KEY_TYPE_refli... |
27b3e52388e1e6b2babb71ec17efa029139e1511 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Add an assertion to track down a heisenbug | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 9e2d72bf06b2..c9be0d110c64 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -1657,6 +1657,8 @@ void __bch2_foreground_maybe_merge(struct bch_fs *c,
size_t sib_u64s;
int r... |
46e4bb1c3782484bda814858c34f2cff942f1271 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a use after free | Problem Details:
op->end_io may free the op struct
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index 4b54506b517c..dd8f356f3ef0 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -516,12 +516,13 @@ static void bch2_write_done(struct closure *cl)
bch2_time_stats_update(&c->times[BCH_TIME_data_write], op->start_time);
- if (op->end_io)
+ if (op->e... |
8b3bbe2c34759aad307ced27373405e346960f13 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Don't reexecute triggers when retrying transaction commit | Problem Details:
This was causing a bug with transaction iterators overflowing; now, if
triggers have to be reexecuted we always return -EINTR and retry from
the start of the transaction.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h
index 5f0b55c98f86..98451b3dd1a5 100644
--- a/fs/bcachefs/btree_types.h
+++ b/fs/bcachefs/btree_types.h
@@ -281,6 +281,7 @@ struct btree_trans {
struct disk_reservation *disk_res;
unsigned flags;
unsigned journal_u64s;
+ unsigned journa... |
a8abd3a7f63efe4a366ae5aba10b2466feba39d7 | Analyze and fix the following issue in the Linux kernel code: bcachefs: bch2_trans_reset() calls should be at the tops of loops | Problem Details:
It needs to be called when we get -EINTR due to e.g. lock restart - this
fixes a transaction iterators overflow bug.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 a05e542b3792..2bbf714c9698 100644
--- a/fs/bcachefs/btree_iter.h
+++ b/fs/bcachefs/btree_iter.h
@@ -299,11 +299,6 @@ static inline void bch2_trans_begin(struct btree_trans *trans)
return bch2_trans_reset(trans, TRANS_RESET_ITERS|TRANS_RESE... |
187c71f6ab439582c80433ef9e04f615b8c0f576 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a memory splat | Problem Details:
In __bch2_sb_field_resize, when a field's old a new size was 0, we were
doing an invalid write just past the end of the superblock.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 cd1aa3891c2e..4c1e8571d872 100644
--- a/fs/bcachefs/super-io.c
+++ b/fs/bcachefs/super-io.c
@@ -54,7 +54,9 @@ static struct bch_sb_field *__bch2_sb_field_resize(struct bch_sb_handle *sb,
BUG_ON(get_order(__vstruct_bytes(struct bch_sb, sb_u64s)... |
c45d473df77f41a104ecf78275be49b67f6d6295 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix for an assertion on filesystem error | Problem Details:
Normally the in memory i_size is always greater than or equal to i_size
on disk; this doesn't hold on filesystem error.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 5beb47805a68..c30c028c869d 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2255,6 +2255,15 @@ int bch2_truncate(struct bch_inode_info *inode, struct iattr *iattr)
ret = PTR_ERR_OR_ZERO(iter);
bch2_trans_exit(&trans);
+ if (ret)
+ ... |
b5a5c4c1033af72b94c1ba7a71f61e4231f27832 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a null ptr deref in btree_iter_traverse_one() | Problem Details:
When traversing nodes and we've reached the end of the btree, the
current btree node will be NULL.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index f05a5e718181..34443d18bc42 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1148,7 +1148,8 @@ static int btree_iter_traverse_one(struct btree_iter *iter)
iter->uptodate = BTREE_ITER_NEED_PEEK;
bch2_btree_trans_v... |
c201e2d97615e7dc6f2f99dcdb8bf8d64657b761 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_verify_insert_pos() | Problem Details:
We were calling __btree_node_key_to_offset() on a key that wasn't in the
btree node.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bset.c b/fs/bcachefs/bset.c
index 189a187bc080..a0bd6af67190 100644
--- a/fs/bcachefs/bset.c
+++ b/fs/bcachefs/bset.c
@@ -241,10 +241,9 @@ void bch2_verify_insert_pos(struct btree *b, struct bkey_packed *where,
bch2_bkey_to_text(&PBUF(buf2), &k2);
panic("prev > insert:\n"
- ... |
c32bd3ad1fe595bb96c3c781f29c7002f73450a2 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix erorr path in bch2_write() | Problem Details:
The error path in bch2_write wasn't updated when the end_io callback was
added to bch_write_op.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index 272477fb558f..f53eee7accc8 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -1176,7 +1176,12 @@ void bch2_write(struct closure *cl)
err:
if (!(op->flags & BCH_WRITE_NOPUT_RESERVATION))
bch2_disk_reservation_put(c, &op->res);
- closure_return(cl... |
0897705163b5c7eb9ecacad53c252adbbf72454a | Analyze and fix the following issue in the Linux kernel code: bcachefs: Be slightly less tricky with union usage | Problem Details:
This is to fix a valgrind complaint - the code was correct, but too
tricky for valgrind to know that.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c
index 3cd0a79f8fe6..b12798103763 100644
--- a/fs/bcachefs/extents.c
+++ b/fs/bcachefs/extents.c
@@ -1386,16 +1386,18 @@ static unsigned bch2_crc_field_size_max[] = {
};
static void bch2_extent_crc_pack(union bch_extent_crc *dst,
- struct bch_ext... |
ef496cd268f45351820c3d268d01bd46c8b80b04 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Don't BUG_ON() sector count overflow | Problem Details:
Return an error instead (still work in progress...)
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index c90c2d1b7706..f837cdda9433 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -1464,7 +1464,7 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans,
struct bkey_s_c k;
struct bkey_alloc_unpacked u;
struct bkey_i_allo... |
677fc0562a237f6cfc1551e37673707096905ca7 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Some reflink fixes | Problem Details:
len might fit into a loff_t when aligned_len does not - make sure we use
a u64 for aligned_len. Also, we weren't always extending the inode
correctly.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
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 a1767ee85591..d17621b0713e 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2799,8 +2799,8 @@ loff_t bch2_remap_file_range(struct file *file_src, loff_t pos_src,
struct bch_inode_info *dst = file_bch_inode(file_dst);
struct bch_fs *c... |
4a1d8d3efcdedd0911941f236b2e3a6347f518c3 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix setting of attributes mask in getattr | Problem Details:
Discovered by xfstests generic/553
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 65556993bbb9..b241164f6f7e 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -775,10 +775,15 @@ static int bch2_getattr(struct mnt_idmap *idmap,
if (inode->ei_inode.bi_flags & BCH_INODE_IMMUTABLE)
stat->attributes |= STATX_ATTR_IMMUTABLE;
+ sta... |
6d01598ecd151b22feff9d8bc7f0611adacc5f28 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix uninitialized field in hash_check_init() | Problem Details:
The chain_end field was not initialized before use in
hash_set_chain_start.
Signed-off-by: Justin Husted <sigstop@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index 5acf1fb64543..3cced2b99f3f 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -147,6 +147,7 @@ struct hash_check {
static void hash_check_init(struct hash_check *h)
{
h->chain = NULL;
+ h->chain_end = 0;
}
static void hash_stop_chain(st... |
887c2a4ee5480d725d39a0d611a426040287188f | Analyze and fix the following issue in the Linux kernel code: bcachefs: bch2_btree_iter_fix_key_modified() | Problem Details:
This is considerably cheaper than bch2_btree_node_iter_fix(), for cases
where the key was only modified and key ordering isn't changing.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index c264b927f992..f849120fcbce 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -501,6 +501,30 @@ static void btree_node_iter_set_set_pos(struct btree_node_iter *iter,
bch2_btree_node_iter_push(iter, b, k, btree_bkey_las... |
43cfbad6e431568d14e5d1407203c39a140f0148 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Further padding fixes in bch2_journal_super_entries_add_common() | Problem Details:
The previous patch 128cb1a to fix uninitialized data was incorrect and
did not initialize the padding space correctly. Furthermore, several
other cases in this function do not initialize their padding space
correctly.
Move initialization into some helper functions in a more robust way.
Signed-off-by:... | ```diff
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c
index 14ff191ad702..6544bbf18e70 100644
--- a/fs/bcachefs/super-io.c
+++ b/fs/bcachefs/super-io.c
@@ -949,6 +949,25 @@ int bch2_fs_mark_dirty(struct bch_fs *c)
return ret;
}
+static void
+entry_init_u64s(struct jset_entry *entry, unsigned u64s)
+... |
406d6d5a0733f3eacbcd4c33905bf63c5b2f4c07 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an error path race | Problem Details:
On IO error, bch2_writepages_io_done() will set the page state to
indicate nothing's already reserved (since the write didn't happen, we
don't know what's already reserved). This can race with the buffered IO
path, in between getting a disk reservation and calling
bch2_set_page_dirty().
Signed-off-by:... | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index c539ed3aa48d..93f6cdbbf7c7 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -491,7 +491,12 @@ static void bch2_set_page_dirty(struct bch_fs *c,
unsigned sectors = sectors_to_reserve(&s->s[i],
res->disk.nr_replicas);
- BUG_ON(... |
a94407434b7a3b577a7605f0bd999d98acad6d23 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Limit bios in writepages path to 256M | Problem Details:
This works around a bug where bio_full() doesn't check for
bio->bi_iter.bi_size overflowing - and, we don't really want to build
bios that are that big anyways.
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 9914f6ee2aa2..a3fb60383725 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -1151,6 +1151,7 @@ do_io:
if (w->io &&
(w->io->op.res.nr_replicas != nr_replicas_this_write ||
bio_full(&w->io->op.wbio.bio, PAGE_SIZE) ||
+ ... |
71603f1ffe03d2409d591e4647377a415376a6b9 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an iterator counting bug | Problem Details:
The iterator counting assumed we're doing an obvious optimization when
only updating the refcount on indirect extents - but we're not doing it
yet.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c
index 8b7d2b8759b0..16a328a20fb5 100644
--- a/fs/bcachefs/extents.c
+++ b/fs/bcachefs/extents.c
@@ -971,20 +971,7 @@ static int count_iters_for_insert(struct btree_trans *trans,
POS(0, idx + sectors)) >= 0)
break;
- *nr_iters += 1;
-
... |
ae93a628956c8eab915baa83be11d2a0300eebca | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix flushing held btree writes when there's a fs error | Problem Details:
Previously, we'd go into an infinite loop.
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 81418d534d70..7d5d94dbc64f 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -1438,6 +1438,9 @@ again:
cond_resched();
nodes_unwritten = false;
+ if (bch2_journal_error(&c->journal))
+ ret... |
f38fe2dc5dbde967c96ce579f974a406a049b122 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix iterator counting for reflink pointers (again) | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c
index 50cad6725c1b..8b7d2b8759b0 100644
--- a/fs/bcachefs/extents.c
+++ b/fs/bcachefs/extents.c
@@ -959,7 +959,8 @@ static int count_iters_for_insert(struct btree_trans *trans,
case KEY_TYPE_reflink_p: {
struct bkey_s_c_reflink_p p = bkey_s_c_to_re... |
538abcb8a1dfcd8473a90d931b8603e4a03812ca | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a debug assertion | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index a91cee797703..8aaaa6615eff 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1359,6 +1359,13 @@ static inline struct bkey_s_c btree_iter_peek_uptodate(struct btree_iter *iter)
if (debug_check_iterators(iter->trans... |
05240ba6b897995d4d4086f7f4accc7858ee0a40 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix creation of lost+found | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 095eef3828ce..23f3ed54fadd 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -1011,7 +1011,7 @@ int bch2_fs_initialize(struct bch_fs *c)
bch2_create_trans(&trans, BCACHEFS_ROOT_INO,
&root_inode, &lostfound_inode,
... |
ea3532cbf7fdbb9fa4e45114532d55d1fc3ac7c2 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a subtle race in the btree split path | Problem Details:
We have to free the old (in memory) btree node _before_ unlocking the
new nodes - else, some other thread with a read lock on the old node
could see stale data after another thread has already updated the new
node.
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 f7d9abfdb3de..4a66c44764f6 100644
--- a/fs/bcachefs/btree_gc.c
+++ b/fs/bcachefs/btree_gc.c
@@ -1042,11 +1042,12 @@ next:
old_nodes[i] = new_nodes[i];
} else {
old_nodes[i] = NULL;
- if (new_nodes[i])
- six_unlock_intent(&new_nod... |
14989d547ee308033e080792239e640e076a4460 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_btree_iter_next() after peek_slot() | Problem Details:
this deserves a unit test
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 78bc82c7b9c3..8c6d3193c3fe 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1440,6 +1440,14 @@ struct bkey_s_c bch2_btree_iter_next(struct btree_iter *iter)
return bch2_btree_iter_peek(iter);
}
+ if (unlikely(b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.