mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Linux 6.3 compat: idmapped mount API changes
Linux kernel 6.3 changed a bunch of APIs to use the dedicated idmap type for mounts (struct mnt_idmap), we need to detect these changes and make zfs work with the new APIs. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Youzhong Yang <yyang@mathworks.com> Closes #14682
This commit is contained in:
@@ -341,7 +341,8 @@ static inline void zfs_gid_write(struct inode *ip, gid_t gid)
|
||||
* 4.9 API change
|
||||
*/
|
||||
#if !(defined(HAVE_SETATTR_PREPARE_NO_USERNS) || \
|
||||
defined(HAVE_SETATTR_PREPARE_USERNS))
|
||||
defined(HAVE_SETATTR_PREPARE_USERNS) || \
|
||||
defined(HAVE_SETATTR_PREPARE_IDMAP))
|
||||
static inline int
|
||||
setattr_prepare(struct dentry *dentry, struct iattr *ia)
|
||||
{
|
||||
@@ -396,6 +397,15 @@ func(struct user_namespace *user_ns, const struct path *path, \
|
||||
return (func##_impl(user_ns, path, stat, request_mask, \
|
||||
query_flags)); \
|
||||
}
|
||||
#elif defined(HAVE_IDMAP_IOPS_GETATTR)
|
||||
#define ZPL_GETATTR_WRAPPER(func) \
|
||||
static int \
|
||||
func(struct mnt_idmap *user_ns, const struct path *path, \
|
||||
struct kstat *stat, u32 request_mask, unsigned int query_flags) \
|
||||
{ \
|
||||
return (func##_impl(user_ns, path, stat, request_mask, \
|
||||
query_flags)); \
|
||||
}
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
@@ -447,8 +457,15 @@ zpl_is_32bit_api(void)
|
||||
* 5.12 API change
|
||||
* To support id-mapped mounts, generic_fillattr() was modified to
|
||||
* accept a new struct user_namespace* as its first arg.
|
||||
*
|
||||
* 6.3 API change
|
||||
* generic_fillattr() first arg is changed to struct mnt_idmap *
|
||||
*
|
||||
*/
|
||||
#ifdef HAVE_GENERIC_FILLATTR_USERNS
|
||||
#ifdef HAVE_GENERIC_FILLATTR_IDMAP
|
||||
#define zpl_generic_fillattr(idmap, ip, sp) \
|
||||
generic_fillattr(idmap, ip, sp)
|
||||
#elif defined(HAVE_GENERIC_FILLATTR_USERNS)
|
||||
#define zpl_generic_fillattr(user_ns, ip, sp) \
|
||||
generic_fillattr(user_ns, ip, sp)
|
||||
#else
|
||||
|
||||
@@ -133,13 +133,28 @@ fn(const struct xattr_handler *handler, struct dentry *dentry, \
|
||||
#error "Unsupported kernel"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 6.3 API change,
|
||||
* The xattr_handler->set() callback was changed to take the
|
||||
* struct mnt_idmap* as the first arg, to support idmapped
|
||||
* mounts.
|
||||
*/
|
||||
#if defined(HAVE_XATTR_SET_IDMAP)
|
||||
#define ZPL_XATTR_SET_WRAPPER(fn) \
|
||||
static int \
|
||||
fn(const struct xattr_handler *handler, struct mnt_idmap *user_ns, \
|
||||
struct dentry *dentry, struct inode *inode, const char *name, \
|
||||
const void *buffer, size_t size, int flags) \
|
||||
{ \
|
||||
return (__ ## fn(user_ns, inode, name, buffer, size, flags)); \
|
||||
}
|
||||
/*
|
||||
* 5.12 API change,
|
||||
* The xattr_handler->set() callback was changed to take the
|
||||
* struct user_namespace* as the first arg, to support idmapped
|
||||
* mounts.
|
||||
*/
|
||||
#if defined(HAVE_XATTR_SET_USERNS)
|
||||
#elif defined(HAVE_XATTR_SET_USERNS)
|
||||
#define ZPL_XATTR_SET_WRAPPER(fn) \
|
||||
static int \
|
||||
fn(const struct xattr_handler *handler, struct user_namespace *user_ns, \
|
||||
|
||||
Reference in New Issue
Block a user