exfat: fs: port ->setattr() 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: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
parent
03ab6855b1
commit
f4f94fa720
@ -477,8 +477,13 @@ int __exfat_truncate(struct inode *inode);
|
||||
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_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct iattr *attr);
|
||||
#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);
|
||||
|
13
file.c
13
file.c
@ -273,8 +273,13 @@ int exfat_getattr(struct vfsmount *mnt, struct dentry *dentry,
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
int exfat_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct iattr *attr)
|
||||
#else
|
||||
int exfat_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
|
||||
struct iattr *attr)
|
||||
#endif
|
||||
#else
|
||||
int exfat_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
#endif
|
||||
@ -304,7 +309,11 @@ int exfat_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 37))) || \
|
||||
(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
error = setattr_prepare(&nop_mnt_idmap, dentry, attr);
|
||||
#else
|
||||
error = setattr_prepare(&init_user_ns, dentry, attr);
|
||||
#endif
|
||||
#else
|
||||
error = setattr_prepare(dentry, attr);
|
||||
#endif
|
||||
@ -342,7 +351,11 @@ int exfat_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
setattr_copy(&nop_mnt_idmap, inode, attr);
|
||||
#else
|
||||
setattr_copy(&init_user_ns, inode, attr);
|
||||
#endif
|
||||
#else
|
||||
setattr_copy(inode, attr);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user