Bug #3316
openhammer2_dirent_create() allows creating >1 dirents with the same name
0%
Description
When creating a file/directory in HAMMER2, hammer2_dirent_create() scans lhc of a given name if a chain or ondisk blockref already exists. If it exists, the function assigns a different (incremented) lhc value. This ends up allowing two or more inodes with the same dirent name under the same directory.
Note that some (or many) filesystem implementation scans its parent directory contents and return EEXIST if the same name already exists.
In reality, VFS prevents this via name lookup and returns EEXIST before it reaches there. But if a program runs HAMMER2 without VFS on top of it, namely makefs(8), this can not be prevented.
In fact below diff creates an image containing two entities (different inode#, different blockref key, but same name and data) of each regular file in the source directory.
https://leaf.dragonflybsd.org/~tkusumi/diff/makefs_hammer2_dup_regfile.patch