Project

General

Profile

Actions

Bug #3316

open

hammer2_dirent_create() allows creating >1 dirents with the same name

Added by tkusumi almost 2 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
06/05/2022
Due date:
% Done:

0%

Estimated time:

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

Actions

Also available in: Atom PDF