Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

hfsplus: fix logic of alloc/free b-tree node

The hfs_bmap_alloc() and hfs_bmap_free() modify
the b-tree's counters and nodes' bitmap of b-tree.
However, hfs_btree_write() synchronizes the state of
in-core b-tree's counters and node's bitmap with
b-tree's descriptor in header node. Postponing this
synchronization could result in inconsistent state of
file system volume. This patch adds calling of
hfs_btree_write() in hfs_bmap_alloc() and hfs_bmap_free()
methods.

cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
cc: Yangtao Li <frank.li@vivo.com>
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
Link: https://lore.kernel.org/r/20260403230556.614171-4-slava@dubeyko.com
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>

+3
+3
fs/hfsplus/btree.c
··· 564 564 set_page_dirty(page); 565 565 kunmap_local(data); 566 566 tree->free_nodes--; 567 + hfs_btree_write(tree); 567 568 mark_inode_dirty(tree->inode); 568 569 hfs_bnode_put(node); 569 570 return hfs_bnode_create(tree, ··· 586 585 if (!nidx) { 587 586 hfs_dbg("create new bmap node\n"); 588 587 next_node = hfs_bmap_new_bmap(node, idx); 588 + hfs_btree_write(tree); 589 589 } else 590 590 next_node = hfs_bnode_find(tree, nidx); 591 591 hfs_bnode_put(node); ··· 657 655 nidx, node->type); 658 656 } else { 659 657 tree->free_nodes++; 658 + hfs_btree_write(tree); 660 659 mark_inode_dirty(tree->inode); 661 660 } 662 661