Skip to content

Commit 7487179

Browse files
committed
ntfs3: serve as alias for the legacy ntfs driver
Johan Hovold reported that removing the legacy ntfs driver broke boot for him since his fstab uses the legacy ntfs driver to access firmware from the original Windows partition. Use ntfs3 as an alias for legacy ntfs if CONFIG_NTFS_FS is selected. This is similar to how ext3 is treated. Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/20240325-hinkriegen-zuziehen-d7e2c490427a@brauner Fixes: 7ffa8f3 ("fs: Remove NTFS classic") Tested-by: Johan Hovold <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Johan Hovold <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 9617cd6 commit 7487179

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

fs/ntfs3/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,12 @@ config NTFS3_FS_POSIX_ACL
4646
NOTE: this is linux only feature. Windows will ignore these ACLs.
4747

4848
If you don't know what Access Control Lists are, say N.
49+
50+
config NTFS_FS
51+
tristate "NTFS file system support"
52+
select NTFS3_FS
53+
select BUFFER_HEAD
54+
select NLS
55+
help
56+
This config option is here only for backward compatibility. NTFS
57+
filesystem is now handled by the NTFS3 driver.

fs/ntfs3/super.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,6 +1798,35 @@ static struct file_system_type ntfs_fs_type = {
17981798
.kill_sb = ntfs3_kill_sb,
17991799
.fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
18001800
};
1801+
1802+
#if IS_ENABLED(CONFIG_NTFS_FS)
1803+
static struct file_system_type ntfs_legacy_fs_type = {
1804+
.owner = THIS_MODULE,
1805+
.name = "ntfs",
1806+
.init_fs_context = ntfs_init_fs_context,
1807+
.parameters = ntfs_fs_parameters,
1808+
.kill_sb = ntfs3_kill_sb,
1809+
.fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
1810+
};
1811+
MODULE_ALIAS_FS("ntfs");
1812+
1813+
static inline void register_as_ntfs_legacy(void)
1814+
{
1815+
int err = register_filesystem(&ntfs_legacy_fs_type);
1816+
if (err)
1817+
pr_warn("ntfs3: Failed to register legacy ntfs filesystem driver: %d\n", err);
1818+
}
1819+
1820+
static inline void unregister_as_ntfs_legacy(void)
1821+
{
1822+
unregister_filesystem(&ntfs_legacy_fs_type);
1823+
}
1824+
#else
1825+
static inline void register_as_ntfs_legacy(void) {}
1826+
static inline void unregister_as_ntfs_legacy(void) {}
1827+
#endif
1828+
1829+
18011830
// clang-format on
18021831

18031832
static int __init init_ntfs_fs(void)
@@ -1832,6 +1861,7 @@ static int __init init_ntfs_fs(void)
18321861
goto out1;
18331862
}
18341863

1864+
register_as_ntfs_legacy();
18351865
err = register_filesystem(&ntfs_fs_type);
18361866
if (err)
18371867
goto out;
@@ -1849,6 +1879,7 @@ static void __exit exit_ntfs_fs(void)
18491879
rcu_barrier();
18501880
kmem_cache_destroy(ntfs_inode_cachep);
18511881
unregister_filesystem(&ntfs_fs_type);
1882+
unregister_as_ntfs_legacy();
18521883
ntfs3_exit_bitmap();
18531884

18541885
#ifdef CONFIG_PROC_FS

0 commit comments

Comments
 (0)