Whamcloud - gitweb
LU-16350 osd-ldiskfs: no_llseek removed, dquot_transfer 66/49266/13
authorShaun Tancheff <shaun.tancheff@hpe.com>
Sun, 2 Apr 2023 09:09:29 +0000 (04:09 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 11 Apr 2023 20:06:46 +0000 (20:06 +0000)
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 <shaun.tancheff@hpe.com>
Change-Id: If3165aed0d7b827b90e26d9f0174137d087ce57a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49266
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: xinliang <xinliang.liu@linaro.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/ofd/ofd_access_log.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_internal.h

index 87f461b..f3bdf14 100644 (file)
@@ -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 <linux/fs.h>
+       ],[
+               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 <linux/quotaops.h>
+       ],[
+               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
index b2a5115..8d00ed1 100644 (file)
@@ -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)
index 79934ef..efe64f0 100644 (file)
@@ -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",
index 6e8e962..1b0bfb6 100644 (file)
@@ -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 */