[PATCH 03/23] Don't overwrite op.val_size on btree delete

Valerie Aurora val at versity.com
Fri Apr 4 11:45:19 PDT 2025


When the btree operation delete flag is set, the operation's val_size
is overwritten with the current size of the btree item. This causes a
bug on a simultaneous delete/insert btree operation in which the old
value size controls how many bytes of the new value are copied into
the value, instead of the new value size. Since delete-only btree
operations ignore op.val_size, just don't overwrite the operation
val_size at all.

Signed-off-by: Valerie Aurora <val at versity.com>
---
 shared/btree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/shared/btree.c b/shared/btree.c
index 39a9b57..c3e40c1 100644
--- a/shared/btree.c
+++ b/shared/btree.c
@@ -1101,10 +1101,8 @@ int ngnfs_btree_write_iter(struct ngnfs_fs_info *nfi, struct ngnfs_transaction *
 				/* ind/item already 0/NULL from !bt */
 			}
 
-			if (op.delete) {
+			if (op.delete)
 				op.key = item->key;
-				op.val_size = item_val_size(trav.bt, ind);
-			}
 
 			if (op.insert || op.delete) {
 				ret = try_split_merge(nfi, txn, root_tblk, root, &trav,
-- 
2.48.1




More information about the ngnfs-devel mailing list