On Tue, 2025-04-29 at 10:19 -0700, Viacheslav Dubeyko wrote: > On Tue, 2025-04-29 at 06:05 +0000, Johannes Thumshirn wrote: > > On 29.04.25 03:16, Viacheslav Dubeyko wrote: > > > Signed-off-by: Viacheslav Dubeyko <slava@xxxxxxxxxxx> > > > --- > > > fs/hfs/bnode.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/fs/hfs/bnode.c b/fs/hfs/bnode.c > > > index cb823a8a6ba9..c5eae7c418a1 100644 > > > --- a/fs/hfs/bnode.c > > > +++ b/fs/hfs/bnode.c > > > @@ -219,6 +219,8 @@ void hfs_bnode_unlink(struct hfs_bnode *node) > > > tree->root = 0; > > > tree->depth = 0; > > > } > > > + > > > + hfs_bnode_clear(node, 0, tree->node_size); > > > set_bit(HFS_BNODE_DELETED, &node->flags); > > > } > > > > > > > Hi Slava, > > > > I've just checked HFS+ code and hfs_bnode_unlink() in > > fs/hfsplus/bnode.c > > is a copy of the fs/hfs/bnode.c one (maybe most of the file is so > > there's room for unification?). So I think the fix is needed there > > as > > well. > > > > Yeah, makes sense. This fix should be there too. I simply started > from > HFS and I didn't take a look into the HFS+ code yet. Let me prepare > the > patch for HFS+ too. > I double checked the HFS+ code. The deleted node's clearing logic is already there. The hfs_bnode_unlink() set HFS_BNODE_DELETED flag. Then, hfs_bnode_put() check this flag. And if it is set, then hfs_need_zeroout() is called. If it is the catalog file and volume attributes contain HFSPLUS_VOL_UNUSED_NODE_FIX flag, then hfs_bnode_clear() is called. Also, I don't see the corruption of the HFS+ volume for the case of generic/001 test-case. Technically speaking, I could follow to the same logic in HFS (I mean of placing hfs_bnode_clear() into hfs_bnode_put()). But, as far as I can see, HFS hasn't similar volume attribute like HFS+ has. Thanks, Slava.