From 2de1dbd440e2b26ea1bdf663b92a3e8c62a95ee7 Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Sun, 2 Apr 2023 04:09:29 -0500 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. 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/+/49266 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Yang Sheng Reviewed-by: xinliang Reviewed-by: Oleg Drokin --- 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 87f461b..f3bdf14 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -3391,6 +3391,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 @@ -3722,6 +3771,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 @@ -3967,6 +4018,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 b2a5115..8d00ed1 100644 --- a/lustre/ofd/ofd_access_log.c +++ b/lustre/ofd/ofd_access_log.c @@ -432,7 +432,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 79934ef..efe64f0 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -3201,7 +3201,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 6e8e962..1b0bfb6 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -1743,4 +1743,10 @@ static inline bool bdev_integrity_enabled(struct block_device *bdev, int rw) bool osd_tx_was_declared(const struct lu_env *env, struct osd_thandle *oth, struct dt_object *dt, enum dt_txn_op op, loff_t p); +#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