Re: [f2fs-dev] [PATCH] mkfs.f2fs: enforce alias_filename to match device name

From: Chao Yu

Date: Sun Sep 06 2026 - 22:24:03 EST


On 8/26/26 18:11, Daeho Jeong wrote:
From: Daeho Jeong <daehojeong@xxxxxxxxxx>

The kernel expects the device alias file in the root directory to match
the device basename (strrchr(path, '/') + 1) to identify the target device
both during mount in f2fs_restore_device_alias() and during reserve in
f2fs_ioc_reserve_dev_alias().

If a custom alias filename that differs from the device name is used,
the kernel fails to match the alias file at mount time (leaving
FDEV(i).has_alias unset and allowing pinned files to allocate in that
range) and subsequently fails to reserve the device range when requested.

Enforce that if an alias filename is specified, it must match the device
name. Also allow specifying just '-c <device>@' as a shorthand so users
do not have to redundantly type the device basename twice.

Do we need to add a sanity check in kernel side as well, show warning info
if device name doesn't match device alias file name?


Reported-by: Wenjie Qi <qiwenjie@xxxxxxxxxx>
Fixes: 8cc4e257ec20 ("mkfs.f2fs: add device aliasing feature")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Daeho Jeong <daehojeong@xxxxxxxxxx>

Reviewed-by: Chao Yu <chao@xxxxxxxxxx>

Thanks,