Re: 回复: [PATCH v2] hfs: fix not erasing deleted b-tree node issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Yangtao,

On Fri, 2025-05-02 at 12:18 +0000, 李扬韬 wrote:
> Hi Slava,
> 
> In hfsplus, there are:
> 
>                         if (hfs_bnode_need_zeroout(tree))
>                                 hfs_bnode_clear(node, 0, tree->node_size);
> 
> bool hfs_bnode_need_zeroout(struct hfs_btree *tree)
> {
>         struct super_block *sb = tree->inode->i_sb;
>         struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);
>         const u32 volume_attr = be32_to_cpu(sbi->s_vhdr->attributes);
> 
>         return tree->cnid == HFSPLUS_CAT_CNID &&
>                 volume_attr & HFSPLUS_VOL_UNUSED_NODE_FIX;
> }                            
> 
> So do we need to change it to
>  
> 	if (tree->cnid == HFS_CAT_CNID)
> 		hfs_bnode_clear(node, 0, tree->node_size);
> 
> or something else?
> 

As far as I can see, it's not well documented feature. So, from one point of
view, it's make sense to check what fsck.hfs expects to see. Adrian, could we
check the fsck.hfs code? Maybe, we can find the answer there. From another point
of view, we have two key b-trees in HFS (Catalog file and Extents Overflow
file). And, I believe that it's good to zeroout the deleted nodes as for Catalog
File as for Extents Overflow file. Because, it could guarantee that "garbage"
from previous/deleted b-tree node state will not effect the operation with
current state of b-tree node.

Thanks,
Slava.






[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux