From a310b81669571b7796b977a6cd6761b12b1bf08d Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Thu, 11 Apr 2024 00:52:06 -0700 Subject: [PATCH] LU-16350 osd-ldiskfs: no_llseek removed, dquot_transfer Linux commit v5.19-rc2-6-g868941b14441 fs: remove no_llseek With the removal of no_llseek, leaving .llseek set to NULL is functionally equivalent. Only provide no_llseek if it exists. Linux commit v5.19-rc3-6-g71e7b535b890 quota: port quota helpers mount ids dquot_transfer adds a user namespace argument. Provide an osd_dquot_transfer() wrapper to discard the additional argument for older kernels. Lustre-change: https://review.whamcloud.com/49266 Lustre-commit: 2de1dbd440e2b26ea1bdf663b92a3e8c62a95ee7 Test-Parameters: trivial HPE-bug-id: LUS-11376 Signed-off-by: Shaun Tancheff Change-Id: If3165aed0d7b827b90e26d9f0174137d087ce57a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54732 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Yang Sheng --- lustre/autoconf/lustre-core.m4 | 53 +++++++++++++++++++++++++++++++++++++++ lustre/ofd/ofd_access_log.c | 2 ++ lustre/osd-ldiskfs/osd_handler.c | 2 +- lustre/osd-ldiskfs/osd_internal.h | 6 +++++ 4 files changed, 62 insertions(+), 1 deletion(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index dd1df49..9d66912 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -3239,6 +3239,55 @@ AC_DEFUN([LC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO], [ ]) # LC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO # +# LC_HAVE_NO_LLSEEK +# +# Linux commit v5.19-rc2-6-g868941b14441 +# fs: remove no_llseek +# +AC_DEFUN([LC_SRC_HAVE_NO_LLSEEK], [ + LB2_LINUX_TEST_SRC([no_llseek], [ + #include + ],[ + static const struct file_operations fops = { + .llseek = &no_llseek, + }; + (void)fops; + ],[-Werror]) +]) +AC_DEFUN([LC_HAVE_NO_LLSEEK], [ + AC_MSG_CHECKING([if no_llseek() is available]) + LB2_LINUX_TEST_RESULT([no_llseek], [ + AC_DEFINE(HAVE_NO_LLSEEK, 1, [no_llseek() is available]) + ]) +]) # LC_HAVE_NO_LLSEEK + +# +# LC_DQUOT_TRANSFER_WITH_USER_NS +# +# Linux commit v5.19-rc3-6-g71e7b535b890 +# quota: port quota helpers mount ids +# +AC_DEFUN([LC_SRC_DQUOT_TRANSFER_WITH_USER_NS], [ + LB2_LINUX_TEST_SRC([dquot_transfer], [ + #include + ],[ + struct user_namespace *userns = NULL; + struct inode *inode = NULL; + struct iattr *iattr = NULL; + int err __attribute__ ((unused)); + + err = dquot_transfer(userns, inode, iattr); + ],[-Werror]) +]) +AC_DEFUN([LC_DQUOT_TRANSFER_WITH_USER_NS], [ + AC_MSG_CHECKING([if dquot_transfer() has user_ns argument]) + LB2_LINUX_TEST_RESULT([dquot_transfer], [ + AC_DEFINE(HAVE_DQUOT_TRANSFER_WITH_USER_NS, 1, + [dquot_transfer() has user_ns argument]) + ]) +]) # LC_DQUOT_TRANSFER_WITH_USER_NS + +# # LC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO # # Linux commit v5.19-rc3-392-g5490da4f06d1 @@ -3761,6 +3810,8 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [ LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO # 6.0 + LC_SRC_HAVE_NO_LLSEEK + LC_SRC_DQUOT_TRANSFER_WITH_USER_NS LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO LC_SRC_REGISTER_SHRINKER_FORMAT_NAMED LC_SRC_HAVE_VFS_SETXATTR_NON_CONST_VALUE @@ -4005,6 +4056,8 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [ LC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO # 6.0 + LC_HAVE_NO_LLSEEK + LC_DQUOT_TRANSFER_WITH_USER_NS LC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO LC_REGISTER_SHRINKER_FORMAT_NAMED LC_HAVE_VFS_SETXATTR_NON_CONST_VALUE diff --git a/lustre/ofd/ofd_access_log.c b/lustre/ofd/ofd_access_log.c index ac7a8e1..51f6af3 100644 --- a/lustre/ofd/ofd_access_log.c +++ b/lustre/ofd/ofd_access_log.c @@ -433,7 +433,9 @@ static const struct file_operations oal_fops = { .read = &oal_file_read, .write = &oal_file_write, .poll = &oal_file_poll, +#ifdef HAVE_NO_LLSEEK .llseek = &no_llseek, +#endif }; static void oal_device_release(struct device *dev) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 97a9a53..7317a7e 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -3127,7 +3127,7 @@ static int osd_quota_transfer(struct inode *inode, const struct lu_attr *attr, iattr.ia_gid = make_kgid(&init_user_ns, attr->la_gid); lock_dquot_transfer(inode); - rc = dquot_transfer(inode, &iattr); + rc = osd_dquot_transfer(&init_user_ns, inode, &iattr); unlock_dquot_transfer(inode); if (rc) { CERROR("%s: quota transfer failed. Is quota enforcement enabled on the ldiskfs filesystem? rc = %d\n", diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index f7b164e..72559bb 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -1749,4 +1749,10 @@ static inline bool bdev_integrity_enabled(struct block_device *bdev, int rw) return false; } +#ifdef HAVE_DQUOT_TRANSFER_WITH_USER_NS +#define osd_dquot_transfer(ns, i, a) dquot_transfer((ns), (i), (a)) +#else +#define osd_dquot_transfer(ns, i, a) dquot_transfer((i), (a)) +#endif + #endif /* _OSD_INTERNAL_H */ -- 1.8.3.1