projects
/
wrapfs-5.15.y.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
031ad9e
)
bcachefs: btree node scan: handle encrypted nodes
author
Kent Overstreet
<kent.overstreet@linux.dev>
Fri, 12 Apr 2024 03:38:07 +0000
(23:38 -0400)
committer
Kent Overstreet
<kent.overstreet@linux.dev>
Sun, 14 Apr 2024 02:48:16 +0000
(22:48 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_node_scan.c
patch
|
blob
|
history
diff --git
a/fs/bcachefs/btree_node_scan.c
b/fs/bcachefs/btree_node_scan.c
index 556f76f5c84e1613c332e7443e6bb8b1602dd359..20f2b37c4474cb57ba059b5168327175604b8a56 100644
(file)
--- a/
fs/bcachefs/btree_node_scan.c
+++ b/
fs/bcachefs/btree_node_scan.c
@@
-133,9
+133,19
@@
static void try_read_btree_node(struct find_btree_nodes *f, struct bch_dev *ca,
if (le64_to_cpu(bn->magic) != bset_magic(c))
return;
+ if (bch2_csum_type_is_encryption(BSET_CSUM_TYPE(&bn->keys))) {
+ struct nonce nonce = btree_nonce(&bn->keys, 0);
+ unsigned bytes = (void *) &bn->keys - (void *) &bn->flags;
+
+ bch2_encrypt(c, BSET_CSUM_TYPE(&bn->keys), nonce, &bn->flags, bytes);
+ }
+
if (btree_id_is_alloc(BTREE_NODE_ID(bn)))
return;
+ if (BTREE_NODE_LEVEL(bn) >= BTREE_MAX_DEPTH)
+ return;
+
rcu_read_lock();
struct found_btree_node n = {
.btree_id = BTREE_NODE_ID(bn),