id stringlengths 40 40 | instruction stringlengths 68 308 | input stringlengths 17 33.4k | output stringlengths 100 30k |
|---|---|---|---|
8570d775ca90192f8663ddd828a09d0c6698c71c | Analyze and fix the following issue in the Linux kernel code: bcachefs: bch2_trans_updates_to_text() | Problem Details:
This turns bch2_dump_trans_updates() into a to_text() method - this way
it can be used by debug tracing.
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 f33dc4657590..cfaab8cbcad0 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1793,30 +1793,44 @@ free:
__bch2_path_free(trans, path);
}
-noinline __cold
-void bch2_dump_trans_updates(struct btree_trans *trans)
+vo... |
cc23255e9a9fcaf7423e0fe7e197605bf10a3f06 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Add a missing wakeup | Problem Details:
This fixes a rare bug with bch2_btree_flush_all_writes() getting stuck.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
index 3031b566a112..887a1b145cdc 100644
--- a/fs/bcachefs/btree_io.c
+++ b/fs/bcachefs/btree_io.c
@@ -1622,6 +1622,8 @@ static void __btree_node_write_done(struct bch_fs *c, struct btree *b)
if (new & (1U << BTREE_NODE_write_in_flight))
__bch2_... |
a9bae40fda067eae70751302cbbc9f362453f310 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Change flags param to bch2_btree_delete_range to update_flags | Problem Details:
It wasn't used as iter_flags (excepting the unit tests, which this patch
fixes), and the next patch is going to need to pass in
BTREE_TRIGGER_NORUN.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index 42ee54cf390d..9f1ff5f8635d 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -1692,14 +1692,14 @@ int bch2_btree_delete_at(struct btree_trans *trans,
int bch2_btree_delete_range_trans(stru... |
61a66469a4bf63a1357b6af36242682ae339ca2a | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix lock ordering under traverse_all() | Problem Details:
traverse_all() traverses btree paths in sorted order, so it should never
see transaction restarts due to lock ordering violations. But some code
in __bch2_btree_path_upgrade(), while necessary when not running under
traverse_all(), was causing some confusing lock ordering violations -
disabling this co... | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 90f5d306566b..1cfd2e9015b1 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -473,14 +473,15 @@ bool __bch2_btree_path_upgrade(struct btree_trans *trans,
* before interior nodes - now that's handled by
* bch2_btre... |
a897ef682781824c9b82f01d107d653f3dbf38e5 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix error handling in traverse_all() | Problem Details:
In btree_path_traverse_all() we were failing to check for -EIO in the
retry loop, and after btree node read error we'd go into an infinite
loop.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 109efa73cd4c..90f5d306566b 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1468,8 +1468,10 @@ retry_all:
*/
if (path->uptodate) {
ret = btree_path_traverse_one(trans, path, 0, _THIS_IP_);
- if (ret)
+ ... |
9552e19f6fff86d9907bb088f8b1eb786562f9d3 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix dio write path with loopback dio mode | Problem Details:
When the iov_iter is a bvec iter, it's possible the IO was submitted
from a kthread that didn't have an mm to switch to.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 8231c29a7534..77a893260fd8 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2110,7 +2110,7 @@ static long bch2_dio_write_loop(struct dio_write *dio)
while (1) {
iter_count = dio->iter.count;
- if (kthread)
+ if (kthread && dio->... |
4d126dc8b30c2c1c69cbf600d604e7ceb8ca7f8d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Use bio_iov_vecs_to_alloc() | Problem Details:
This fixes a bug in the DIO read path where, when using a loopback
device in DIO mode, we'd allocate a biovec that would get overwritten
and leaked in bio_iov_iter_get_pages() -> bio_iov_bvec_set().
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 9161125aec17..8231c29a7534 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -1889,7 +1889,7 @@ static int bch2_direct_IO_read(struct kiocb *req, struct iov_iter *iter)
iter->count -= shorten;
bio = bio_alloc_bioset(NULL,
- ... |
07b8121f07056480c54fca99046870d84a657d13 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix pr_tab_rjust() | Problem Details:
pr_tab_rjust() was broken and leaving a null somewhere in the output
string - this patch fixes it and simplifies it a bit.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c
index 7a896ddc9a22..f290c069c683 100644
--- a/fs/bcachefs/util.c
+++ b/fs/bcachefs/util.c
@@ -101,8 +101,14 @@ STRTO_H(strtou64, u64)
static int bch2_printbuf_realloc(struct printbuf *out, unsigned extra)
{
- unsigned new_size = roundup_pow_of_two(out->si... |
e1f7fa06a8ed48feedd5f538fc4724734c6e1869 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Don't keep around btree_paths unnecessarily | Problem Details:
When bch2_trans_begin() is called and there hasn't been a transaction
restart, we presume that we're now doing something new - iterating over
different keys, and we now shouldn't keep aruond paths related to the
previous transaction, excepting the subvolumes btree.
This should fix some of our "transac... | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index b65cd3566872..109efa73cd4c 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -3012,6 +3012,14 @@ void bch2_trans_begin(struct btree_trans *trans)
trans_for_each_path(trans, path) {
path->should_be_locked = false;
... |
b60c380bca5458be9e4c0ff77289f0979fbbb52f | Analyze and fix the following issue in the Linux kernel code: bcachefs: Don't arm journal->write_work when journal entry !open | Problem Details:
This fixes a shutdown race where we were rearming journal->write_work
after the journal has already shut down.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index 9df600d55da0..1c43ec1d4f6c 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -309,17 +309,19 @@ static void journal_write_work(struct work_struct *work)
{
struct journal *j = container_of(work, struct journal, write_work.work);
... |
4eea53de8a1882e75d3640dce06c8c2874a77b05 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix transaction path overflow in fiemap | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 2aaeee585157..310e317738b9 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -935,7 +935,8 @@ retry:
bch2_trans_iter_init(&trans, &iter, BTREE_ID_extents,
SPOS(ei->v.i_ino, start, snapshot), 0);
- while ((k = bch2_btree_iter_peek(&iter)).... |
3098553776a16c08446c408005090423d62e6b54 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix usage of six lock's percpu mode | Problem Details:
Six locks have a percpu mode, which we use for interior btree nodes, as
well as btree key cache keys for the subvolumes btree. We've been
switching locks back and forth between percpu and non percpu mode as
needed, but it turns out this is racy - when we're reusing an existing
node, other threads could... | ```diff
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index 42253ca17f04..92a8cc704cab 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -40,6 +40,14 @@ static inline unsigned btree_cache_can_free(struct btree_cache *bc)
return max_t(int, 0, bc->used - bc->reserve);
}
+... |
5b3f780540aa5e39859a0c00ace61713da054a0f | Analyze and fix the following issue in the Linux kernel code: bcachefs: Refactor bch2_btree_node_mem_alloc() | Problem Details:
This is prep work for the next patch, which is going to fix our usage of
the percpu mode of six locks by never switching struct btree between the
two modes - which means we need separate freed lists.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index 0976b9d7a619..42253ca17f04 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -565,52 +565,54 @@ static struct btree *btree_node_cannibalize(struct bch_fs *c)
struct btree *bch2_btree_node_mem_alloc(struct bch_fs *c... |
ee68105f619b90ef7daef9f9ebab1270209d6151 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Simplify parameters to bch2_btree_update_start() | Problem Details:
We don't need to pass the number of nodes required to
bch2_btree_update_start, just whether we're doing a split at @level.
This is prep work for a fix to our usage of six lock's percpu mode,
which is going to require us to count up and allocate interior nodes and
leaf nodes seperately.
Signed-off-by: ... | ```diff
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c
index 7e876a904c10..523d1146b2e2 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -934,7 +934,7 @@ static void bch2_btree_update_done(struct btree_update *as)
static struct btre... |
b66fbf33425f30aacbbb95182c22d2df5b1d3b12 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Drop unneeded journal pin in bch2_btree_update_start() | Problem Details:
When we do an interior btree update, we create new btree nodes and link
them into the btree in memory, but they don't become reachable on disk
until later, when btree_update_nodes_written_trans() runs.
Updates to the new nodes can thus happen before they're reachable on
disk, and if the updates to tho... | ```diff
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c
index 17d65c9e2bd4..7e876a904c10 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -544,8 +544,6 @@ static void btree_update_nodes_written(struct btree_update *as)
if (ret)
got... |
ddf11d8c60b0d46dd25520d388243b508d6e9016 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a use after free | Problem Details:
This fixes a regression from "bcachefs: Stash a copy of key being
overwritten in btree_insert_entry". In btree_key_can_insert_cached(), we
may reallocate the key cache key, invalidating pointers previously
returned by peek() - fix it by issuing a transaction restart.
Signed-off-by: Kent Overstreet <ke... | ```diff
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index dc4dfcda8f21..42ee54cf390d 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -382,7 +382,18 @@ btree_key_can_insert_cached(struct btree_trans *trans,
ck->u64s = new_u64s;
ck->k = new_k... |
7db4cbd0a52554ddec4cabf2ebd69fc7bcd53a31 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a memory leak | Problem Details:
This fixes a regression from "bcachefs: Heap allocate printbufs" -
bch2_sb_field_validate() was leaking an error string.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c
index c616ce5ed194..31b175a8fcd0 100644
--- a/fs/bcachefs/super-io.c
+++ b/fs/bcachefs/super-io.c
@@ -1423,24 +1423,25 @@ static const struct bch_sb_field_ops *bch2_sb_field_ops[] = {
};
static int bch2_sb_field_validate(struct bch_sb *sb, struct ... |
bf3efff5e4fc2dcd6e6c15578d3f08c301a13229 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix race leading to btree node write getting stuck | Problem Details:
Checking btree_node_may_write() isn't atomic with the other btree flags,
dirty and need_write in particular. There was a rare race where we'd
unblock a node from writing while __btree_node_flush() was setting
need_write, and no thread would notice that the node was now both able
to write and needed to ... | ```diff
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index 7b264619c276..5f96c5d1a064 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -223,10 +223,9 @@ wait_on_io:
goto wait_on_io;
}
- if (btree_node_noevict(b))
- goto out_unlock;
-
- if (!btree_node_may_write(b))... |
39dcace83889f43d5619d07c2ec76c286c88a85b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix locking in btree_node_write_done() | Problem Details:
There was a rare recursive locking bug, in __bch2_btree_node_write()
nowrite path -> btree_node_write_done(), in the path that kicks off
another write.
This splits out an inner __btree_node_write_done() that expects to be
run with the btree node lock held.
Signed-off-by: Kent Overstreet <kent.overstr... | ```diff
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
index fd7f2a78473c..f4d6a6c5096d 100644
--- a/fs/bcachefs/btree_io.c
+++ b/fs/bcachefs/btree_io.c
@@ -1592,29 +1592,13 @@ void bch2_btree_complete_write(struct bch_fs *c, struct btree *b,
bch2_journal_pin_drop(&c->journal, &w->journal);
}
-static... |
75ef2c59bc2f4d3c3ecd48286ac36ee7b868321c | Analyze and fix the following issue in the Linux kernel code: bcachefs: Start moving debug info from sysfs to debugfs | Problem Details:
In sysfs, files can only output at most PAGE_SIZE. This is a problem for
debug info that needs to list an arbitrary number of times, and because
of this limit some of our debug info has been terser and harder to read
than we'd like.
This patch moves info about journal pins and cached btree nodes to
de... | ```diff
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index e5bc09870c57..6cda77ad4342 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -538,9 +538,6 @@ enum {
struct btree_debug {
unsigned id;
- struct dentry *btree;
- struct dentry *btree_format;
- struct dentry *failed;
};... |
a0a07c59f5b4646b9371a1c119feeb6ee52b0012 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix btree path sorting | Problem Details:
In btree_update_interior.c, we were changing a path's level directly -
which affects path sort order - without re-sorting paths, leading to
assertions when bch2_path_get() verified paths were sorted correctly.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 92258281fdc7..b65cd3566872 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1797,11 +1797,12 @@ void bch2_dump_trans_paths_updates(struct btree_trans *trans)
bch2_bpos_to_text(&buf1, path->pos);
- printk(KERN_... |
cb598111836fbca03b1353a6238cde8a66e5ddf0 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix journal_flush_done() | Problem Details:
journal_flush_done() was overwriting did_work, thus occasionally
returning false when it did do work and occasional assertions in the
shutdown sequence because we didn't completely flush the key cache.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c
index 2d5382a83003..3cc980b07285 100644
--- a/fs/bcachefs/journal_reclaim.c
+++ b/fs/bcachefs/journal_reclaim.c
@@ -759,7 +759,8 @@ static int journal_flush_done(struct journal *j, u64 seq_to_flush,
mutex_lock(&j->reclaim_lock);
- ... |
2be7b16eee9442f2c45ebde19bd3b50fcd030515 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Convert bch2_pd_controller_print_debug() to a printbuf | Problem Details:
Fewer random on-stack char arrays.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c
index a330fa30cd79..2296658b9f0d 100644
--- a/fs/bcachefs/util.c
+++ b/fs/bcachefs/util.c
@@ -484,36 +484,44 @@ void bch2_pd_controller_init(struct bch_pd_controller *pd)
pd->backpressure = 1;
}
-size_t bch2_pd_controller_print_debug(struct bch_pd_contro... |
eb7bd15fe4e7a4a6cf05d9086722aad49f80c259 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Improve debug assertion | Problem Details:
We're hitting a strange bug with transaction paths not being sorted
correctly - this dumps transaction paths in the order we thought was
sorted, which will hopefully shed some light as to what's going on.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 8aacaa05fc14..b58219292f34 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1410,7 +1410,7 @@ static int btree_path_traverse_one(struct btree_trans *, struct btree_path *,
static int bch2_btree_path_traverse_all(stru... |
eac91bf27f088ecb0676873ff298db2dcd5ff9fa | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_journal_pins_to_text() | Problem Details:
When key cache pins were put onto their own list, we neglected to update
bch2_journal_pins_to_text() to print them.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index 1f26d351697a..279e960f2307 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -1290,6 +1290,10 @@ void bch2_journal_pins_to_text(struct printbuf *out, struct journal *j)
pr_buf(out, "%llu: count %u\n",
i, atomic_read(&p... |
82697a10dd4b9a6f7c6f98a525778d032db2f2fb | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix 32 bit build | Problem Details:
vstruct_bytes() was returning a u64 - it should be a size_t, the corect
type for the size of anything that fits in memory.
Also replace a 64 bit divide with div_u64().
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index b8fcc801a666..302af332b632 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -1105,7 +1105,7 @@ int bch2_journal_read(struct bch_fs *c, struct list_head *list,
struct journal_replay *p = list_prev_entry(i, list);
... |
b66b2bc0f64a57c042ea1fa51dbd5904557bf67f | Analyze and fix the following issue in the Linux kernel code: bcachefs: Revert "Ensure journal doesn't get stuck in nochanges mode" | Problem Details:
This patch was originally to work around the journal geting stuck in
nochanges mode - but that was just a hack, we needed to fix the actual
bug. It should be fixed now, so revert it.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/journal.h b/fs/bcachefs/journal.h
index 9d4c6d86d5c1..5d263a5b8685 100644
--- a/fs/bcachefs/journal.h
+++ b/fs/bcachefs/journal.h
@@ -431,7 +431,6 @@ static inline int bch2_journal_preres_get_fast(struct journal *j,
ret = 0;
if ((flags & JOURNAL_RES_GET_RESERVED) ||
- test_... |
e201f70b116513cb0d17ba32e1f00c234dee9d7e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix for journal getting stuck | Problem Details:
The journal can get stuck if we need to get a journal reservation for
something we have a pre-reservation for, but aren't able to reclaim
space, or if the pin fifo is full - it's impractical to resize the pin
fifo at runtime.
Previously, we reserved 8 entries in the pin fifo for pre-reservations,
but ... | ```diff
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index 3c7dce3b31c1..1f26d351697a 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -416,7 +416,7 @@ unlock:
(flags & JOURNAL_RES_GET_RESERVED)) {
char *journal_debug_buf = kmalloc(4096, GFP_ATOMIC);
- bch_err(c, "Journal stuc... |
f61816d0fc6091e14b3f4ffce962dc5084a1b6cd | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a use after free | Problem Details:
In move_read_endio, we were checking if the next pending write has its
read completed - but this can turn after a use after free (and we were
accessing the list without a lock), so instead just better to just
unconditionally do the wakeup.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index 4751d79219cb..2eb192da8e1d 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -480,9 +480,7 @@ static void move_read_endio(struct bio *bio)
atomic_sub(io->read_sectors, &ctxt->read_sectors);
io->read_completed = true;
- if (next_pending_w... |
8f9ad91a02c4fd1391ce852cadd9a0227fdd624a | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix failure to allocate btree node in cache | Problem Details:
The error code when we fail to allocate a node in the btree node cache
doesn't make it to bch2_btree_path_traverse_all(). Instead, we need to
stash a flag in btree_trans so we know we have to take the cannibalize
lock.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index 36b82df79fc2..c17db1d07187 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -672,6 +672,15 @@ static noinline struct btree *bch2_btree_node_fill(struct bch_fs *c,
}
b = bch2_btree_node_mem_alloc(c);
+
+ if (t... |
bf7e49a4ae564108d08d314e514a6f802748d73b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Change bch2_dev_lookup() to not use lookup_bdev() | Problem Details:
bch2_dev_lookup() is used from the extended attribute set methods, for
setting the target options, where we're already holding an inode lock -
it turns out pathname lookups also take inode locks, so that was
susceptible to deadlocks.
Fortunately we already stash the device name in ca->name. This does
... | ```diff
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index d35547fbefdb..6a32b9a5dc0e 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -1883,20 +1883,14 @@ err:
}
/* return with ref on ca->ref: */
-struct bch_dev *bch2_dev_lookup(struct bch_fs *c, const char *path)
+struct bch_dev *bch2_dev_l... |
33aa419db96077993af90eddb49adac1270a96e0 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix __btree_path_traverse_all | Problem Details:
The loop that traverses paths in traverse_all() needs to be a little bit
tricky, because traversing a path can cause other paths to be added (or
perhaps removed) at about the same position.
The old logic was buggy, replace it with simpler logic.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.c... | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 7b54d662f4cb..c6c1c9da45f1 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1462,17 +1462,17 @@ retry_all:
while (i < trans->nr_sorted) {
path = trans->paths + trans->sorted[i];
- EBUG_ON(!(trans->paths_alloca... |
4b59a319ad29815aa8f629513df2c291c2108bf9 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix slow tracepoints | Problem Details:
Some of our tracepoints were calling snprintf("pS") - which does symbol
table lookups - in TP_fast_assign(), which turns out to be a really bad
idea.
This was done because perf trace wasn't correctly printing tracepoints
that use %pS anymore - but it turns out trace-cmd does handle it
correctly.
Sign... | ```diff
diff --git a/fs/bcachefs/trace.h b/fs/bcachefs/trace.h
index 5e78c396e24c..64b7d9364fd9 100644
--- a/fs/bcachefs/trace.h
+++ b/fs/bcachefs/trace.h
@@ -358,7 +358,7 @@ TRACE_EVENT(btree_node_relock_fail,
TP_STRUCT__entry(
__array(char, trans_fn, 24 )
- __array(char, caller, 32 )
+ __field(unsigned l... |
eb331fe5a4e801dc11d96ba7fbda0a91c8bd626c | Analyze and fix the following issue in the Linux kernel code: bcachefs: Check for stale dirty pointer before reads | Problem Details:
Since we retry reads when we discover we read from a pointer that went
stale, if a dirty pointer is erroniously stale it would cause us to loop
retrying that read forever - unless we check before issuing the read,
while the btree is still locked, when we know that a dirty pointer
should never be stale.... | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 5fce958bafc9..9161125aec17 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -1043,8 +1043,6 @@ retry:
sectors = min(sectors, k.k->size - offset_into_extent);
- bch2_trans_unlock(trans);
-
if (readpages_iter)
readpage_bio_ex... |
7abda8c1d8af41266e543160bb3290dea963fdd0 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix __bch2_btree_node_lock | Problem Details:
__bch2_btree_node_lock() was implementing the wrong lock ordering for
cached vs. non cached paths - this fixes it to match the btree path sort
order as defined by __btree_path_cmp(), and also simplifies the code
some.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 6c1fbe3e3bda..7b54d662f4cb 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -46,6 +46,9 @@ static inline int __btree_path_cmp(const struct btree_path *l,
struct bpos r_pos,
unsigned r_level)
{
+ /*
+... |
52eef42c5fecb037b626cbab2dd06f34e5f0fddb | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix locking in data move path | Problem Details:
We need to ensure we don't have any btree locks held when calling
do_pending_writes() - besides issuing IOs, upcoming allocator changes
will have allocations doing btree lookups directly.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index f428e2ff99f6..04971bf847bf 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -486,19 +486,22 @@ static void move_read_endio(struct bio *bio)
closure_put(&ctxt->cl);
}
-static void do_pending_writes(struct moving_context *ctxt)
+static voi... |
9e34316156a2c148b0675087beeaca26f7eb79f9 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Small fsck fix | Problem Details:
The check_dirents pass handles transaction restarts at the toplevel -
check_subdir_count() was incorrectly handling transaction restarts
without returning -EINTR, meaning that the iterator pointing to the
dirent being checked was left invalid.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index 43b6159be01b..ced4d671eb8d 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -1316,8 +1316,9 @@ static int check_subdir_count(struct btree_trans *trans, struct inode_walker *w)
if (i->inode.bi_nlink == i->count)
continue;
- count2 = ... |
aa8982c3f2cbfca89fb73daad9d6e65f7be022c2 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix reflink repair code | Problem Details:
The reflink repair code was incorrectly inserting a nonzero deleted key
via journal replay - this is due to bch2_journal_key_insert() being
somewhat hacky, and so this fix is also hacky for now.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c
index 9c33341c7947..d1fbe3b77379 100644
--- a/fs/bcachefs/btree_gc.c
+++ b/fs/bcachefs/btree_gc.c
@@ -1501,10 +1501,18 @@ static int bch2_gc_reflink_done(struct bch_fs *c, bool initial,
bkey_reassemble(new, k);
- if (!r->refcount)
+ if (!r... |
80bf2f345411b9952a984b6105cd860500b01228 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix freeing in bch2_dev_buckets_resize() | Problem Details:
We were double-freeing old_buckets and not freeing old_buckets_gens:
also, the code was supposed to free buckets, not old_buckets;
old_buckets is only needed because we have to use rcu_assign_pointer()
instead of swap(), and won't be set if we hit the error path.
Signed-off-by: Kent Overstreet <kent.o... | ```diff
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 3d1a6773393c..59c0963f785f 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -451,7 +451,7 @@ struct bch_dev {
* Or rcu_read_lock(), but only for ptr_stale():
*/
struct bucket_array __rcu *buckets[2];
- struct bucket_ge... |
35228ecb7e4d45822c0e2acbb0fb9555da31ef31 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Don't keep nodes in btree_reserve locked | Problem Details:
These nodes aren't reachable by other threads, so there's no need to
keep it locked - and this fixes a bug with the assertion in
bch2_trans_unlock() firing on transaction restart.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c
index 0e7644a3a436..7d5efb32b082 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -243,6 +243,8 @@ retry:
bch2_alloc_sectors_done(c, wp);
mem_alloc:
b = bch2_btree_node_mem_al... |
d5030164ec53ab212f6acaff8938b352c654b67e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Simplify bch2_inode_delete_keys() | Problem Details:
Had a bug report that implies bch2_inode_delete_keys() returned -EINTR
before it completed, so this patch simplifies it and makes the flow
control a little more conventional.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c
index 104575734b96..79ee9ca2f1d0 100644
--- a/fs/bcachefs/inode.c
+++ b/fs/bcachefs/inode.c
@@ -585,62 +585,49 @@ found_slot:
static int bch2_inode_delete_keys(struct btree_trans *trans,
subvol_inum inum, enum btree_id id)
{
- u64 offset = 0;
+ str... |
c4ecf802fbfae032730caf40fd74fb27c057a916 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an error path in bch2_snapshot_node_create() | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/subvolume.c b/fs/bcachefs/subvolume.c
index 8aeb2e417a15..012d8e8c52c4 100644
--- a/fs/bcachefs/subvolume.c
+++ b/fs/bcachefs/subvolume.c
@@ -522,7 +522,7 @@ static int bch2_snapshot_node_create(struct btree_trans *trans, u32 parent,
n = bch2_trans_kmalloc(trans, sizeof(*n));
ret ... |
a74313481ae24cd301b79b5fca3161079e739a21 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix check_pos_snapshot_overwritten for !snapshots | Problem Details:
It shouldn't run if the btree being checked doesn't have snapshots.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index 24de8604740c..c29815e6183d 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -1088,6 +1088,9 @@ static int check_pos_snapshot_overwritten(struct btree_trans *trans,
struct bkey_s_c k;
int... |
f443fa66c98f012412b677afc4f7096ed24108de | Analyze and fix the following issue in the Linux kernel code: bcachefs: Also print out in-memory gen on stale dirty pointer | Problem Details:
We're trying to track down a bug that shows itself as newly-created
extents having stale dirty pointers - possibly due to the in memory gen
and the btree gen being inconsistent. This patch changes the error
message to also print out the in memory bucket gen when this happens.
Signed-off-by: Kent Overs... | ```diff
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index 35ab5a5d8183..b80ab1ed22f7 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -699,49 +699,51 @@ static int check_bucket_ref(struct bch_fs *c,
struct bkey_s_c k,
const struct bch_extent_ptr *ptr,
s64 sectors,... |
4e08446db05427ad0972eba58d6447b21c1ca7e1 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_check_fix_ptrs() | Problem Details:
The repair for for btree_ptrs was saying one thing and doing another -
fortunately, that code can just be deleted.
Also, when we update a btree node pointer, we also have to update node
in memery, if it exists in the btree node cache - this fixes
bch2_check_fix_ptrs() to do that.
Signed-off-by: Kent ... | ```diff
diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c
index d7de00af81c9..8c60f15fc63e 100644
--- a/fs/bcachefs/btree_gc.c
+++ b/fs/bcachefs/btree_gc.c
@@ -155,6 +155,34 @@ static void btree_ptr_to_v2(struct btree *b, struct bkey_i_btree_ptr_v2 *dst)
}
}
+static void bch2_btree_node_update_key_early... |
9714baaa52d63416d1f7577b630831fc885bfa1f | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an uninitialized variable | Problem Details:
Only userspace builds were complaining about it, oddly enough.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index c659a5a95b63..4602f581198e 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -898,7 +898,7 @@ static void bch2_journal_read_device(struct closure *cl)
struct journal_read_buf buf = { NULL, 0 };
u64 min_seq = U64_MAX... |
9b6e2f1e7036d639ca07434fdb27a739b37beb76 | Analyze and fix the following issue in the Linux kernel code: Revert "bcachefs: Delete some obsolete journal_seq_blacklist code" | Problem Details:
This reverts commit f95b61228efd04c9c158123da5827c96e9773b29.
It turns out, we're seeing filesystems in the wild end up with
blacklisted btree node bsets - this should not be happening, and until
we understand why and fix it we need to keep this code around.
Signed-off-by: Kent Overstreet <kent.overs... | ```diff
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 8ef874b3afbb..4ebaefd408a4 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -755,6 +755,7 @@ struct bch_fs {
/* JOURNAL SEQ BLACKLIST */
struct journal_seq_blacklist_table *
journal_seq_blacklist_table;
+ struct work_... |
03ea3962ab99adf0cf7de9949716e6baeda230f3 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Log & error message improvements | Problem Details:
- Add a shim uuid_unparse_lower() in the kernel, since %pU doesn't work
in userspace
- We don't need to print the bcachefs: or the filesystem name prefix in
userspace
- Improve a few error messages
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 2dd3a0a1943a..8ef874b3afbb 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -223,8 +223,8 @@
#define bch2_fmt(_c, fmt) "bcachefs (%s): " fmt "\n", ((_c)->name)
#define bch2_fmt_inum(_c, _inum, fmt) "bcachefs (%s inum %llu):... |
98c80d6df67168035e4e84080959f070e9055bd2 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_journal_seq_blacklist_add() | Problem Details:
The old code correctly handled the case where we were blacklisting a
range that exactly matched an existing entry, but not the case where the
new range partially overlaps an existing entry.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/journal_seq_blacklist.c b/fs/bcachefs/journal_seq_blacklist.c
index 428377e73a8d..e10b2c7c7bae 100644
--- a/fs/bcachefs/journal_seq_blacklist.c
+++ b/fs/bcachefs/journal_seq_blacklist.c
@@ -66,6 +66,12 @@ blacklist_entry_try_merge(struct bch_fs *c,
return bl;
}
+static bool bl_entr... |
6558e61dfe1ec1d54a39cb4604d00efa5bcaaa7e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an assertion | Problem Details:
bch2_trans_commit() can legitimately return -ENOSPC with
BTREE_INSERT_NOFAIL set if BTREE_INSERT_NOWAIT was also set.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index 1072acb0c9af..60897fc70c58 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -816,7 +816,9 @@ int bch2_trans_commit_error(struct btree_trans *trans,
}
BUG_ON((ret == EINTR || ret == -EA... |
eacb2574f09f5b71acc468d44e7a1633847fd08d | Analyze and fix the following issue in the Linux kernel code: bcachefs: bch_dev->dev | Problem Details:
Add a field to bch_dev for the dev_t of the underlying block device -
this fixes a null ptr deref in tracepoints.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 7771b4a4bb87..7c48ebed1d35 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -432,6 +432,7 @@ struct bch_dev {
struct bch_sb_handle disk_sb;
struct bch_sb *sb_read_scratch;
int sb_write_error;
+ dev_t dev;
struct... |
dfd41fb9f24699393a042f9c34bd46496da1174d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix race between btree updates & journal replay | Problem Details:
Add a flag to indicate whether a journal replay key has been
overwritten, and set/test it with appropriate btree locks held.
This fixes a race between the allocator - invalidating buckets, and
doing btree updates - and journal replay, which before this patch could
clobber the allocator thread's update... | ```diff
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index c282086079fb..9452b6cf04a5 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -561,6 +561,7 @@ struct journal_keys {
enum btree_id btree_id:8;
unsigned level:8;
bool allocated;
+ bool overwritten;
struct bkey_i *k... |
f0f41a6d74f7f682327eead3708473c11577b131 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Add error messages for memory allocation failures | Problem Details:
This adds some missing diagnostics from rare but annoying to debug
runtime allocation failure paths.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_key_cache.c b/fs/bcachefs/btree_key_cache.c
index d045b3a5deed..e5029703240c 100644
--- a/fs/bcachefs/btree_key_cache.c
+++ b/fs/bcachefs/btree_key_cache.c
@@ -147,19 +147,23 @@ bkey_cached_reuse(struct btree_key_cache *c)
}
static struct bkey_cached *
-btree_key_cache_create(... |
74ef5b0d3f3f8e290686b309ae595559a8963fde | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix keylist size in btree_update | Problem Details:
This fixes a buffer overrun, fortunately caught by a BUG_ON().
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_update_interior.h b/fs/bcachefs/btree_update_interior.h
index 8cf59cee6e4e..8dc86fa636d6 100644
--- a/fs/bcachefs/btree_update_interior.h
+++ b/fs/bcachefs/btree_update_interior.h
@@ -82,12 +82,12 @@ struct btree_update {
/* Nodes being freed: */
struct keylist old_keys;
u... |
8d65e475b20610854419fef8dba155200b45a687 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Always check for bucket reuse after read | Problem Details:
Since dirty extents can be moved or overwritten, it's not just cached
data that we need the ptr_stale() check in bc2h_read_endio for - this
fixes data checksum errors seen in the tiering ktest tests.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index d69e63e519bf..f172da922904 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -1972,9 +1972,8 @@ static void bch2_read_endio(struct bio *bio)
return;
}
- if (rbio->pick.ptr.cached &&
- (((rbio->flags & BCH_READ_RETRY_IF_STALE) && race_fault(... |
36f035e90804d30dba4336daafe1b89c9a8ffe98 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix allocator + journal interaction | Problem Details:
The allocator needs to wait until the last update touching a bucket has
been commited before writing to it again. However, the code was checking
against the last dirty journal sequence number, not the last flushed
journal sequence number.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 45becfb1ffe9..30bf363d2ff3 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -594,7 +594,7 @@ static void find_reclaimable_buckets_lru(struct bch_fs *c, struct bch_dev *ca)
buckets = bucket_arr... |
8511632d44a5846f8edc387e90858ae208715574 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Journal initialization fixes | Problem Details:
This fixes a rare bug when mounting & unmounting RO - flushing a clean
filesystem that never went RO should be a no op.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index d27d65a17e43..7c5ce5b47493 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -989,10 +989,14 @@ int bch2_fs_journal_start(struct journal *j, u64 cur_seq,
j->replay_journal_seq = last_seq;
j->replay_journal_seq_end = cur_seq;
... |
ffa7d26244e4100600e595e537f4f144a48ab517 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Use BTREE_ITER_NOPRESERVE in bch2_btree_iter_verify_ret() | Problem Details:
This fixes a transaction path overflow.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 777197ec2656..0b5bf75fbf89 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -731,6 +731,7 @@ static int bch2_btree_iter_verify_ret(struct btree_iter *iter, struct bkey_s_c k
k.k->p.snapshot));
bch2_trans_it... |
4141fde0be05beb529ee6433b9808f815254901b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_journal_meta() | Problem Details:
This patch ensures that the journal entry written gets written as flush
entry, which is important for the shutdown path - the last entry written
needs to be a flush entry.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index 020c7b0a3469..d27d65a17e43 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -641,6 +641,7 @@ int bch2_journal_flush_seq(struct journal *j, u64 seq)
int bch2_journal_meta(struct journal *j)
{
+ struct journal_buf *buf;
struct... |
73b460977eb8782a769ff81200a8b40cf1a3a91d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a null ptr deref in bch2_inode_delete_keys() | Problem Details:
Similarly to bch2_btree_delete_range_trans(), bch2_inode_delete_keys()
may sometimes split compressed extents, and needs to pass in a disk
reservation.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c
index d9ccc7c063ac..104575734b96 100644
--- a/fs/bcachefs/inode.c
+++ b/fs/bcachefs/inode.c
@@ -4,6 +4,7 @@
#include "btree_key_cache.h"
#include "bkey_methods.h"
#include "btree_update.h"
+#include "buckets.h"
#include "error.h"
#include "extents.h"
... |
d05117e36a7290cbfa8ebcc05c6facb60a5bcefb | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix debugfs -bfloat-failed | Problem Details:
It wasn't updated for snapshots - it's iterating across keys in all
snapshots, so needs to be specifying BTREE_ITER_ALL_SNAPSHOTS.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/debug.c b/fs/bcachefs/debug.c
index 5ea29528ab67..02a5ef5ecb3e 100644
--- a/fs/bcachefs/debug.c
+++ b/fs/bcachefs/debug.c
@@ -373,7 +373,9 @@ static ssize_t bch2_read_bfloat_failed(struct file *file, char __user *buf,
bch2_trans_init(&trans, i->c, 0, 0);
- bch2_trans_iter_init(&tr... |
f3e1f4443383f72975f12caece6f13e63f21a719 | Analyze and fix the following issue in the Linux kernel code: bcachefs: BTREE_ITER_NOPRESERVE | Problem Details:
This adds a flag to not mark the initial btree_path as preserve, for
paths that we expect to be cheap to reconstitute if necessary - this
solves a btree_path overflow caused by need_whiteout_for_snapshot().
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index a9db8d05dc93..777197ec2656 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1807,12 +1807,14 @@ static struct btree_path *btree_path_alloc(struct btree_trans *trans,
return path;
}
-struct btree_path *bch2_path_g... |
99fafb0425ea9c68b45699053d6124a3e32d844d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix some shutdown path bugs | Problem Details:
This fixes some bugs when we hit an error very early in the filesystem
startup path, before most things have been initialized.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index dde919a95585..1ad5eafb2f76 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -705,6 +705,7 @@ struct bch_fs {
struct btree_path_buf __percpu *btree_paths_bufs;
struct srcu_struct btree_trans_barrier;
+ bool btree_trans... |
6be1b6d9df9dfe7065220b64b32de339b1120f1b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Make sure bch2_bucket_alloc_new_fs() obeys buckets_nouse | Problem Details:
This fixes the filesystem migrate tool.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c
index e3fe4d7bbe21..646d556a5c24 100644
--- a/fs/bcachefs/alloc_foreground.c
+++ b/fs/bcachefs/alloc_foreground.c
@@ -152,6 +152,7 @@ long bch2_bucket_alloc_new_fs(struct bch_dev *ca)
for (b = buckets->first_bucket; b < buckets->nb... |
6df893fb1115083765a877302cdc25866ce5a87e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Kill some obsolete sysfs code | Problem Details:
fs internal/alloc_debug doesn't show anything bcachefs fs usage shows.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c
index d5d32bf16d68..3f51eda749f0 100644
--- a/fs/bcachefs/sysfs.c
+++ b/fs/bcachefs/sysfs.c
@@ -262,21 +262,6 @@ static long data_progress_to_text(struct printbuf *out, struct bch_fs *c)
return ret;
}
-static int fs_alloc_debug_to_text(struct printbuf ... |
51c4e406aa5706cdb224ff16eef1d560c504c3ac | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an assertion in bch2_truncate() | Problem Details:
We recently added an assertion that when we truncate a file to 0,
i_blocks should also go to 0 - but that's not necessarily true if we're
doing an emergency shutdown, lots of invariants no longer hold true in
that case.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 2f144fa3298d..28bbbac5cd67 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2699,7 +2699,8 @@ int bch2_truncate(struct mnt_idmap *idmap,
U64_MAX, &i_sectors_delta);
i_sectors_acct(c, inode, NULL, i_sectors_delta);
- BUG_ON(!inode... |
2a863c6c80e3c14eb3920c0d8474ba112c82197a | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix debug build in userspace | Problem Details:
This fixes some compiler warnings that only trigger in userspace - dead
code, a maybe uninitialed variable, a maybe null ptr passed to printk.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
index f01f78952942..5a678e6e993a 100644
--- a/fs/bcachefs/btree_io.c
+++ b/fs/bcachefs/btree_io.c
@@ -560,7 +560,8 @@ enum btree_validate_ret {
\
switch (write) { \
case READ: \
- bch_err(c, "%s", _buf2); \
+ if (_buf2) ... |
dbd8b46b90852c0dbaffc48fc1d8b3869b078cf2 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Add missing bch2_trans_iter_exit() call | Problem Details:
This fixes a bug where the filesystem goes read only when reading from
debugfs.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/debug.c b/fs/bcachefs/debug.c
index 8b25ef9e1e05..5ea29528ab67 100644
--- a/fs/bcachefs/debug.c
+++ b/fs/bcachefs/debug.c
@@ -406,6 +406,8 @@ static ssize_t bch2_read_bfloat_failed(struct file *file, char __user *buf,
if (!i->size)
break;
}
+ bch2_trans_iter_exit(&trans, &iter)... |
198141e51cc0dadc5ddf7c7fe5e975c3bb6f546b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix null ptr deref in fsck_inode_rm() | Problem Details:
bch2_btree_delete_range() can split compressed extents, thus needs to
pass in a disk reservation when we're operating on extents btrees.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index 1079daef4e86..96fc2cd13f21 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -1452,6 +1452,8 @@ retry:
(k = bch2_btree_iter_peek(&iter)).k) &&
!(ret = bkey_err(k)) &&
... |
bf0fdb4d89bf16bbcd3a0a340a10ffde25b13d57 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Don't erasure code cached ptrs | Problem Details:
It doesn't make much sense to be erasure coding cached pointers, we
should be erasure coding one of the dirty pointers in an extent. This
patch makes sure we're passing BCH_WRITE_CACHED when we expect the new
pointer to be a cached pointer, and tweaks the write path to not
allocate from a stripe when B... | ```diff
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index 2b6a68b4c4d6..4424cb3ac822 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -143,8 +143,8 @@ void bch2_stripe_to_text(struct printbuf *out, struct bch_fs *c,
}
/* returns blocknr in stripe that we matched: */
-static int bkey_matches_stripe(struc... |
47b15c5760d5eec6c69f207eda7f779c2170e285 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix copygc sectors_to_move calculation | Problem Details:
With erasure coding, copygc's count of sectors to move was off, which
matters for the debug statement it prints out when it's not able to move
all the data it tried to.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index 249d0b2be167..482dfc29385e 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -768,8 +768,7 @@ static int __bch2_move_data(struct bch_fs *c,
if (rate)
bch2_ratelimit_increment(rate, k.k->size);
next:
- atomic64_add(k.k->size * bch2_bke... |
92d2ec10926d2ba8c38ba0ecada69cfd7a4dd3c4 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix btree_path leaks in bch2_trans_update() | Problem Details:
bch2_trans_update() had some dodgy gets() and puts() - this fixes a few
leaks.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index 205eaee11da0..65facdd1536f 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -1336,8 +1336,6 @@ int bch2_trans_update(struct btree_trans *trans, struct btree_iter *iter,
.ip_allocated = _R... |
b547d005d54209dc3a14ffd7924c73e32ba2e3a2 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Erasure coding fixes | Problem Details:
When we added the stripe and stripe_redundancy fields to alloc keys, we
neglected to add them to the functions that convert back and forth with
the in-memory types.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 10514476cffe..dc1e09b138b6 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -336,6 +336,9 @@ static int bch2_alloc_read_fn(struct btree_trans *trans, struct bkey_s_c k)
g->_mark.data_type = u.... |
f449bedb068447d3e9b1d64a41852b2aaca36fda | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix reflink path for snapshots | Problem Details:
make_extent_indirect() was missing the
BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE - it's updating the extent in the
original snapshot, not the curret one.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/reflink.c b/fs/bcachefs/reflink.c
index 8dcac7815c9f..c8d6d73681e0 100644
--- a/fs/bcachefs/reflink.c
+++ b/fs/bcachefs/reflink.c
@@ -184,7 +184,8 @@ static int bch2_make_extent_indirect(struct btree_trans *trans,
r_p->v.idx = cpu_to_le64(bkey_start_offset(&r_v->k));
- ret = bch2_... |
dcfc593f7b3a35e340f0cefa3281a3285ddb48e8 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix page state after fallocate | Problem Details:
This tweaks the fallocate code to also update the page cache to reflect
the new on disk reservations, giving us better i_sectors consistency.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 53998df4c14b..d5320719dc95 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -425,6 +425,108 @@ static void bch2_bio_page_state_set(struct bio *bio, struct bkey_s_c k)
bv.bv_len >> 9, nr_ptrs, state);
}
+static void mark_page... |
e6ec361f95fcbaffab65221cd4a56e0e10fdafc2 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix page state when reading into !PageUptodate pages | Problem Details:
This patch adds code to read page state before writing to pages that
aren't uptodate, which corrects i_sectors being tempororarily too large
and means we may not need to get a disk reservation.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
# Conflicts:
# fs/bcachefs/fs-io.c | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 16edd60f9b78..53998df4c14b 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -272,6 +272,7 @@ struct bch_page_sector {
struct bch_page_state {
spinlock_t lock;
atomic_t write_count;
+ bool uptodate;
struct bch_page_sector s[PAGE... |
084d42bbd67c5b2de607f56a94c7295459b16b61 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Apply workaround for too many btree iters to read path | Problem Details:
Reading from cached data, which calls bch2_bucket_io_time_reset(), is
leading to transaction iterator overflows - this standardizes the
workaround.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_iter.h b/fs/bcachefs/btree_iter.h
index 72b9605cf3e7..af1922c448ed 100644
--- a/fs/bcachefs/btree_iter.h
+++ b/fs/bcachefs/btree_iter.h
@@ -328,13 +328,19 @@ static inline struct bkey_s_c __bch2_btree_iter_peek(struct btree_iter *iter,
: bch2_btree_iter_peek(iter);
}
+static... |
9ca4853b98af5fa15a2ddc47a45f8e103027f95d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix quota support for snapshots | Problem Details:
Quota support was disabled when snapshots were released, because of some
tricky interactions with snpashots. We're sidestepping that for now -
we're simply disabling quota accounting on snapshot subvolumes.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 61027d349cd8..31adc0e0d452 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -39,7 +39,8 @@ static struct kmem_cache *bch2_inode_cache;
static void bch2_vfs_inode_init(struct btree_trans *, subvol_inum,
struct bch_inode_info *,
- struct bch... |
b44a66a64123efb3e6aebaa0cedec722ecbfbba4 | Analyze and fix the following issue in the Linux kernel code: bcachefs: SECTOR_DIRTY_RESERVED | Problem Details:
This fixes another i_sectors accounting bug - we need to differentiate
between dirty writes that overwrite a reservation and dirty writes to
unallocated space - dirty writes to unallocated space increase
i_sectors, dirty writes over a reservation do not.
Signed-off-by: Kent Overstreet <kent.overstreet... | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 68e707fcf9cd..c014f10885dc 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -231,6 +231,9 @@ static void i_sectors_acct(struct bch_fs *c, struct bch_inode_info *inode,
return;
mutex_lock(&inode->ei_quota_lock);
+ BUG_ON((s64) inode... |
b19d307dc11586df2e2b7430c0ccbfa439bf7a0b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix i_sectors_leak in bch2_truncate_page | Problem Details:
When bch2_truncate_page() discards dirty sectors in the page cache, we
need to account for that - we don't need to account for allocated
sectors because that'll be done by the bch2_fpunch() call when it
updates the btree.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index dff6d7547212..68e707fcf9cd 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2241,6 +2241,7 @@ static int __bch2_truncate_page(struct bch_inode_info *inode,
unsigned end_offset = ((end - 1) & (PAGE_SIZE - 1)) + 1;
unsigned i;
struct... |
8810386f6bd55cf3287a1219901c2993b3bac959 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an i_sectors accounting bug | Problem Details:
We weren't checking for errors before calling i_sectors_acct()
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index ac013bb99a43..dff6d7547212 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2806,6 +2806,8 @@ static int __bchfs_fallocate(struct bch_inode_info *inode, int mode,
&reservation.k_i,
&disk_res, NULL,
0, &i_sectors_delta, t... |
7468c4effc8c93464ec0fd4336494312bebb8033 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix BCH_FS_ERROR flag handling | Problem Details:
We were setting BCH_FS_ERROR on startup if the superblock was marked as
containing errors, which is not what we wanted - BCH_FS_ERROR indicates
whether errors have been found, so that after a successful fsck we're
able to clear the error bit in the superblock.
Signed-off-by: Kent Overstreet <kent.over... | ```diff
diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c
index ec5b7e2c7271..a15b3bfa9d47 100644
--- a/fs/bcachefs/btree_gc.c
+++ b/fs/bcachefs/btree_gc.c
@@ -1632,7 +1632,7 @@ again:
bch2_mark_superblocks(c);
- if (test_bit(BCH_FS_TOPOLOGY_ERROR, &c->flags) &&
+ if (BCH_SB_HAS_TOPOLOGY_ERRORS(c->disk... |
9be1efe9c57e3eed5fc569caee47d0ddc96530db | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix error reporting from bch2_journal_flush_seq | Problem Details:
- bch2_journal_halt() was unconditionally overwriting j->err_seq, the
sequence number that we failed to write
- journal_write_done was updating seq_ondisk and flushed_seq_ondisk even
for writes that errored, which broke the way bch2_journal_flush_seq_async()
locklessly checked for completions.
S... | ```diff
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index 1ee012d94b4a..56c477bbce0f 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -106,7 +106,12 @@ void bch2_journal_halt(struct journal *j)
} while ((v = atomic64_cmpxchg(&j->reservations.counter,
old.v, new.v)) != old.v... |
c714614bd06cc422f56c02475adf03dc618bf385 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Disk space accounting fix on brand-new fs | Problem Details:
The filesystem initialization path first marks superblock and journal
buckets non transactionally, since the btree isn't functional yet. That
path was updating the per-journal-buf percpu counters via
bch2_dev_usage_update(), and updating the wrong set of counters so those
updates didn't get written out... | ```diff
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 966e185201d1..077d366961ff 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -495,6 +495,7 @@ struct bch_dev {
enum {
/* startup: */
+ BCH_FS_INITIALIZED,
BCH_FS_ALLOC_READ_DONE,
BCH_FS_ALLOC_CLEAN,
BCH_FS_ALLOCATOR_... |
1c9e6d50e28c89d03bebfe3e3946746dc1eeab74 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix missing field initialization | Problem Details:
When unpacking v1 inodes, we were failing to initialize the journal_seq
field, leading to a BUG_ON() when fsync tries to flush a garbage journal
sequence number.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c
index a24bbc5228c1..fb5ed3a07ad7 100644
--- a/fs/bcachefs/inode.c
+++ b/fs/bcachefs/inode.c
@@ -220,6 +220,7 @@ int bch2_inode_unpack(struct bkey_s_c k,
struct bkey_s_c_inode inode = bkey_s_c_to_inode(k);
unpacked->bi_inum = inode.k->p.offset;
+ un... |
531b69e9afed954156b193264daf32c067454952 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Convert journal BUG_ON() to a warning | Problem Details:
It's definitely indicative of a bug if we request to flush a journal
sequence number that hasn't happened yet, but it's more useful if we
warn and print out the relevant sequence numbers instead of just dying.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index 1abd1ac560e6..1ee012d94b4a 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -550,7 +550,10 @@ int bch2_journal_flush_seq_async(struct journal *j, u64 seq,
spin_lock(&j->lock);
- BUG_ON(seq > journal_cur_seq(j));
+ if (WARN_O... |
496b7238794ac9209c68fba3592b59576140fa55 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an exiting of uninitialized iterator | Problem Details:
bch2_dirent_lookup had an error path where we'd exit a btree_iter that
hadn't been properly initialized.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/dirent.c b/fs/bcachefs/dirent.c
index 9267eea810f8..5db1426faaf3 100644
--- a/fs/bcachefs/dirent.c
+++ b/fs/bcachefs/dirent.c
@@ -418,16 +418,15 @@ int __bch2_dirent_lookup_trans(struct btree_trans *trans,
k = bch2_btree_iter_peek_slot(iter);
ret = bkey_err(k);
- if (ret) {
- bch... |
54b2db3d58eadb4496a671d43b1e7c0506dd0220 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix infinite loop in bch2_btree_cache_scan() | Problem Details:
When attempting to free btree nodes, we might not be able to free all
the nodes that were requested. But the code was looping until it had
freed _all_ the nodes requested, when it should have only been
attempting to free nr nodes.
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 7f5620a4d7c5..4e855ae51731 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -309,7 +309,7 @@ static unsigned long bch2_btree_cache_scan(struct shrinker *shrink,
touched++;
- if (freed >= nr)
+ if (touched ... |
770e821485e0021ea325f7aa2133fddb46ba0821 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Inode updates should generally be BTREE_INSERT_NOFAIL | Problem Details:
This fixes a bug where i_size may become inconsistent between the VFS
cache and the btree, when the filesystem is nearly full.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/reflink.c b/fs/bcachefs/reflink.c
index d003f4088dfc..22230f82b8b9 100644
--- a/fs/bcachefs/reflink.c
+++ b/fs/bcachefs/reflink.c
@@ -347,7 +347,8 @@ s64 bch2_remap_range(struct bch_fs *c,
inode_u.bi_size < new_i_size) {
inode_u.bi_size = new_i_size;
ret2 = bch2_inode_wr... |
74163da7c81ac5bb4ecd625f9e41a241ec5d8758 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fallocate fixes | Problem Details:
- fpunch wasn't always correctly updating i_size - when we drop buffered
writes that were extending a file, we become responsible for writing
i_size.
- fzero was sometimes zeroing out more data that it should have -
block_start and block_end were being rounded in the wrong directions
Signed-off... | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 7de6b7a7aa60..12b785c5005f 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2296,6 +2296,14 @@ static int __bch2_truncate_page(struct bch_inode_info *inode,
s->s[i].state = SECTOR_UNALLOCATED;
}
+ /*
+ * Caller needs to know whe... |
9a74f63c97a5c8fcfd0469a87afb0aa95f55f806 | Analyze and fix the following issue in the Linux kernel code: bcachefs: path->should_be_locked fixes | Problem Details:
- We should only be clearing should_be_locked in btree_path_set_pos() -
it's the responsiblity of the btree_path code, not the btree_iter
code.
- bch2_path_put() needs to pay attention to path->should_be_locked, to
ensure we don't drop locks we're supposed to be keeping.
Signed-off-by: Kent... | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 2c28e65fdeb5..94ba43626cde 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1654,19 +1654,19 @@ static struct btree_path *have_path_at_pos(struct btree_trans *trans, struct btr
return NULL;
}
-static bool have_no... |
076c783cd31f0d46782f9365fd79725d1248712d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix upgrade path for reflink_p fix | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index b51b1cf3ca25..d4d41646b2e6 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -1207,11 +1207,15 @@ static int bch2_mark_reflink_p(struct btree_trans *trans,
struct bkey_s_c_reflink_p p = bkey_s_c_to_reflink_p(k);
struct reflink_... |
c27314b448d3ef1aa44a82d77ff1e1eec0c5a682 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix __remove_dirent() | Problem Details:
__lookup_inode() doesn't work for what __remove_dirent() wants - it just
wants the first inode at a given inode number, they all have the same
hash info.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index 8a9cfccf5ee8..9519ced976f2 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -113,6 +113,35 @@ static int subvol_lookup(struct btree_trans *trans, u32 subvol,
return lockrestart_do(trans, __subvol_lookup(trans, subvol, snapshot, inum));
}
... |
47f80bbf38df59e41c98fd1f9681cf63af82a5fd | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix check_inodes() | Problem Details:
We were starting at the wrong btree position, and thus not actually
checking any inodes - oops.
Also, make check_key_has_snapshot() a mustfix fsck error, since later
fsck code assumes that all keys have valid snapshot IDs.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index 5bc04c7bbb83..8a9cfccf5ee8 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -669,7 +669,7 @@ static int check_key_has_snapshot(struct btree_trans *trans,
char buf[200];
int ret = 0;
- if (fsck_err_on(!snapshot_t(c, k.k->p.snapshot)->equ... |
85eb2bae7fd18f424b28c3f873d106c95e6b9733 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix trans_lock_write() | Problem Details:
On failure to get a write lock (because we had a conflicting read lock),
we need to make sure to upgrade the read lock to an intent lock - or we
could end up spinning.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index 43ae2d83cfa7..fa6ba018378b 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -569,7 +569,8 @@ static inline bool have_conflicting_read_lock(struct btree_trans *trans, struct
//if (path == ... |
f527afea5a2f3c2645080584dafeb6cc5314b652 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix upgrade_readers() | Problem Details:
The bch2_btree_path_upgrade() call was failing and tripping an assert -
path->level + 1 is in this case not necessarily exactly what we want,
fix it by upgrading exactly the locks we want.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 806663799a08..2c28e65fdeb5 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -180,8 +180,8 @@ bool __bch2_btree_node_relock(struct btree_trans *trans,
}
}
-static bool bch2_btree_node_upgrade(struct btree_trans *tr... |
d7407292723ea79028afe6729432602ced243972 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix faulty assertion | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index baa8391a4226..806663799a08 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -661,7 +661,8 @@ static void bch2_btree_path_verify(struct btree_trans *trans,
for (i = 0; i < (!path->cached ? BTREE_MAX_DEPTH : 1); i++)... |
961b2d62821f23f9f963ee069b64eb8806f05e40 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Assorted ec fixes | Problem Details:
- The backpointer that ec_stripe_update_ptrs() uses now needs to include
the snapshot ID, which means we have to change where we add the
backpointer to after getting the snapshot ID for the new extents
- ec_stripe_update_ptrs() needs to be calling bch2_trans_begin()
- improve error message in bch... | ```diff
diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c
index 4fc882b15d93..2d9e5c91c9d0 100644
--- a/fs/bcachefs/btree_gc.c
+++ b/fs/bcachefs/btree_gc.c
@@ -699,6 +699,7 @@ static int bch2_gc_mark_key(struct bch_fs *c, enum btree_id btree_id,
BTREE_TRIGGER_INSERT|
BTREE_TRIGGER_GC|
(initial ? BTR... |
37f72492f401671f1f773cc62dddf742e7fc553b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_mark_update() | Problem Details:
When the old or new key doesn't exist, we should still pass in a deleted
key with the correct pos. This fixes a bug in the ec code, when
bch2_mark_stripe() was looking up the wrong in-memory stripe.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index fc4d9d75794c..48687a70411e 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -1231,6 +1231,8 @@ int bch2_mark_key(struct bch_fs *c, struct bkey_s_c new, unsigned flags)
struct bkey_s_c old = (struct bkey_s_c) { &deleted, NULL };
... |
6caf05785060b2522f577b000849bbc172efb135 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_btree_iter_advance() | Problem Details:
Was popping an assertion on !BTREE_ITER_ALL_SNAPSHOTS iters when getting
to the end.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index c1dc33248265..51dd10518214 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -2021,7 +2021,9 @@ err:
inline bool bch2_btree_iter_advance(struct btree_iter *iter)
{
struct bpos pos = iter->k.p;
- bool ret = bpos_cmp(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.