Whamcloud - gitweb
LU-17243 build: compatibility updates for kernel 6.6 11/59111/3
authorShaun Tancheff <shaun.tancheff@hpe.com>
Tue, 6 May 2025 05:28:55 +0000 (22:28 -0700)
committerOleg Drokin <green@whamcloud.com>
Thu, 15 May 2025 07:31:55 +0000 (07:31 +0000)
linux kernel v5.19-rc1-4-gc4f135d64382
  workqueue: Wrap flush_workqueue() using a macro
linux kernel v6.5-rc1-7-g20bdedafd2f6
  workqueue: Warn attempt to flush system-wide workqueues.
If __flush_workqueue(system_wq) is not available fall back to
flush_scheduled_work()

linux kernel v6.5-rc1-92-g13bc24457850
  fs: rename i_ctime field to __i_ctime
Use accessors for ctime. Provide replacements for older
kernels.

linux kernel v6.5-rc1-95-g0d72b92883c6
  fs: pass the request_mask to generic_fillattr
Provide request_mask argument where needed.

Linux commit v6.5-rc2-20-g2ddd3cac1fa9
  nsproxy: Convert nsproxy.count to refcount_t
Provide a wrapper for inc/dec of nsproxy.count

linux kernel v6.5-rc4-110-gcf95e337cb63
  mm: delete mmap_write_trylock() and vma_try_start_write()
Use down_write_trylock directly mmap_write_trylock

In preparation for kernel 6.7 the remaining inode time
accessors will be preferred:

linux kernel v6.6-rc5-86-g12cd44023651
  fs: rename inode i_atime and i_mtime fields
Use accessors for atime and mtime. Provide replacements for
older kernels.

Lustre-change: https://review.whamcloud.com/52908
Lustre-commit: a0e6d6f7327598d13661bb14098a9f21f2035285

Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: Ide6c2e3e8db532449850b145c2d61b972d21f649
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59111
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
15 files changed:
libcfs/include/libcfs/linux/linux-mem.h
lustre/autoconf/lustre-core.m4
lustre/include/lustre_compat.h
lustre/llite/file.c
lustre/llite/llite_lib.c
lustre/llite/namei.c
lustre/llite/pcc.c
lustre/llite/vvp_object.c
lustre/lmv/lmv_intent.c
lustre/lmv/lmv_obd.c
lustre/obdclass/llog.c
lustre/obdclass/obdo.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_internal.h
lustre/osd-ldiskfs/osd_io.c

index 3847cae..55011f2 100644 (file)
@@ -128,6 +128,14 @@ static inline void mmap_read_unlock(struct mm_struct *mm)
 {
        up_read(&mm->mmap_sem);
 }
+#else
+ #ifndef HAVE_MMAP_WRITE_TRYLOCK
+/* Replacement for mmap_write_trylock() */
+static inline bool mmap_write_trylock(struct mm_struct *mm)
+{
+       return down_write_trylock(&mm->mmap_lock) != 0;
+}
+ #endif /* HAVE_MMAP_WRITE_TRYLOCK */
 #endif
 
 #ifdef HAVE_VMALLOC_2ARGS
index 17e058c..8f2c281 100644 (file)
@@ -3637,27 +3637,6 @@ AC_DEFUN([LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG], [
 ]) # LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG
 
 #
-# LC_HAVE_FLUSH___WORKQUEUE
-#
-# linux kernel v6.5-rc1-7-g20bdedafd2f6
-#   workqueue: Warn attempt to flush system-wide workqueues.
-#
-AC_DEFUN([LC_SRC_HAVE_FLUSH___WORKQUEUE], [
-       LB2_LINUX_TEST_SRC([flush_scheduled_work_warning], [
-               #include <linux/workqueue.h>
-       ],[
-               __flush_workqueue(system_wq);
-       ],[-Werror])
-])
-AC_DEFUN([LC_HAVE_FLUSH___WORKQUEUE], [
-       AC_MSG_CHECKING([if 'flush_scheduled_work()' throws warning])
-       LB2_LINUX_TEST_RESULT([flush_scheduled_work_warning], [
-               AC_DEFINE(HAVE_FLUSH___WORKQUEUE, 1,
-                       ['__flush_workqueue(system_wq)' is available])
-       ])
-]) # LC_HAVE_FLUSH___WORKQUEUE
-
-#
 # LC_HAVE_DENTRY_D_CHILDREN
 #
 # Linux commit v6.7-rc1-3-gda549bdd15c2
@@ -3971,6 +3950,152 @@ AC_DEFUN([LC_IOP_GET_INODE_ACL], [
 ]) # LC_IOP_GET_INODE_ACL
 
 #
+# LC_HAVE_FLUSH___WORKQUEUE
+#
+# linux kernel v6.5-rc1-7-g20bdedafd2f6
+#   workqueue: Warn attempt to flush system-wide workqueues.
+#
+AC_DEFUN([LC_SRC_HAVE_FLUSH___WORKQUEUE], [
+       LB2_LINUX_TEST_SRC([flush_scheduled_work_warning], [
+               #include <linux/workqueue.h>
+       ],[
+               __flush_workqueue(system_wq);
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_FLUSH___WORKQUEUE], [
+       AC_MSG_CHECKING([if 'flush_scheduled_work()' throws warning])
+       LB2_LINUX_TEST_RESULT([flush_scheduled_work_warning], [
+               AC_DEFINE(HAVE_FLUSH___WORKQUEUE, 1,
+                       ['__flush_workqueue(system_wq)' is available])
+       ])
+]) # LC_HAVE_FLUSH___WORKQUEUE
+
+#
+# LC_HAVE_INODE_GET_CTIME
+#
+# linux kernel v6.5-rc1-92-g13bc24457850
+#   fs: rename i_ctime field to __i_ctime
+#
+AC_DEFUN([LC_SRC_HAVE_INODE_GET_CTIME], [
+       LB2_LINUX_TEST_SRC([inode_get_ctime_exists], [
+               #include <linux/fs.h>
+       ],[
+               struct inode *inode = NULL;
+               struct timespec64 ts __attribute__ ((unused));
+
+               ts = inode_get_ctime(inode);
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_INODE_GET_CTIME], [
+       AC_MSG_CHECKING([if 'inode_get_ctime()' exists])
+       LB2_LINUX_TEST_RESULT([inode_get_ctime_exists], [
+               AC_DEFINE(HAVE_INODE_GET_CTIME, 1,
+                       ['inode_get_ctime()' exists])
+       ])
+]) # LC_HAVE_INODE_GET_CTIME
+
+#
+# LC_HAVE_MMAP_WRITE_TRYLOCK
+#
+# linux kernel v6.5-rc4-110-gcf95e337cb63
+#   mm: delete mmap_write_trylock() and vma_try_start_write()
+#
+AC_DEFUN([LC_SRC_HAVE_MMAP_WRITE_TRYLOCK], [
+       LB2_LINUX_TEST_SRC([mmap_write_trylock_removed], [
+               #include <linux/mmap_lock.h>
+       ],[
+               struct mm_struct *mm = NULL;
+
+               (void)mmap_write_trylock(mm);
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_MMAP_WRITE_TRYLOCK], [
+       AC_MSG_CHECKING([if 'mmap_write_trylock()' is available])
+       LB2_LINUX_TEST_RESULT([mmap_write_trylock_removed], [
+               AC_DEFINE(HAVE_MMAP_WRITE_TRYLOCK, 1,
+                       ['mmap_write_trylock()' is available])
+       ])
+]) # LC_HAVE_MMAP_WRITE_TRYLOCK
+
+#
+# LC_HAVE_GENERIC_FILEATTR_HAS_MASK_ARG
+#
+# linux kernel v6.5-rc1-95-g0d72b92883c6
+#   fs: pass the request_mask to generic_fillattr
+#
+AC_DEFUN([LC_SRC_HAVE_GENERIC_FILEATTR_HAS_MASK_ARG], [
+       LB2_LINUX_TEST_SRC([generic_fillattr_has_request_mask_arg], [
+               #include <linux/fs.h>
+       ],[
+               struct inode *inode = NULL;
+               struct mnt_idmap *map = NULL;
+               struct kstat *kstat = NULL;
+
+               generic_fillattr(map, 0, inode, kstat);
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_GENERIC_FILEATTR_HAS_MASK_ARG], [
+       AC_MSG_CHECKING([if 'generic_fillattr()' has request_mask argument])
+       LB2_LINUX_TEST_RESULT([generic_fillattr_has_request_mask_arg], [
+               AC_DEFINE(HAVE_GENERIC_FILEATTR_HAS_MASK_ARG, 1,
+                       ['generic_fillattr()' has request_mask argument])
+               AC_DEFINE([RQMASK_ARG], [0,], [default request_mask argument])
+       ], [
+               AC_DEFINE([RQMASK_ARG], [], [no request_mask argument needed])
+       ])
+]) # LC_HAVE_GENERIC_FILEATTR_HAS_MASK_ARG
+
+#
+# LC_HAVE_NSPROXY_COUNT_AS_REFCOUNT
+#
+# Linux commit v6.5-rc2-20-g2ddd3cac1fa9
+#   nsproxy: Convert nsproxy.count to refcount_t
+#
+AC_DEFUN([LC_SRC_HAVE_NSPROXY_COUNT_AS_REFCOUNT], [
+       LB2_LINUX_TEST_SRC([struct_nsproxy_count_refcount_t], [
+               #include <linux/nsproxy.h>
+       ],[
+               struct nsproxy *nsproxy = NULL;
+
+               refcount_dec(&nsproxy->count);
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_NSPROXY_COUNT_AS_REFCOUNT], [
+       AC_MSG_CHECKING([if 'struct nsproxy.count' is refcount_t])
+       LB2_LINUX_TEST_RESULT([struct_nsproxy_count_refcount_t], [
+               AC_DEFINE(HAVE_NSPROXY_COUNT_AS_REFCOUNT, 1,
+                       ['struct nsproxy.count' is refcount_t])
+       ])
+]) # LC_HAVE_NSPROXY_COUNT_AS_REFCOUNT
+
+#
+# LC_HAVE_INODE_GET_MTIME_SEC
+#
+# Linux commit v6.6-rc5-1-g077c212f0344
+#   fs: new accessor methods for atime and mtime
+#
+# Linux commit v6.6-rc5-86-g12cd44023651
+#   fs: rename inode i_atime and i_mtime fields
+#
+AC_DEFUN([LC_SRC_HAVE_INODE_GET_MTIME_SEC], [
+       LB2_LINUX_TEST_SRC([inode_get_mtime_exists], [
+               #include <linux/fs.h>
+       ],[
+               struct inode *inode = NULL;
+               time64_t sec __attribute__ ((unused));
+
+               sec = inode_get_mtime_sec(inode);
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_INODE_GET_MTIME_SEC], [
+       AC_MSG_CHECKING([if 'inode_get_mtime()' exists])
+       LB2_LINUX_TEST_RESULT([inode_get_mtime_exists], [
+               AC_DEFINE(HAVE_INODE_GET_MTIME_SEC, 1,
+                       ['inode_get_mtime()' exists])
+       ])
+]) # LC_HAVE_INODE_GET_MTIME_SEC
+
+#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -4206,9 +4331,6 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [
        LC_SRC_HAVE_FILEMAP_GET_FOLIOS_CONTIG
        LC_SRC_IOP_GET_INODE_ACL
 
-       # 6.6
-       LC_SRC_HAVE_FLUSH___WORKQUEUE
-
        # 6.8
        LC_SRC_HAVE_DENTRY_D_CHILDREN
 
@@ -4229,6 +4351,16 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [
        LC_SRC_HAVE_GET_RANDOM_U32_BELOW
        LC_SRC_HAVE_ACL_WITH_DENTRY
 
+       # 6.6
+       LC_SRC_HAVE_FLUSH___WORKQUEUE
+       LC_SRC_HAVE_INODE_GET_CTIME
+       LC_SRC_HAVE_MMAP_WRITE_TRYLOCK
+       LC_SRC_HAVE_GENERIC_FILEATTR_HAS_MASK_ARG
+       LC_SRC_HAVE_NSPROXY_COUNT_AS_REFCOUNT
+
+       # 6.7
+       LC_SRC_HAVE_INODE_GET_MTIME_SEC
+
        # kernel patch to extend integrity interface
        LC_SRC_BIO_INTEGRITY_PREP_FN
 ])
@@ -4478,9 +4610,6 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [
        LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG
        LC_IOP_GET_INODE_ACL
 
-       # 6.6
-       LC_HAVE_FLUSH___WORKQUEUE
-
        # 6.8
        LC_HAVE_DENTRY_D_CHILDREN
 
@@ -4501,6 +4630,16 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [
        LC_HAVE_GET_RANDOM_U32_BELOW
        LC_HAVE_ACL_WITH_DENTRY
 
+       # 6.6
+       LC_HAVE_FLUSH___WORKQUEUE
+       LC_HAVE_INODE_GET_CTIME
+       LC_HAVE_MMAP_WRITE_TRYLOCK
+       LC_HAVE_GENERIC_FILEATTR_HAS_MASK_ARG
+       LC_HAVE_NSPROXY_COUNT_AS_REFCOUNT
+
+       # 6.7
+       LC_HAVE_INODE_GET_MTIME_SEC
+
        # kernel patch to extend integrity interface
        LC_BIO_INTEGRITY_PREP_FN
 ])
index d531acd..1d9c7ca 100644 (file)
@@ -39,7 +39,6 @@
 #include <linux/posix_acl_xattr.h>
 #include <linux/bio.h>
 #include <linux/xattr.h>
-#include <linux/workqueue.h>
 #include <linux/blkdev.h>
 #include <linux/slab.h>
 #include <linux/security.h>
@@ -674,4 +673,55 @@ static inline void folio_batch_reinit(struct folio_batch *fbatch)
 #define __flush_workqueue(wq)  flush_scheduled_work()
 #endif
 
+#ifdef HAVE_NSPROXY_COUNT_AS_REFCOUNT
+#define nsproxy_dec(ns)                refcount_dec(&(ns)->count)
+#else
+#define nsproxy_dec(ns)                atomic_dec(&(ns)->count)
+#endif
+
+#ifndef HAVE_INODE_GET_CTIME
+#define inode_get_ctime(i)             ((i)->i_ctime)
+#define inode_set_ctime_to_ts(i, ts)   ((i)->i_ctime = ts)
+#define inode_set_ctime_current(i) \
+       inode_set_ctime_to_ts((i), current_time((i)))
+
+static inline struct timespec64 inode_set_ctime(struct inode *inode,
+                                               time64_t sec, long nsec)
+{
+       struct timespec64 ts = { .tv_sec  = sec,
+                                .tv_nsec = nsec };
+
+       return inode_set_ctime_to_ts(inode, ts);
+}
+#endif /* !HAVE_INODE_GET_CTIME */
+
+#ifndef HAVE_INODE_GET_MTIME_SEC
+
+#define inode_get_ctime_sec(i)         (inode_get_ctime((i)).tv_sec)
+
+#define inode_get_atime(i)             ((i)->i_atime)
+#define inode_get_atime_sec(i)         ((i)->i_atime.tv_sec)
+#define inode_set_atime_to_ts(i, ts)   ((i)->i_atime = ts)
+
+static inline struct timespec64 inode_set_atime(struct inode *inode,
+                                               time64_t sec, long nsec)
+{
+       struct timespec64 ts = { .tv_sec  = sec,
+                                .tv_nsec = nsec };
+       return inode_set_atime_to_ts(inode, ts);
+}
+
+#define inode_get_mtime(i)             ((i)->i_mtime)
+#define inode_get_mtime_sec(i)         ((i)->i_mtime.tv_sec)
+#define inode_set_mtime_to_ts(i, ts)   ((i)->i_mtime = ts)
+
+static inline struct timespec64 inode_set_mtime(struct inode *inode,
+                                               time64_t sec, long nsec)
+{
+       struct timespec64 ts = { .tv_sec  = sec,
+                                .tv_nsec = nsec };
+       return inode_set_mtime_to_ts(inode, ts);
+}
+#endif  /* !HAVE_INODE_GET_MTIME_SEC */
+
 #endif /* _LUSTRE_COMPAT_H */
index 382ccef..ca4c214 100644 (file)
@@ -105,9 +105,9 @@ static void ll_prepare_close(struct inode *inode, struct md_op_data *op_data,
                           0, 0, LUSTRE_OPC_ANY, NULL);
 
        op_data->op_attr.ia_mode = inode->i_mode;
-       op_data->op_attr.ia_atime = inode->i_atime;
-       op_data->op_attr.ia_mtime = inode->i_mtime;
-       op_data->op_attr.ia_ctime = inode->i_ctime;
+       op_data->op_attr.ia_atime = inode_get_atime(inode);
+       op_data->op_attr.ia_mtime = inode_get_mtime(inode);
+       op_data->op_attr.ia_ctime = inode_get_ctime(inode);
        /* In case of encrypted file without the key, visible size was rounded
         * up to next LUSTRE_ENCRYPTION_UNIT_SIZE, and clear text size was
         * stored into lli_lazysize in ll_merge_attr(), so set proper file size
@@ -1462,15 +1462,15 @@ int ll_merge_attr(const struct lu_env *env, struct inode *inode)
         * read, this will hurt performance.
         */
        if (test_and_clear_bit(LLIF_UPDATE_ATIME, &lli->lli_flags) ||
-           inode->i_atime.tv_sec < lli->lli_atime)
-               inode->i_atime.tv_sec = lli->lli_atime;
+           inode_get_atime_sec(inode) < lli->lli_atime)
+               inode_set_atime(inode, lli->lli_atime, 0);
 
-       inode->i_mtime.tv_sec = lli->lli_mtime;
-       inode->i_ctime.tv_sec = lli->lli_ctime;
+       inode_set_mtime(inode, lli->lli_mtime, 0);
+       inode_set_ctime(inode, lli->lli_ctime, 0);
 
-       mtime = inode->i_mtime.tv_sec;
-       atime = inode->i_atime.tv_sec;
-       ctime = inode->i_ctime.tv_sec;
+       mtime = inode_get_mtime_sec(inode);
+       atime = inode_get_atime_sec(inode);
+       ctime = inode_get_ctime_sec(inode);
 
        cl_object_attr_lock(obj);
        if (OBD_FAIL_CHECK(OBD_FAIL_MDC_MERGE))
@@ -1507,9 +1507,9 @@ int ll_merge_attr(const struct lu_env *env, struct inode *inode)
        i_size_write(inode, attr->cat_size);
        inode->i_blocks = attr->cat_blocks;
 
-       inode->i_mtime.tv_sec = mtime;
-       inode->i_atime.tv_sec = atime;
-       inode->i_ctime.tv_sec = ctime;
+       inode_set_mtime(inode, mtime, 0);
+       inode_set_atime(inode, atime, 0);
+       inode_set_ctime(inode, ctime, 0);
 
 out_size_unlock:
        ll_inode_size_unlock(inode);
@@ -5356,11 +5356,11 @@ int ll_getattr_dentry(struct dentry *de, struct kstat *stat, u32 request_mask,
                if (lli->lli_attr_valid & OBD_MD_FLSIZE &&
                    lli->lli_attr_valid & OBD_MD_FLBLOCKS &&
                    lli->lli_attr_valid & OBD_MD_FLMTIME) {
-                       inode->i_mtime.tv_sec = lli->lli_mtime;
+                       inode_set_mtime(inode, lli->lli_mtime, 0);
                        if (lli->lli_attr_valid & OBD_MD_FLATIME)
-                               inode->i_atime.tv_sec = lli->lli_atime;
+                               inode_set_atime(inode, lli->lli_atime, 0);
                        if (lli->lli_attr_valid & OBD_MD_FLCTIME)
-                               inode->i_ctime.tv_sec = lli->lli_ctime;
+                               inode_set_ctime(inode, lli->lli_ctime, 0);
                        GOTO(fill_attr, rc);
                }
 
@@ -5386,11 +5386,11 @@ int ll_getattr_dentry(struct dentry *de, struct kstat *stat, u32 request_mask,
                }
 
                if (lli->lli_attr_valid & OBD_MD_FLATIME)
-                       inode->i_atime.tv_sec = lli->lli_atime;
+                       inode_set_atime(inode, lli->lli_atime, 0);
                if (lli->lli_attr_valid & OBD_MD_FLMTIME)
-                       inode->i_mtime.tv_sec = lli->lli_mtime;
+                       inode_set_mtime(inode, lli->lli_mtime, 0);
                if (lli->lli_attr_valid & OBD_MD_FLCTIME)
-                       inode->i_ctime.tv_sec = lli->lli_ctime;
+                       inode_set_ctime(inode, lli->lli_ctime, 0);
        }
 
 fill_attr:
@@ -5414,9 +5414,9 @@ fill_attr:
 
        stat->uid = inode->i_uid;
        stat->gid = inode->i_gid;
-       stat->atime = inode->i_atime;
-       stat->mtime = inode->i_mtime;
-       stat->ctime = inode->i_ctime;
+       stat->atime = inode_get_atime(inode);
+       stat->mtime = inode_get_mtime(inode);
+       stat->ctime = inode_get_ctime(inode);
        /* stat->blksize is used to tell about preferred IO size */
        if (sbi->ll_stat_blksize)
                stat->blksize = sbi->ll_stat_blksize;
index 489c6df..07a6663 100644 (file)
@@ -1601,9 +1601,9 @@ static struct inode *ll_iget_anon_dir(struct super_block *sb,
                LASSERTF(S_ISDIR(inode->i_mode), "Not slave inode "DFID"\n",
                         PFID(fid));
 
-               inode->i_mtime.tv_sec = 0;
-               inode->i_atime.tv_sec = 0;
-               inode->i_ctime.tv_sec = 0;
+               inode_set_mtime(inode, 0, 0);
+               inode_set_atime(inode, 0, 0);
+               inode_set_ctime(inode, 0, 0);
                inode->i_rdev = 0;
 
 #ifdef HAVE_BACKING_DEV_INFO
@@ -2672,25 +2672,25 @@ int ll_update_inode(struct inode *inode, struct lustre_md *md)
        inode->i_generation = cl_fid_build_gen(&body->mbo_fid1);
 
        if (body->mbo_valid & OBD_MD_FLATIME) {
-               if (body->mbo_atime > inode->i_atime.tv_sec)
-                       inode->i_atime.tv_sec = body->mbo_atime;
+               if (body->mbo_atime > inode_get_atime_sec(inode))
+                       inode_set_atime(inode, body->mbo_atime, 0);
                lli->lli_atime = body->mbo_atime;
        }
 
        if (body->mbo_valid & OBD_MD_FLMTIME) {
-               if (body->mbo_mtime > inode->i_mtime.tv_sec) {
+               if (body->mbo_mtime > inode_get_mtime_sec(inode)) {
                        CDEBUG(D_INODE,
                               "setting ino %lu mtime from %lld to %llu\n",
-                              inode->i_ino, (s64)inode->i_mtime.tv_sec,
+                              inode->i_ino, (s64) inode_get_mtime_sec(inode),
                               body->mbo_mtime);
-                       inode->i_mtime.tv_sec = body->mbo_mtime;
+                       inode_set_mtime(inode, body->mbo_mtime, 0);
                }
                lli->lli_mtime = body->mbo_mtime;
        }
 
        if (body->mbo_valid & OBD_MD_FLCTIME) {
-               if (body->mbo_ctime > inode->i_ctime.tv_sec)
-                       inode->i_ctime.tv_sec = body->mbo_ctime;
+               if (body->mbo_ctime > inode_get_ctime_sec(inode))
+                       inode_set_ctime(inode, body->mbo_ctime, 0);
                lli->lli_ctime = body->mbo_ctime;
        }
 
@@ -2837,9 +2837,9 @@ int ll_read_inode2(struct inode *inode, void *opaque)
          * it ourselves.  They will be overwritten by either MDS or OST
         * attributes - we just need to make sure they aren't newer.
         */
-       inode->i_mtime.tv_sec = 0;
-       inode->i_atime.tv_sec = 0;
-       inode->i_ctime.tv_sec = 0;
+       inode_set_mtime(inode, 0, 0);
+       inode_set_atime(inode, 0, 0);
+       inode_set_ctime(inode, 0, 0);
        inode->i_rdev = 0;
        rc = ll_update_inode(inode, md);
        if (rc != 0)
index a3de735..3c52873 100644 (file)
@@ -1461,17 +1461,17 @@ void ll_update_times(struct ptlrpc_request *request, struct inode *inode)
 
        LASSERT(body);
        if (body->mbo_valid & OBD_MD_FLMTIME &&
-           body->mbo_mtime > inode->i_mtime.tv_sec) {
+           body->mbo_mtime > inode_get_mtime_sec(inode)) {
                CDEBUG(D_INODE,
                       "setting fid " DFID " mtime from %lld to %llu\n",
                       PFID(ll_inode2fid(inode)),
-                      (s64)inode->i_mtime.tv_sec, body->mbo_mtime);
-               inode->i_mtime.tv_sec = body->mbo_mtime;
+                      (s64)inode_get_mtime_sec(inode), body->mbo_mtime);
+               inode_set_mtime(inode, body->mbo_mtime, 0);
        }
 
        if (body->mbo_valid & OBD_MD_FLCTIME &&
-           body->mbo_ctime > inode->i_ctime.tv_sec)
-               inode->i_ctime.tv_sec = body->mbo_ctime;
+           body->mbo_ctime > inode_get_ctime_sec(inode))
+               inode_set_ctime(inode, body->mbo_ctime, 0);
 }
 
 /* once default LMV (space balanced) is set on ROOT, it should take effect if
index 3363428..ee3555b 100644 (file)
@@ -1819,15 +1819,15 @@ int pcc_inode_getattr(struct inode *inode, u32 request_mask,
 
        ll_inode_size_lock(inode);
        if (test_and_clear_bit(LLIF_UPDATE_ATIME, &lli->lli_flags) ||
-           inode->i_atime.tv_sec < lli->lli_atime)
-               inode->i_atime.tv_sec = lli->lli_atime;
+           inode_get_atime_sec(inode) < lli->lli_atime)
+               inode_set_atime(inode, lli->lli_atime, 0);
 
-       inode->i_mtime.tv_sec = lli->lli_mtime;
-       inode->i_ctime.tv_sec = lli->lli_ctime;
+       inode_set_mtime(inode, lli->lli_mtime, 0);
+       inode_set_ctime(inode, lli->lli_ctime, 0);
 
-       atime = inode->i_atime.tv_sec;
-       mtime = inode->i_mtime.tv_sec;
-       ctime = inode->i_ctime.tv_sec;
+       atime = inode_get_atime_sec(inode);
+       mtime = inode_get_mtime_sec(inode);
+       ctime = inode_get_ctime_sec(inode);
 
        if (atime < stat.atime.tv_sec)
                atime = stat.atime.tv_sec;
@@ -1841,9 +1841,9 @@ int pcc_inode_getattr(struct inode *inode, u32 request_mask,
        i_size_write(inode, stat.size);
        inode->i_blocks = stat.blocks;
 
-       inode->i_atime.tv_sec = atime;
-       inode->i_mtime.tv_sec = mtime;
-       inode->i_ctime.tv_sec = ctime;
+       inode_set_atime(inode, atime, 0);
+       inode_set_mtime(inode, mtime, 0);
+       inode_set_ctime(inode, ctime, 0);
 
        ll_inode_size_unlock(inode);
 out:
index b19b30f..00c7d21 100644 (file)
@@ -91,9 +91,9 @@ static int vvp_attr_get(const struct lu_env *env, struct cl_object *obj,
         */
 
        attr->cat_size = i_size_read(inode);
-       attr->cat_mtime = inode->i_mtime.tv_sec;
-       attr->cat_atime = inode->i_atime.tv_sec;
-       attr->cat_ctime = inode->i_ctime.tv_sec;
+       attr->cat_mtime = inode_get_mtime_sec(inode);
+       attr->cat_atime = inode_get_atime_sec(inode);
+       attr->cat_ctime = inode_get_ctime_sec(inode);
        attr->cat_blocks = inode->i_blocks;
        attr->cat_uid = from_kuid(&init_user_ns, inode->i_uid);
        attr->cat_gid = from_kgid(&init_user_ns, inode->i_gid);
@@ -112,11 +112,11 @@ static int vvp_attr_update(const struct lu_env *env, struct cl_object *obj,
        if (valid & CAT_GID)
                inode->i_gid = make_kgid(&init_user_ns, attr->cat_gid);
        if (valid & CAT_ATIME)
-               inode->i_atime.tv_sec = attr->cat_atime;
+               inode_set_atime(inode, attr->cat_atime, 0);
        if (valid & CAT_MTIME)
-               inode->i_mtime.tv_sec = attr->cat_mtime;
+               inode_set_mtime(inode, attr->cat_mtime, 0);
        if (valid & CAT_CTIME)
-               inode->i_ctime.tv_sec = attr->cat_ctime;
+               inode_set_ctime(inode, attr->cat_ctime, 0);
        if (0 && valid & CAT_SIZE)
                i_size_write(inode, attr->cat_size);
        if (valid & CAT_PROJID)
@@ -178,9 +178,9 @@ static int vvp_object_glimpse(const struct lu_env *env,
        struct inode *inode = vvp_object_inode(obj);
 
        ENTRY;
-       lvb->lvb_mtime = inode->i_mtime.tv_sec;
-       lvb->lvb_atime = inode->i_atime.tv_sec;
-       lvb->lvb_ctime = inode->i_ctime.tv_sec;
+       lvb->lvb_mtime = inode_get_mtime_sec(inode);
+       lvb->lvb_atime = inode_get_atime_sec(inode);
+       lvb->lvb_ctime = inode_get_ctime_sec(inode);
 
        /*
         * LU-417: Add dirty pages block count lest i_blocks reports 0, some
index 97f1d9f..d90ee5a 100644 (file)
@@ -255,9 +255,9 @@ int lmv_revalidate_slaves(struct obd_export *exp,
                        spin_lock(&inode->i_lock);
                        set_nlink(inode, body->mbo_nlink);
                        spin_unlock(&inode->i_lock);
-                       inode->i_atime.tv_sec = body->mbo_atime;
-                       inode->i_ctime.tv_sec = body->mbo_ctime;
-                       inode->i_mtime.tv_sec = body->mbo_mtime;
+                       inode_set_atime(inode, body->mbo_atime, 0);
+                       inode_set_ctime(inode, body->mbo_ctime, 0);
+                       inode_set_mtime(inode, body->mbo_mtime, 0);
                }
 
                md_set_lock_data(tgt->ltd_exp, lockh, inode, NULL);
index 187bae8..491bfd4 100644 (file)
@@ -3824,8 +3824,9 @@ static int lmv_merge_attr(struct obd_export *exp,
                       "" DFID " size %llu, blocks %llu nlink %u, atime %lld ctime %lld, mtime %lld.\n",
                       PFID(&lsm->lsm_md_oinfo[i].lmo_fid),
                       i_size_read(inode), (unsigned long long)inode->i_blocks,
-                      inode->i_nlink, (s64)inode->i_atime.tv_sec,
-                      (s64)inode->i_ctime.tv_sec, (s64)inode->i_mtime.tv_sec);
+                      inode->i_nlink, (s64)inode_get_atime_sec(inode),
+                      (s64)inode_get_ctime_sec(inode),
+                      (s64)inode_get_mtime_sec(inode));
 
                /* for slave stripe, it needs to subtract nlink for . and .. */
                if (i != 0)
@@ -3836,14 +3837,14 @@ static int lmv_merge_attr(struct obd_export *exp,
                attr->cat_size += i_size_read(inode);
                attr->cat_blocks += inode->i_blocks;
 
-               if (attr->cat_atime < inode->i_atime.tv_sec)
-                       attr->cat_atime = inode->i_atime.tv_sec;
+               if (attr->cat_atime < inode_get_atime_sec(inode))
+                       attr->cat_atime = inode_get_atime_sec(inode);
 
-               if (attr->cat_ctime < inode->i_ctime.tv_sec)
-                       attr->cat_ctime = inode->i_ctime.tv_sec;
+               if (attr->cat_ctime < inode_get_ctime_sec(inode))
+                       attr->cat_ctime = inode_get_ctime_sec(inode);
 
-               if (attr->cat_mtime < inode->i_mtime.tv_sec)
-                       attr->cat_mtime = inode->i_mtime.tv_sec;
+               if (attr->cat_mtime < inode_get_mtime_sec(inode))
+                       attr->cat_mtime = inode_get_mtime_sec(inode);
        }
        return 0;
 }
index b23645d..ec0f624 100644 (file)
@@ -833,7 +833,7 @@ static int llog_process_thread_daemonize(void *arg)
                 * free_nsproxy() which is not exported by the kernel
                 * (defined in kernel/nsproxy.c) */
                if (curr_ns)
-                       atomic_dec(&curr_ns->count);
+                       nsproxy_dec(curr_ns);
        }
        task_unlock(lpi->lpi_reftask);
 
index b1d7337..35f707f 100644 (file)
@@ -69,19 +69,19 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, u64 valid)
 
        if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
                CDEBUG(D_INODE, "valid %#llx, new time %lld/%lld\n",
-                      valid, (s64) src->i_mtime.tv_sec,
-                      (s64) src->i_ctime.tv_sec);
+                      valid, (s64) inode_get_mtime_sec(src),
+                      (s64) inode_get_ctime_sec(src));
 
        if (valid & OBD_MD_FLATIME) {
-               dst->o_atime = src->i_atime.tv_sec;
+               dst->o_atime = inode_get_atime_sec(src);
                newvalid |= OBD_MD_FLATIME;
        }
        if (valid & OBD_MD_FLMTIME) {
-               dst->o_mtime = src->i_mtime.tv_sec;
+               dst->o_mtime = inode_get_mtime_sec(src);
                newvalid |= OBD_MD_FLMTIME;
        }
        if (valid & OBD_MD_FLCTIME) {
-               dst->o_ctime = src->i_ctime.tv_sec;
+               dst->o_ctime = inode_get_ctime_sec(src);
                newvalid |= OBD_MD_FLCTIME;
        }
        if (valid & OBD_MD_FLSIZE) {
index c471c68..181cd50 100644 (file)
@@ -2717,9 +2717,9 @@ static void osd_inode_getattr(const struct lu_env *env,
                           LA_PROJID | LA_FLAGS | LA_NLINK | LA_RDEV |
                           LA_BLKSIZE | LA_TYPE | LA_BTIME;
 
-       attr->la_atime = inode->i_atime.tv_sec;
-       attr->la_mtime = inode->i_mtime.tv_sec;
-       attr->la_ctime = inode->i_ctime.tv_sec;
+       attr->la_atime = inode_get_atime_sec(inode);
+       attr->la_mtime = inode_get_mtime_sec(inode);
+       attr->la_ctime = inode_get_ctime_sec(inode);
        attr->la_btime = LDISKFS_I(inode)->i_crtime.tv_sec;
        attr->la_mode    = inode->i_mode;
        attr->la_size    = i_size_read(inode);
@@ -2985,11 +2985,14 @@ static int osd_inode_setattr(const struct lu_env *env,
                return 0;
 
        if (bits & LA_ATIME)
-               inode->i_atime = osd_inode_time(inode, attr->la_atime);
+               inode_set_atime_to_ts(inode,
+                                     osd_inode_time(inode, attr->la_atime));
        if (bits & LA_CTIME)
-               inode->i_ctime = osd_inode_time(inode, attr->la_ctime);
+               inode_set_ctime_to_ts(inode,
+                                     osd_inode_time(inode, attr->la_ctime));
        if (bits & LA_MTIME)
-               inode->i_mtime = osd_inode_time(inode, attr->la_mtime);
+               inode_set_mtime_to_ts(inode,
+                                     osd_inode_time(inode, attr->la_mtime));
        if (bits & LA_SIZE) {
                spin_lock(&inode->i_lock);
                LDISKFS_I(inode)->i_disksize = attr->la_size;
@@ -3548,11 +3551,14 @@ static void osd_attr_init(struct osd_thread_info *info, struct osd_object *obj,
 
        if (dof->dof_type != DFT_NODE)
                attr->la_valid &= ~LA_RDEV;
-       if ((valid & LA_ATIME) && (attr->la_atime == inode->i_atime.tv_sec))
+       if ((valid & LA_ATIME) &&
+           (attr->la_atime == inode_get_atime_sec(inode)))
                attr->la_valid &= ~LA_ATIME;
-       if ((valid & LA_CTIME) && (attr->la_ctime == inode->i_ctime.tv_sec))
+       if ((valid & LA_CTIME) &&
+           (attr->la_ctime == inode_get_ctime_sec(inode)))
                attr->la_valid &= ~LA_CTIME;
-       if ((valid & LA_MTIME) && (attr->la_mtime == inode->i_mtime.tv_sec))
+       if ((valid & LA_MTIME) &&
+           (attr->la_mtime == inode_get_mtime_sec(inode)))
                attr->la_valid &= ~LA_MTIME;
 
        result = osd_quota_transfer(inode, attr, handle);
index aeabe5d..b0b4253 100644 (file)
@@ -625,7 +625,7 @@ struct file *alloc_file_pseudo(struct inode *inode, struct vfsmount *mnt,
 }
 #endif /* !HAVE_ALLOC_FILE_PSEUDO */
 
-#ifdef HAVE_INODE_TIMESPEC64
+#if defined HAVE_INODE_TIMESPEC64 || defined HAVE_INODE_GET_MTIME_SEC
 # define osd_timespec                  timespec64
 #else
 # define osd_timespec                  timespec
index 9c33141..ad40d6f 100644 (file)
@@ -2397,12 +2397,13 @@ static int osd_fallocate_preallocate(const struct lu_env *env,
                map.m_lblk += rc;
                map.m_len = blen = blen - rc;
                epos = (loff_t)map.m_lblk << inode->i_blkbits;
-               inode->i_ctime = current_time(inode);
+               inode_set_ctime_current(inode);
                if (new_size) {
                        if (epos > end)
                                epos = end;
                        if (ldiskfs_update_inode_size(inode, epos) & 0x1)
-                               inode->i_mtime = inode->i_ctime;
+                               inode_set_mtime_to_ts(inode,
+                                                     inode_get_ctime(inode));
 #ifndef HAVE_LDISKFS_GET_BLOCKS_KEEP_SIZE
                } else {
                        if (epos > inode->i_size)