Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eb2bd5c4 authored by Christian Brauner (Microsoft)'s avatar Christian Brauner (Microsoft) Committed by Namjae Jeon
Browse files

exfat: fs: port ->getattr() to pass mnt_idmap



Convert to struct mnt_idmap.

Last cycle we merged the necessary infrastructure in
256c8aed2b42 ("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>
Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
parent f4f94fa7
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -480,13 +480,16 @@ void exfat_truncate(struct inode *inode);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
int exfat_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
		  struct iattr *attr);
int exfat_getattr(struct mnt_idmap *idmap, const struct path *path,
		  struct kstat *stat, unsigned int request_mask,
		  unsigned int query_flags);
#else
int exfat_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
		  struct iattr *attr);
#endif
int exfat_getattr(struct user_namespace *mnt_userns, const struct path *path,
		  struct kstat *stat, unsigned int request_mask,
		  unsigned int query_flags);
#endif
#else
int exfat_setattr(struct dentry *dentry, struct iattr *attr);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+10 −0
Original line number Diff line number Diff line
@@ -237,9 +237,15 @@ void exfat_truncate(struct inode *inode)
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
int exfat_getattr(struct mnt_idmap *idmap, const struct path *path,
		  struct kstat *stat, unsigned int request_mask,
		  unsigned int query_flags)
#else
int exfat_getattr(struct user_namespace *mnt_uerns, const struct path *path,
		  struct kstat *stat, unsigned int request_mask,
		  unsigned int query_flags)
#endif
#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
int exfat_getattr(const struct path *path, struct kstat *stat,
@@ -258,7 +264,11 @@ int exfat_getattr(struct vfsmount *mnt, struct dentry *dentry,
#endif

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
	generic_fillattr(&nop_mnt_idmap, inode, stat);
#else
	generic_fillattr(&init_user_ns, inode, stat);
#endif
#else
	generic_fillattr(inode, stat);
#endif