Unverified Commit 7a77db95 authored by Christian Brauner's avatar Christian Brauner Committed by Christian Brauner (Microsoft)
Browse files

fs: port ->symlink() to pass mnt_idmap



Convert to struct mnt_idmap.

Last cycle we merged the necessary infrastructure in
256c8aed ("fs: introduce dedicated idmap type for mounts").
This is just the conversion to struct mnt_idmap.

Currently we still pass around the plain namespace that was attached to a
mount. This is in general pretty convenient but it makes it easy to
conflate namespaces that are relevant on the filesystem with namespaces
that are relevent on the mount level. Especially for non-vfs developers
without detailed knowledge in this area this can be a potential source for
bugs.

Once the conversion to struct mnt_idmap is done all helpers down to the
really low-level helpers will take a struct mnt_idmap argument instead of
two namespace arguments. This way it becomes impossible to conflate the two
eliminating the possibility of any bugs. All of the vfs and all filesystems
only operate on struct mnt_idmap.

Acked-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarChristian Brauner (Microsoft) <brauner@kernel.org>
parent 6c960e68
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ prototypes::
	struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
	int (*link) (struct dentry *,struct inode *,struct dentry *);
	int (*unlink) (struct inode *,struct dentry *);
	int (*symlink) (struct inode *,struct dentry *,const char *);
	int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *,const char *);
	int (*mkdir) (struct inode *,struct dentry *,umode_t);
	int (*rmdir) (struct inode *,struct dentry *);
	int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
+1 −1
Original line number Diff line number Diff line
@@ -425,7 +425,7 @@ As of kernel 2.6.22, the following members are defined:
		struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
		int (*link) (struct dentry *,struct inode *,struct dentry *);
		int (*unlink) (struct inode *,struct dentry *);
		int (*symlink) (struct user_namespace *, struct inode *,struct dentry *,const char *);
		int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *,const char *);
		int (*mkdir) (struct user_namespace *, struct inode *,struct dentry *,umode_t);
		int (*rmdir) (struct inode *,struct dentry *);
		int (*mknod) (struct user_namespace *, struct inode *,struct dentry *,umode_t,dev_t);
+2 −2
Original line number Diff line number Diff line
@@ -1300,7 +1300,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,

/**
 * v9fs_vfs_symlink - helper function to create symlinks
 * @mnt_userns: The user namespace of the mount
 * @idmap: idmap of the mount
 * @dir: directory inode containing symlink
 * @dentry: dentry for symlink
 * @symname: symlink data
@@ -1310,7 +1310,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
 */

static int
v9fs_vfs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
v9fs_vfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
		 struct dentry *dentry, const char *symname)
{
	p9_debug(P9_DEBUG_VFS, " %lu,%pd,%s\n",
+1 −1
Original line number Diff line number Diff line
@@ -688,7 +688,7 @@ v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode,
}

static int
v9fs_vfs_symlink_dotl(struct user_namespace *mnt_userns, struct inode *dir,
v9fs_vfs_symlink_dotl(struct mnt_idmap *idmap, struct inode *dir,
		      struct dentry *dentry, const char *symname)
{
	int err;
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ extern int affs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
extern int	affs_rmdir(struct inode *dir, struct dentry *dentry);
extern int	affs_link(struct dentry *olddentry, struct inode *dir,
			  struct dentry *dentry);
extern int	affs_symlink(struct user_namespace *mnt_userns,
extern int	affs_symlink(struct mnt_idmap *idmap,
			struct inode *dir, struct dentry *dentry,
			const char *symname);
extern int	affs_rename2(struct user_namespace *mnt_userns,
Loading