Whamcloud - gitweb
LU-17243 build: compatibility updates for kernel 6.6 08/52908/20
authorShaun Tancheff <shaun.tancheff@hpe.com>
Thu, 29 Feb 2024 20:33:54 +0000 (03:33 +0700)
committerOleg Drokin <green@whamcloud.com>
Sat, 23 Mar 2024 15:45:47 +0000 (15:45 +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.

Test-Parameters: trivial
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: Ide6c2e3e8db532449850b145c2d61b972d21f649
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52908
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
21 files changed:
config/lustre-build.m4
libcfs/autoconf/lustre-libcfs.m4
libcfs/include/libcfs/linux/linux-mem.h
libcfs/libcfs/linux/linux-prim.c
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_io.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
lustre/osd-ldiskfs/osd_scrub.c
lustre/target/tgt_mount.c

index da4dc84..9e56a96 100644 (file)
@@ -173,6 +173,7 @@ AS_IF([test "x$enable_modules" = xyes], [
                        LIBCFS_SRC_LOCKDEP_IS_HELD
                        LIBCFS_SRC_HAVE_WAIT_BIT_HEADER
                        LIBCFS_SRC_LINUX_BLK_INTEGRITY_HEADER
+                       LIBCFS_SRC_HAVE_MMAP_LOCK
 
                        LB2_LINUX_TEST_COMPILE_ALL([early],
                                [for available lustre kapi interfaces])
@@ -180,6 +181,7 @@ AS_IF([test "x$enable_modules" = xyes], [
                        LIBCFS_LOCKDEP_IS_HELD
                        LIBCFS_HAVE_WAIT_BIT_HEADER
                        LIBCFS_LINUX_BLK_INTEGRITY_HEADER
+                       LIBCFS_HAVE_MMAP_LOCK
 
                        # Run any parallel compile tests
                        LB_PROG_LINUX_SRC
index 1aa54b4..43c9850 100644 (file)
@@ -2506,7 +2506,6 @@ AC_DEFUN([LIBCFS_PROG_LINUX_SRC], [
        LIBCFS_SRC_IP6_SET_PREF
        LIBCFS_SRC_VMALLOC_2ARGS
        LIBCFS_SRC_HAVE_NR_UNSTABLE_NFS
-       LIBCFS_SRC_HAVE_MMAP_LOCK
        LIBCFS_SRC_KERNEL_SETSOCKOPT
        LIBCFS_SRC_KEY_NEED_UNLINK
        LIBCFS_SRC_SEC_RELEASE_SECCTX
@@ -2657,7 +2656,6 @@ AC_DEFUN([LIBCFS_PROG_LINUX_RESULTS], [
        LIBCFS_IP6_SET_PREF
        LIBCFS_VMALLOC_2ARGS
        LIBCFS_HAVE_NR_UNSTABLE_NFS
-       LIBCFS_HAVE_MMAP_LOCK
        LIBCFS_KERNEL_SETSOCKOPT
        LIBCFS_KEY_NEED_UNLINK
        LIBCFS_SEC_RELEASE_SECCTX
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 3ad1694..b5e2518 100644 (file)
@@ -231,7 +231,7 @@ int __init cfs_arch_init(void)
 void __exit cfs_arch_exit(void)
 {
        /* exit_libcfs_vfree_atomic */
-       flush_scheduled_work();
+       __flush_workqueue(system_wq);
 
        llcrypt_exit();
 }
index d944ced..5912e83 100644 (file)
@@ -4217,6 +4217,152 @@ AC_DEFUN([LC_HAVE_STRUCT_PAGEVEC], [
 ]) # LC_HAVE_STRUCT_PAGEVEC
 
 #
+# 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], [
+       LB2_MSG_LINUX_TEST_RESULT([if 'flush_scheduled_work()' throws warning],
+       [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], [
+       LB2_MSG_LINUX_TEST_RESULT([if 'inode_get_ctime()' exists],
+       [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], [
+       LB2_MSG_LINUX_TEST_RESULT([if 'mmap_write_trylock()' is available],
+       [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], [
+       LB2_MSG_LINUX_TEST_RESULT([if 'generic_fillattr()' has request_mask argument],
+       [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], [
+       LB2_MSG_LINUX_TEST_RESULT([if 'struct nsproxy.count' is refcount_t],
+       [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], [
+       LB2_MSG_LINUX_TEST_RESULT([if 'inode_get_mtime()' exists],
+       [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
@@ -4489,6 +4635,16 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [
        LC_SRC_HAVE_FOLIO_BATCH
        LC_SRC_HAVE_STRUCT_PAGEVEC
 
+       # 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
 ])
@@ -4782,6 +4938,16 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [
        LC_HAVE_FOLIO_BATCH
        LC_HAVE_STRUCT_PAGEVEC
 
+       # 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 ac9c70c..8e36f76 100644 (file)
@@ -45,6 +45,7 @@
 #include <linux/slab.h>
 #include <linux/security.h>
 #include <linux/pagevec.h>
+#include <linux/workqueue.h>
 #include <libcfs/linux/linux-fs.h>
 #ifdef HAVE_XARRAY_SUPPORT
 #include <linux/xarray.h>
@@ -782,4 +783,59 @@ static inline void folio_batch_reinit(struct folio_batch *fbatch)
 # define fbatch_at_pg(pvec, n, pg)     ((pvec)->pages[(n)])
 #endif /* HAVE_FOLIO_BATCH */
 
+#ifndef HAVE_FLUSH___WORKQUEUE
+#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 b1e6f0d..35b8b73 100644 (file)
@@ -111,9 +111,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
@@ -1495,15 +1495,15 @@ static int ll_merge_attr_nolock(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 (CFS_FAIL_CHECK(OBD_FAIL_MDC_MERGE))
@@ -1540,9 +1540,9 @@ static int ll_merge_attr_nolock(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);
 
        EXIT;
 out:
@@ -1605,25 +1605,30 @@ void ll_io_set_mirror(struct cl_io *io, const struct file *file)
 static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
                                struct timespec64 now)
 {
+       struct timespec64 ts;
+       struct timespec64 atime;
 
        if (!(mnt->mnt_flags & MNT_RELATIME))
                return 1;
        /*
         * Is mtime younger than atime? If yes, update atime:
         */
-       if (timespec64_compare(&inode->i_mtime, &inode->i_atime) >= 0)
+       atime = inode_get_atime(inode);
+       ts = inode_get_mtime(inode);
+       if (timespec64_compare(&ts, &atime) >= 0)
                return 1;
        /*
         * Is ctime younger than atime? If yes, update atime:
         */
-       if (timespec64_compare(&inode->i_ctime, &inode->i_atime) >= 0)
+       ts = inode_get_ctime(inode);
+       if (timespec64_compare(&ts, &atime) >= 0)
                return 1;
 
        /*
         * Is the previous atime value older than a day? If yes,
         * update atime:
         */
-       if ((long)(now.tv_sec - inode->i_atime.tv_sec) >= 24*60*60)
+       if ((long)(now.tv_sec - atime.tv_sec) >= 24*60*60)
                return 1;
        /*
         * Good, we can skip the atime update:
@@ -5710,11 +5715,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);
                }
 
@@ -5740,11 +5745,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:
@@ -5768,9 +5773,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 8af16cb..0ee27c0 100644 (file)
@@ -1682,9 +1682,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
@@ -2791,25 +2791,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;
        }
 
@@ -3145,9 +3145,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 5f5dc12..79e9e29 100644 (file)
@@ -1481,17 +1481,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 6b8ee73..d9ed477 100644 (file)
@@ -1853,15 +1853,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;
@@ -1875,9 +1875,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 5a2477a..a04ad8c 100644 (file)
@@ -788,7 +788,7 @@ static void vvp_io_setattr_end(const struct lu_env *env,
                        i_size_write(inode, size);
                        ll_inode_size_unlock(inode);
                }
-               inode->i_ctime = current_time(inode);
+               inode_set_ctime_current(inode);
                mutex_unlock(&lli->lli_setattr_mutex);
                trunc_sem_up_write(&lli->lli_trunc_sem);
        } else {
index 9ded948..0b9e23a 100644 (file)
@@ -86,9 +86,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);
@@ -107,11 +107,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)
@@ -190,9 +190,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 7329a26..41993b8 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 de7487e..74b5bc4 100644 (file)
@@ -4184,8 +4184,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)
@@ -4196,14 +4197,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 bd5cc92..82f042d 100644 (file)
@@ -850,7 +850,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 49b6591..0fef3bd 100644 (file)
@@ -2882,9 +2882,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);
@@ -3167,11 +3167,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;
@@ -3729,11 +3732,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 6823a76..f804243 100644 (file)
@@ -617,7 +617,7 @@ struct osd_iobuf {
 #define osd_i_blocks(inode, size) ((size) >> (inode)->i_blkbits)
 
 
-#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 c093c40..b3375b0 100644 (file)
@@ -2259,12 +2259,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));
 #ifdef LDISKFS_EOFBLOCKS_FL
                } else {
                        if (epos > inode->i_size)
index 9501da1..e68c738 100644 (file)
@@ -415,8 +415,8 @@ osd_scrub_check_update(struct osd_thread_info *info, struct osd_device *dev,
                fid2 = &info->oti_ost_attrs.loa_lma.lma_self_fid;
                if ((rc == 0 && lu_fid_eq(fid, fid2)) &&
                    ((inode->i_size == 0 && inode2->i_size > 0 &&
-                     inode->i_mtime.tv_sec == inode2->i_mtime.tv_sec) ||
-                    inode->i_mtime.tv_sec < inode2->i_mtime.tv_sec)) {
+                     inode_get_mtime_sec(inode) == inode_get_mtime_sec(inode2)) ||
+                    inode_get_mtime_sec(inode) < inode_get_mtime_sec(inode2))) {
                        iput(inode2);
                        GOTO(skip, rc);
                }
index 76d48ec..99bb489 100644 (file)
@@ -1969,7 +1969,7 @@ static int server_getattr(struct vfsmount *mnt, struct dentry *de,
        CDEBUG(D_SUPER, "%s: root_inode from %s ino=%lu, dev=%x\n",
               lsi->lsi_svname, root_inode == inode ? "lsi" : "vfsmnt",
               root_inode->i_ino, root_inode->i_rdev);
-       generic_fillattr(IDMAP_ARG root_inode, stat);
+       generic_fillattr(IDMAP_ARG RQMASK_ARG root_inode, stat);
        iput(root_inode);
 
        return 0;