]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
hfs: clear offset and space out of valid records in b-tree node
authorViacheslav Dubeyko <slava@dubeyko.com>
Fri, 15 Aug 2025 19:49:19 +0000 (12:49 -0700)
committerViacheslav Dubeyko <slava@dubeyko.com>
Mon, 1 Sep 2025 01:16:00 +0000 (18:16 -0700)
commit18b07c44f245beb03588b00b212b38fce9af7cc9
tree7a000e5c70d46027d06562264b2d324943660d1e
parenta06ec283e125e334155fe13005c76c9f484ce759
hfs: clear offset and space out of valid records in b-tree node

Currently, hfs_brec_remove() executes moving records
towards the location of deleted record and it updates
offsets of moved records. However, the hfs_brec_remove()
logic ignores the "mess" of b-tree node's free space and
it doesn't touch the offsets out of records number.
Potentially, it could confuse fsck or driver logic or
to be a reason of potential corruption cases.

This patch reworks the logic of hfs_brec_remove()
by means of clearing freed space of b-tree node
after the records moving. And it clear the last
offset that keeping old location of free space
because now the offset before this one is keeping
the actual offset to the free space after the record
deletion.

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