Issue #3316 has been updated by dillon.
The directory hash collision space does not guarantee name uniqueness, so the
iterator is there on purpose to deal with hash collisions (names might be
different, but key calculates to the same value). Higher levels are
responsible for ensuring that name duplication is disallowed.
There is a second reason here too... even though it isn't in the filesystem
(yet), the multi-master quorum algorithm has to be able to synchronize valid
entries even in the presence of invalid entries, so it is possible for two
entries to exist on the media for the same filename where one has quorum and
the other does not. Temporarily (the one without quorum would eventually be
deleted).
So I don't think this is a bug per-say.
-Matt
Bug #3316: hammer2_dirent_create() allows creating >1 dirents with the same name
http://bugs.dragonflybsd.org/issues/3316#change-14360
* Author: tkusumi
* Status: New
* Priority: Normal
* Target version: 6.4
* Start date: 2022-06-05
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
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://bugs.dragonflybsd.org/my/account