All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Johan Hovold <johan@kernel.org>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Anton Altaparmakov <anton@tuxera.com>,
	Namjae Jeon <linkinjeon@kernel.org>,
	ntfs3@lists.linux.dev
Cc: Christian Brauner <brauner@kernel.org>,
	linux-fsdevel@vger.kernel.org,
	linux-ntfs-dev@lists.sourceforge.net,
	regressions@lists.linux.dev
Subject: [PATCH 1/2] ntfs3: serve as alias for the legacy ntfs driver
Date: Mon, 25 Mar 2024 09:34:36 +0100	[thread overview]
Message-ID: <20240325-hinkriegen-zuziehen-d7e2c490427a@brauner> (raw)
In-Reply-To: <Zf2zPf5TO5oYt3I3@hovoldconsulting.com>

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.

Fixes: 7ffa8f3d3023 ("fs: Remove NTFS classic")
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/Zf2zPf5TO5oYt3I3@hovoldconsulting.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
Hey,

This is so far compile tested. It would be great if someone could test
this. @Johan?

Thanks!
Christian
---
 fs/ntfs3/Kconfig |  9 +++++++++
 fs/ntfs3/super.c | 31 +++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/fs/ntfs3/Kconfig b/fs/ntfs3/Kconfig
index cdfdf51e55d7..7bc31d69f680 100644
--- a/fs/ntfs3/Kconfig
+++ b/fs/ntfs3/Kconfig
@@ -46,3 +46,12 @@ config NTFS3_FS_POSIX_ACL
 	  NOTE: this is linux only feature. Windows will ignore these ACLs.
 
 	  If you don't know what Access Control Lists are, say N.
+
+config NTFS_FS
+	tristate "NTFS file system support"
+	select NTFS3_FS
+	select BUFFER_HEAD
+	select NLS
+	help
+	  This config option is here only for backward compatibility. NTFS
+	  filesystem is now handled by the NTFS3 driver.
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 9df7c20d066f..8d2e51bae2cb 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -1798,6 +1798,35 @@ static struct file_system_type ntfs_fs_type = {
 	.kill_sb		= ntfs3_kill_sb,
 	.fs_flags		= FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
 };
+
+#if IS_ENABLED(CONFIG_NTFS_FS)
+static struct file_system_type ntfs_legacy_fs_type = {
+	.owner			= THIS_MODULE,
+	.name			= "ntfs",
+	.init_fs_context	= ntfs_init_fs_context,
+	.parameters		= ntfs_fs_parameters,
+	.kill_sb		= ntfs3_kill_sb,
+	.fs_flags		= FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
+};
+MODULE_ALIAS_FS("ntfs");
+
+static inline void register_as_ntfs_legacy(void)
+{
+	int err = register_filesystem(&ntfs_legacy_fs_type);
+	if (err)
+		pr_warn("ntfs3: Failed to register legacy ntfs filesystem driver: %d\n", err);
+}
+
+static inline void unregister_as_ntfs_legacy(void)
+{
+	unregister_filesystem(&ntfs_legacy_fs_type);
+}
+#else
+static inline void register_as_ntfs_legacy(void) {}
+static inline void unregister_as_ntfs_legacy(void) {}
+#endif
+
+
 // clang-format on
 
 static int __init init_ntfs_fs(void)
@@ -1832,6 +1861,7 @@ static int __init init_ntfs_fs(void)
 		goto out1;
 	}
 
+	register_as_ntfs_legacy();
 	err = register_filesystem(&ntfs_fs_type);
 	if (err)
 		goto out;
@@ -1849,6 +1879,7 @@ static void __exit exit_ntfs_fs(void)
 	rcu_barrier();
 	kmem_cache_destroy(ntfs_inode_cachep);
 	unregister_filesystem(&ntfs_fs_type);
+	unregister_as_ntfs_legacy();
 	ntfs3_exit_bitmap();
 
 #ifdef CONFIG_PROC_FS
-- 
2.43.0


  parent reply	other threads:[~2024-03-25  8:35 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15  7:20 [PATCH] fs: Remove NTFS classic Matthew Wilcox (Oracle)
2024-01-15 11:00 ` Anton Altaparmakov
2024-01-15 11:08   ` Enrico Mioso
2024-01-15 11:41   ` Namjae Jeon
2024-01-15 14:49   ` Matthew Wilcox
2024-01-16  9:52     ` [PATCH] " Anton Altaparmakov
2024-01-15 22:20 ` [PATCH] fs: " Dave Chinner
2024-01-16  9:33 ` Christian Brauner
2024-01-16  9:51   ` [PATCH] " Anton Altaparmakov
2024-01-16 11:06     ` Christian Brauner
2024-01-16 11:32       ` Anton Altaparmakov
2024-03-22 16:35   ` [PATCH] fs: " Johan Hovold
2024-03-25  8:28     ` Christian Brauner
2024-03-25  8:34     ` Christian Brauner [this message]
2024-03-25 10:09       ` [PATCH 1/2] ntfs3: serve as alias for the legacy ntfs driver Johan Hovold
2024-03-25 12:01         ` Christian Brauner
2024-03-25  8:34     ` [PATCH 2/2] ntfs3: remove warning Christian Brauner
2024-03-25 10:12       ` Johan Hovold
2024-03-25 12:05         ` Christian Brauner
2024-04-04  8:06           ` Linux regression tracking (Thorsten Leemhuis)
2024-04-11 11:03             ` Konstantin Komarov
2024-04-15  9:54               ` Johan Hovold
2024-04-15 10:20                 ` Johan Hovold
2024-04-15 11:32                   ` Anton Altaparmakov
2024-04-15 11:42                     ` Johan Hovold
2024-04-15 14:15                       ` Christian Brauner
2024-04-15 15:23                         ` Linus Torvalds
2024-04-15 15:27                           ` Matthew Wilcox
2024-04-15 15:47                           ` Johan Hovold
2024-04-15 15:51                             ` Linus Torvalds
2024-04-15 16:06                               ` Johan Hovold
2024-04-16 10:38                                 ` Christian Brauner
2024-04-16 12:55                                   ` Johan Hovold
2024-04-17 16:07       ` Konstantin Komarov
2024-04-18  6:36         ` Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240325-hinkriegen-zuziehen-d7e2c490427a@brauner \
    --to=brauner@kernel.org \
    --cc=anton@tuxera.com \
    --cc=johan@kernel.org \
    --cc=linkinjeon@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-ntfs-dev@lists.sourceforge.net \
    --cc=ntfs3@lists.linux.dev \
    --cc=regressions@lists.linux.dev \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.