From: Kent Overstreet <kent.overstreet@linux.dev>
To: linux-bcachefs@vger.kernel.org
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Subject: [PATCH 25/37] bcachefs: fsck: Fix remove_backpointer() for subvol roots
Date: Wed, 18 Jun 2025 17:54:16 -0400 [thread overview]
Message-ID: <20250618215431.738317-26-kent.overstreet@linux.dev> (raw)
In-Reply-To: <20250618215431.738317-1-kent.overstreet@linux.dev>
The dirent will be in a different snapshot if the inode is a subvolume
root.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
---
fs/bcachefs/fsck.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index 0d87aa9b4f23..a3f73e7a2113 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -493,10 +493,18 @@ static int remove_backpointer(struct btree_trans *trans,
if (!inode->bi_dir)
return 0;
+ u32 snapshot = inode->bi_snapshot;
+
+ if (inode->bi_parent_subvol) {
+ int ret = bch2_subvolume_get_snapshot(trans, inode->bi_parent_subvol, &snapshot);
+ if (ret)
+ return ret;
+ }
+
struct bch_fs *c = trans->c;
struct btree_iter iter;
struct bkey_s_c_dirent d = dirent_get_by_pos(trans, &iter,
- SPOS(inode->bi_dir, inode->bi_dir_offset, inode->bi_snapshot));
+ SPOS(inode->bi_dir, inode->bi_dir_offset, snapshot));
int ret = bkey_err(d) ?:
dirent_points_to_inode(c, d, inode) ?:
bch2_fsck_remove_dirent(trans, d.k->p);
--
2.50.0
next prev parent reply other threads:[~2025-06-18 21:55 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-18 21:53 [PATCH 00/37] 6.16-rc3 hotfixes series Kent Overstreet
2025-06-18 21:53 ` [PATCH 01/37] bcachefs: trace_extent_trim_atomic Kent Overstreet
2025-06-18 21:53 ` [PATCH 02/37] bcachefs: btree iter tracepoints Kent Overstreet
2025-06-18 21:53 ` [PATCH 03/37] bcachefs: Don't allocate new memory when mempool is exhausted Kent Overstreet
2025-06-18 21:53 ` [PATCH 04/37] bcachefs: Fix alloc_req use after free Kent Overstreet
2025-06-18 21:53 ` [PATCH 05/37] bcachefs: Add missing EBUG_ON Kent Overstreet
2025-06-18 21:53 ` [PATCH 06/37] bcachefs: Delay calculation of trans->journal_u64s Kent Overstreet
2025-06-18 21:53 ` [PATCH 07/37] bcachefs: Fix bch2_journal_keys_peek_prev_min() Kent Overstreet
2025-06-18 21:53 ` [PATCH 08/37] bcachefs: btree_iter: fix updates, journal overlay Kent Overstreet
2025-06-18 21:54 ` [PATCH 09/37] bcachefs: better __bch2_snapshot_is_ancestor() assert Kent Overstreet
2025-06-18 21:54 ` [PATCH 10/37] bcachefs: pass last_seq into fs_journal_start() Kent Overstreet
2025-06-18 21:54 ` [PATCH 11/37] bcachefs: Fix "now allowing incompatible features" message Kent Overstreet
2025-06-18 21:54 ` [PATCH 12/37] bcachefs: Fix snapshot_key_missing_inode_snapshot repair Kent Overstreet
2025-06-18 21:54 ` [PATCH 13/37] bcachefs: fsck: fix add_inode() Kent Overstreet
2025-06-18 21:54 ` [PATCH 14/37] bcachefs: fsck: fix extent past end of inode repair Kent Overstreet
2025-06-18 21:54 ` [PATCH 15/37] bcachefs: opts.journal_rewind Kent Overstreet
2025-06-18 21:54 ` [PATCH 16/37] bcachefs: Kill unused tracepoints Kent Overstreet
2025-06-18 21:54 ` [PATCH 17/37] bcachefs: mark more errors autofix Kent Overstreet
2025-06-18 21:54 ` [PATCH 18/37] bcachefs: Move bset size check before csum check Kent Overstreet
2025-06-18 21:54 ` [PATCH 19/37] bcachefs: Fix pool->alloc NULL pointer dereference Kent Overstreet
2025-06-18 21:54 ` [PATCH 20/37] bcachefs: don't return fsck_fix for unfixable node errors in __btree_err Kent Overstreet
2025-06-18 21:54 ` [PATCH 21/37] bcachefs: fsck: Improve check_key_has_inode() Kent Overstreet
2025-06-18 21:54 ` [PATCH 22/37] bcachefs: Call bch2_fs_init_rw() early if we'll be going rw Kent Overstreet
2025-06-18 21:54 ` [PATCH 23/37] bcachefs: Fix __bch2_inum_to_path() when crossing subvol boundaries Kent Overstreet
2025-06-18 21:54 ` [PATCH 24/37] bcachefs: fsck: Print path when we find a subvol loop Kent Overstreet
2025-06-18 21:54 ` Kent Overstreet [this message]
2025-06-18 21:54 ` [PATCH 26/37] bcachefs: fsck: Fix reattach_inode() for subvol roots Kent Overstreet
2025-06-18 21:54 ` [PATCH 27/37] bcachefs: fsck: check_directory_structure runs in reverse order Kent Overstreet
2025-06-18 21:54 ` [PATCH 28/37] bcachefs: fsck: additional diagnostics for reattach_inode() Kent Overstreet
2025-06-18 21:54 ` [PATCH 29/37] bcachefs: fsck: check_subdir_count logs path Kent Overstreet
2025-06-18 21:54 ` [PATCH 30/37] bcachefs: fsck: Fix check_path_loop() + snapshots Kent Overstreet
2025-06-18 21:54 ` [PATCH 31/37] bcachefs: Fix bch2_read_bio_to_text() Kent Overstreet
2025-06-18 21:54 ` [PATCH 32/37] bcachefs: Fix restart handling in btree_node_scrub_work() Kent Overstreet
2025-06-18 21:54 ` [PATCH 33/37] bcachefs: fsck: Fix check_directory_structure when no check_dirents Kent Overstreet
2025-06-18 21:54 ` [PATCH 34/37] bcachefs: fsck: fix unhandled restart in topology repair Kent Overstreet
2025-06-18 21:54 ` [PATCH 35/37] bcachefs: fsck: Fix oops in key_visible_in_snapshot() Kent Overstreet
2025-06-18 21:54 ` [PATCH 36/37] bcachefs: fix spurious error in read_btree_roots() Kent Overstreet
2025-06-18 21:54 ` [PATCH 37/37] bcachefs: Fix missing newlines before ero Kent Overstreet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250618215431.738317-26-kent.overstreet@linux.dev \
--to=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).