Revert "hostfs: convert hostfs to use the new mount API"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

This reverts commit d073828fe0f5cd9531bb918ab0b5a7b920b1bfdb which is
commit cd140ce9f611a5e9d2a5989a282b75e55c71dab3 upstream.

It is reported to cause build issues and odds are the root problem isn't
really an issue on the 6.6.y branch anyway.  If it is, someone can
provide a working set of backported patches.

Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx>
Link: https://lore.kernel.org/r/cd10a924-ae65-4b02-aea2-e629947ca7a3@xxxxxxxxxxxx
Cc: Hongbo Li <lihongbo22@xxxxxxxxxx>
Cc: Christian Brauner <brauner@xxxxxxxxxx>
Cc: Sasha Levin <sashal@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 fs/hostfs/hostfs_kern.c |   83 ++++++++++++------------------------------------
 1 file changed, 21 insertions(+), 62 deletions(-)

--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -16,16 +16,11 @@
 #include <linux/seq_file.h>
 #include <linux/writeback.h>
 #include <linux/mount.h>
-#include <linux/fs_context.h>
 #include <linux/namei.h>
 #include "hostfs.h"
 #include <init.h>
 #include <kern.h>
 
-struct hostfs_fs_info {
-	char *host_root_path;
-};
-
 struct hostfs_inode_info {
 	int fd;
 	fmode_t mode;
@@ -95,10 +90,8 @@ static char *__dentry_name(struct dentry
 	char *p = dentry_path_raw(dentry, name, PATH_MAX);
 	char *root;
 	size_t len;
-	struct hostfs_fs_info *fsi;
 
-	fsi = dentry->d_sb->s_fs_info;
-	root = fsi->host_root_path;
+	root = dentry->d_sb->s_fs_info;
 	len = strlen(root);
 	if (IS_ERR(p)) {
 		__putname(name);
@@ -203,10 +196,8 @@ static int hostfs_statfs(struct dentry *
 	long long f_bavail;
 	long long f_files;
 	long long f_ffree;
-	struct hostfs_fs_info *fsi;
 
-	fsi = dentry->d_sb->s_fs_info;
-	err = do_statfs(fsi->host_root_path,
+	err = do_statfs(dentry->d_sb->s_fs_info,
 			&sf->f_bsize, &f_blocks, &f_bfree, &f_bavail, &f_files,
 			&f_ffree, &sf->f_fsid, sizeof(sf->f_fsid),
 			&sf->f_namelen);
@@ -254,11 +245,7 @@ static void hostfs_free_inode(struct ino
 
 static int hostfs_show_options(struct seq_file *seq, struct dentry *root)
 {
-	struct hostfs_fs_info *fsi;
-	const char *root_path;
-
-	fsi = root->d_sb->s_fs_info;
-	root_path = fsi->host_root_path;
+	const char *root_path = root->d_sb->s_fs_info;
 	size_t offset = strlen(root_ino) + 1;
 
 	if (strlen(root_path) > offset)
@@ -937,11 +924,10 @@ static const struct inode_operations hos
 	.get_link	= hostfs_get_link,
 };
 
-static int hostfs_fill_super(struct super_block *sb, struct fs_context *fc)
+static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
 {
-	struct hostfs_fs_info *fsi = sb->s_fs_info;
 	struct inode *root_inode;
-	char *host_root = fc->source;
+	char *host_root_path, *req_root = d;
 	int err;
 
 	sb->s_blocksize = 1024;
@@ -955,15 +941,15 @@ static int hostfs_fill_super(struct supe
 		return err;
 
 	/* NULL is printed as '(null)' by printf(): avoid that. */
-	if (fc->source == NULL)
-		host_root = "";
+	if (req_root == NULL)
+		req_root = "";
 
-	fsi->host_root_path =
-		kasprintf(GFP_KERNEL, "%s/%s", root_ino, host_root);
-	if (fsi->host_root_path == NULL)
+	sb->s_fs_info = host_root_path =
+		kasprintf(GFP_KERNEL, "%s/%s", root_ino, req_root);
+	if (host_root_path == NULL)
 		return -ENOMEM;
 
-	root_inode = hostfs_iget(sb, fsi->host_root_path);
+	root_inode = hostfs_iget(sb, host_root_path);
 	if (IS_ERR(root_inode))
 		return PTR_ERR(root_inode);
 
@@ -971,7 +957,7 @@ static int hostfs_fill_super(struct supe
 		char *name;
 
 		iput(root_inode);
-		name = follow_link(fsi->host_root_path);
+		name = follow_link(host_root_path);
 		if (IS_ERR(name))
 			return PTR_ERR(name);
 
@@ -988,38 +974,11 @@ static int hostfs_fill_super(struct supe
 	return 0;
 }
 
-static int hostfs_fc_get_tree(struct fs_context *fc)
+static struct dentry *hostfs_read_sb(struct file_system_type *type,
+			  int flags, const char *dev_name,
+			  void *data)
 {
-	return get_tree_nodev(fc, hostfs_fill_super);
-}
-
-static void hostfs_fc_free(struct fs_context *fc)
-{
-	struct hostfs_fs_info *fsi = fc->s_fs_info;
-
-	if (!fsi)
-		return;
-
-	kfree(fsi->host_root_path);
-	kfree(fsi);
-}
-
-static const struct fs_context_operations hostfs_context_ops = {
-	.get_tree	= hostfs_fc_get_tree,
-	.free		= hostfs_fc_free,
-};
-
-static int hostfs_init_fs_context(struct fs_context *fc)
-{
-	struct hostfs_fs_info *fsi;
-
-	fsi = kzalloc(sizeof(*fsi), GFP_KERNEL);
-	if (!fsi)
-		return -ENOMEM;
-
-	fc->s_fs_info = fsi;
-	fc->ops = &hostfs_context_ops;
-	return 0;
+	return mount_nodev(type, flags, data, hostfs_fill_sb_common);
 }
 
 static void hostfs_kill_sb(struct super_block *s)
@@ -1029,11 +988,11 @@ static void hostfs_kill_sb(struct super_
 }
 
 static struct file_system_type hostfs_type = {
-	.owner			= THIS_MODULE,
-	.name			= "hostfs",
-	.init_fs_context	= hostfs_init_fs_context,
-	.kill_sb		= hostfs_kill_sb,
-	.fs_flags		= 0,
+	.owner 		= THIS_MODULE,
+	.name 		= "hostfs",
+	.mount	 	= hostfs_read_sb,
+	.kill_sb	= hostfs_kill_sb,
+	.fs_flags 	= 0,
 };
 MODULE_ALIAS_FS("hostfs");
 


Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are

queue-6.6/revert-hostfs-fix-string-handling-in-__dentry_name.patch
queue-6.6/revert-hostfs-convert-hostfs-to-use-the-new-mount-api.patch
queue-6.6/revert-hostfs-fix-the-host-directory-parse-when-mounting.patch
queue-6.6/revert-hostfs-add-const-qualifier-to-host_root-in-hostfs_fill_super.patch




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux