mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Linux 6.6 compat: generic_fillattr has a new u32 request_mask added at arg2
In commit 0d72b92883c651a11059d93335f33d65c6eb653b, a new u32 argument for the request_mask was added to generic_fillattr. This is the same request_mask for statx that's present in the most recent API implemented by zpl_getattr_impl. This commit conditionally adds it to the zpl_generic_fillattr(...) macro, as well as the zfs_getattr_fast(...) implementation, when configure determines it's present in the kernel's generic_fillattr(...). Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Coleman Kane <ckane@colemankane.org> Closes #15263
This commit is contained in:
parent
fe9d409e90
commit
21875dd090
@ -7,6 +7,10 @@ dnl #
|
|||||||
dnl # 6.3 API
|
dnl # 6.3 API
|
||||||
dnl # generic_fillattr() now takes struct mnt_idmap* as the first argument
|
dnl # generic_fillattr() now takes struct mnt_idmap* as the first argument
|
||||||
dnl #
|
dnl #
|
||||||
|
dnl # 6.6 API
|
||||||
|
dnl # generic_fillattr() now takes u32 as second argument, representing a
|
||||||
|
dnl # request_mask for statx
|
||||||
|
dnl #
|
||||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR], [
|
AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR], [
|
||||||
ZFS_LINUX_TEST_SRC([generic_fillattr_userns], [
|
ZFS_LINUX_TEST_SRC([generic_fillattr_userns], [
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
@ -25,9 +29,25 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR], [
|
|||||||
struct kstat *k = NULL;
|
struct kstat *k = NULL;
|
||||||
generic_fillattr(idmap, in, k);
|
generic_fillattr(idmap, in, k);
|
||||||
])
|
])
|
||||||
|
|
||||||
|
ZFS_LINUX_TEST_SRC([generic_fillattr_mnt_idmap_reqmask], [
|
||||||
|
#include <linux/fs.h>
|
||||||
|
],[
|
||||||
|
struct mnt_idmap *idmap = NULL;
|
||||||
|
struct inode *in = NULL;
|
||||||
|
struct kstat *k = NULL;
|
||||||
|
generic_fillattr(idmap, 0, in, k);
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN([ZFS_AC_KERNEL_GENERIC_FILLATTR], [
|
AC_DEFUN([ZFS_AC_KERNEL_GENERIC_FILLATTR], [
|
||||||
|
AC_MSG_CHECKING(
|
||||||
|
[whether generic_fillattr requires struct mnt_idmap* and request_mask])
|
||||||
|
ZFS_LINUX_TEST_RESULT([generic_fillattr_mnt_idmap_reqmask], [
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
AC_DEFINE(HAVE_GENERIC_FILLATTR_IDMAP_REQMASK, 1,
|
||||||
|
[generic_fillattr requires struct mnt_idmap* and u32 request_mask])
|
||||||
|
],[
|
||||||
AC_MSG_CHECKING([whether generic_fillattr requires struct mnt_idmap*])
|
AC_MSG_CHECKING([whether generic_fillattr requires struct mnt_idmap*])
|
||||||
ZFS_LINUX_TEST_RESULT([generic_fillattr_mnt_idmap], [
|
ZFS_LINUX_TEST_RESULT([generic_fillattr_mnt_idmap], [
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
@ -43,5 +63,6 @@ AC_DEFUN([ZFS_AC_KERNEL_GENERIC_FILLATTR], [
|
|||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -461,10 +461,16 @@ zpl_is_32bit_api(void)
|
|||||||
* 6.3 API change
|
* 6.3 API change
|
||||||
* generic_fillattr() first arg is changed to struct mnt_idmap *
|
* generic_fillattr() first arg is changed to struct mnt_idmap *
|
||||||
*
|
*
|
||||||
|
* 6.6 API change
|
||||||
|
* generic_fillattr() gets new second arg request_mask, a u32 type
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_GENERIC_FILLATTR_IDMAP
|
#ifdef HAVE_GENERIC_FILLATTR_IDMAP
|
||||||
#define zpl_generic_fillattr(idmap, ip, sp) \
|
#define zpl_generic_fillattr(idmap, ip, sp) \
|
||||||
generic_fillattr(idmap, ip, sp)
|
generic_fillattr(idmap, ip, sp)
|
||||||
|
#elif defined(HAVE_GENERIC_FILLATTR_IDMAP_REQMASK)
|
||||||
|
#define zpl_generic_fillattr(idmap, rqm, ip, sp) \
|
||||||
|
generic_fillattr(idmap, rqm, ip, sp)
|
||||||
#elif defined(HAVE_GENERIC_FILLATTR_USERNS)
|
#elif defined(HAVE_GENERIC_FILLATTR_USERNS)
|
||||||
#define zpl_generic_fillattr(user_ns, ip, sp) \
|
#define zpl_generic_fillattr(user_ns, ip, sp) \
|
||||||
generic_fillattr(user_ns, ip, sp)
|
generic_fillattr(user_ns, ip, sp)
|
||||||
|
@ -56,7 +56,12 @@ extern int zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap,
|
|||||||
extern int zfs_rmdir(znode_t *dzp, char *name, znode_t *cwd,
|
extern int zfs_rmdir(znode_t *dzp, char *name, znode_t *cwd,
|
||||||
cred_t *cr, int flags);
|
cred_t *cr, int flags);
|
||||||
extern int zfs_readdir(struct inode *ip, zpl_dir_context_t *ctx, cred_t *cr);
|
extern int zfs_readdir(struct inode *ip, zpl_dir_context_t *ctx, cred_t *cr);
|
||||||
|
#ifdef HAVE_GENERIC_FILLATTR_IDMAP_REQMASK
|
||||||
|
extern int zfs_getattr_fast(zidmap_t *, u32 request_mask, struct inode *ip,
|
||||||
|
struct kstat *sp);
|
||||||
|
#else
|
||||||
extern int zfs_getattr_fast(zidmap_t *, struct inode *ip, struct kstat *sp);
|
extern int zfs_getattr_fast(zidmap_t *, struct inode *ip, struct kstat *sp);
|
||||||
|
#endif
|
||||||
extern int zfs_setattr(znode_t *zp, vattr_t *vap, int flag, cred_t *cr,
|
extern int zfs_setattr(znode_t *zp, vattr_t *vap, int flag, cred_t *cr,
|
||||||
zidmap_t *mnt_ns);
|
zidmap_t *mnt_ns);
|
||||||
extern int zfs_rename(znode_t *sdzp, char *snm, znode_t *tdzp,
|
extern int zfs_rename(znode_t *sdzp, char *snm, znode_t *tdzp,
|
||||||
|
@ -1652,7 +1652,12 @@ out:
|
|||||||
* RETURN: 0 (always succeeds)
|
* RETURN: 0 (always succeeds)
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
|
#ifdef HAVE_GENERIC_FILLATTR_IDMAP_REQMASK
|
||||||
|
zfs_getattr_fast(zidmap_t *user_ns, u32 request_mask, struct inode *ip,
|
||||||
|
struct kstat *sp)
|
||||||
|
#else
|
||||||
zfs_getattr_fast(zidmap_t *user_ns, struct inode *ip, struct kstat *sp)
|
zfs_getattr_fast(zidmap_t *user_ns, struct inode *ip, struct kstat *sp)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
znode_t *zp = ITOZ(ip);
|
znode_t *zp = ITOZ(ip);
|
||||||
zfsvfs_t *zfsvfs = ITOZSB(ip);
|
zfsvfs_t *zfsvfs = ITOZSB(ip);
|
||||||
@ -1665,7 +1670,11 @@ zfs_getattr_fast(zidmap_t *user_ns, struct inode *ip, struct kstat *sp)
|
|||||||
|
|
||||||
mutex_enter(&zp->z_lock);
|
mutex_enter(&zp->z_lock);
|
||||||
|
|
||||||
|
#ifdef HAVE_GENERIC_FILLATTR_IDMAP_REQMASK
|
||||||
|
zpl_generic_fillattr(user_ns, request_mask, ip, sp);
|
||||||
|
#else
|
||||||
zpl_generic_fillattr(user_ns, ip, sp);
|
zpl_generic_fillattr(user_ns, ip, sp);
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* +1 link count for root inode with visible '.zfs' directory.
|
* +1 link count for root inode with visible '.zfs' directory.
|
||||||
*/
|
*/
|
||||||
|
@ -124,6 +124,8 @@ zpl_root_getattr_impl(const struct path *path, struct kstat *stat,
|
|||||||
generic_fillattr(user_ns, ip, stat);
|
generic_fillattr(user_ns, ip, stat);
|
||||||
#elif defined(HAVE_GENERIC_FILLATTR_IDMAP)
|
#elif defined(HAVE_GENERIC_FILLATTR_IDMAP)
|
||||||
generic_fillattr(user_ns, ip, stat);
|
generic_fillattr(user_ns, ip, stat);
|
||||||
|
#elif defined(HAVE_GENERIC_FILLATTR_IDMAP_REQMASK)
|
||||||
|
generic_fillattr(user_ns, request_mask, ip, stat);
|
||||||
#else
|
#else
|
||||||
(void) user_ns;
|
(void) user_ns;
|
||||||
#endif
|
#endif
|
||||||
@ -435,6 +437,8 @@ zpl_snapdir_getattr_impl(const struct path *path, struct kstat *stat,
|
|||||||
generic_fillattr(user_ns, ip, stat);
|
generic_fillattr(user_ns, ip, stat);
|
||||||
#elif defined(HAVE_GENERIC_FILLATTR_IDMAP)
|
#elif defined(HAVE_GENERIC_FILLATTR_IDMAP)
|
||||||
generic_fillattr(user_ns, ip, stat);
|
generic_fillattr(user_ns, ip, stat);
|
||||||
|
#elif defined(HAVE_GENERIC_FILLATTR_IDMAP_REQMASK)
|
||||||
|
generic_fillattr(user_ns, request_mask, ip, stat);
|
||||||
#else
|
#else
|
||||||
(void) user_ns;
|
(void) user_ns;
|
||||||
#endif
|
#endif
|
||||||
@ -609,6 +613,8 @@ zpl_shares_getattr_impl(const struct path *path, struct kstat *stat,
|
|||||||
generic_fillattr(user_ns, path->dentry->d_inode, stat);
|
generic_fillattr(user_ns, path->dentry->d_inode, stat);
|
||||||
#elif defined(HAVE_GENERIC_FILLATTR_IDMAP)
|
#elif defined(HAVE_GENERIC_FILLATTR_IDMAP)
|
||||||
generic_fillattr(user_ns, path->dentry->d_inode, stat);
|
generic_fillattr(user_ns, path->dentry->d_inode, stat);
|
||||||
|
#elif defined(HAVE_GENERIC_FILLATTR_IDMAP_REQMASK)
|
||||||
|
generic_fillattr(user_ns, request_mask, ip, stat);
|
||||||
#else
|
#else
|
||||||
(void) user_ns;
|
(void) user_ns;
|
||||||
#endif
|
#endif
|
||||||
@ -623,7 +629,10 @@ zpl_shares_getattr_impl(const struct path *path, struct kstat *stat,
|
|||||||
|
|
||||||
error = -zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp);
|
error = -zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp);
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
#if (defined(HAVE_USERNS_IOPS_GETATTR) || defined(HAVE_IDMAP_IOPS_GETATTR))
|
#ifdef HAVE_GENERIC_FILLATTR_IDMAP_REQMASK
|
||||||
|
error = -zfs_getattr_fast(user_ns, request_mask, ZTOI(dzp),
|
||||||
|
stat);
|
||||||
|
#elif (defined(HAVE_USERNS_IOPS_GETATTR) || defined(HAVE_IDMAP_IOPS_GETATTR))
|
||||||
error = -zfs_getattr_fast(user_ns, ZTOI(dzp), stat);
|
error = -zfs_getattr_fast(user_ns, ZTOI(dzp), stat);
|
||||||
#else
|
#else
|
||||||
error = -zfs_getattr_fast(kcred->user_ns, ZTOI(dzp), stat);
|
error = -zfs_getattr_fast(kcred->user_ns, ZTOI(dzp), stat);
|
||||||
|
@ -435,7 +435,9 @@ zpl_getattr_impl(const struct path *path, struct kstat *stat, u32 request_mask,
|
|||||||
* XXX query_flags currently ignored.
|
* XXX query_flags currently ignored.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if (defined(HAVE_USERNS_IOPS_GETATTR) || defined(HAVE_IDMAP_IOPS_GETATTR))
|
#ifdef HAVE_GENERIC_FILLATTR_IDMAP_REQMASK
|
||||||
|
error = -zfs_getattr_fast(user_ns, request_mask, ip, stat);
|
||||||
|
#elif (defined(HAVE_USERNS_IOPS_GETATTR) || defined(HAVE_IDMAP_IOPS_GETATTR))
|
||||||
error = -zfs_getattr_fast(user_ns, ip, stat);
|
error = -zfs_getattr_fast(user_ns, ip, stat);
|
||||||
#else
|
#else
|
||||||
error = -zfs_getattr_fast(kcred->user_ns, ip, stat);
|
error = -zfs_getattr_fast(kcred->user_ns, ip, stat);
|
||||||
|
Loading…
Reference in New Issue
Block a user