From 767e4924190a6db61a98a633894c25c74af39fd5 Mon Sep 17 00:00:00 2001 From: Cheyenne Wills Date: Thu, 5 Oct 2023 14:44:49 -0600 Subject: [PATCH 08/10] Linux 6.6: convert to ctime accessor functions The Linux 6.6 commit "fs: add ctime accessors infrastructure" (9b6304c1d5) added accessor functions for an inode's ctime member. A follow on commit "fs: rename i_ctime field to __i_ctime" (13bc244578) changed the name of the inode member ctime to __i_ctime to indicate it's a private member. Add an autoconf test for the ctime accessor function 'inode_set_ctime()'. Add an afs_inode_set_ctime to LINUX/osi_machdep.h that is either defined as a macro to Linux's inode_set_ctime, or implements a static inline function to set a inode's ctime. Convert the setting of an inode's ctime to use afs_inode_set_ctime(). For more information behind the Linux change, see the commit message for: "Merge tag 'v6.6-vfs.ctime' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs" (615e95831) Reviewed-on: https://gerrit.openafs.org/15560 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Mark Vitale Tested-by: Mark Vitale Reviewed-by: Benjamin Kaduk (cherry picked from commit 072c7934cd1b99052882f02294f7036d422b6cf1) Conflicts: src/cf/linux-kernel-func.m4 (context) Change-Id: I729408d12a7946f5778b036ca7e2c14299f3ce8e Reviewed-on: https://gerrit.openafs.org/15589 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand (cherry picked from commit 6413fdbc913834f2884989e5811841f4ccea2b5f) --- src/afs/LINUX/osi_machdep.h | 11 +++++++++++ src/afs/LINUX/osi_vnodeops.c | 3 +-- src/cf/linux-kernel-func.m4 | 6 ++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index 2220e0530..f9ceb359e 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -118,6 +118,17 @@ osi_GetTime(osi_timeval32_t *atv) } #endif +#if defined(HAVE_LINUX_INODE_SET_CTIME) +# define afs_inode_set_ctime(inode, sec, nsec) inode_set_ctime((inode), (sec), (nsec)) +#else +static inline void +afs_inode_set_ctime(struct inode *inode, time64_t sec, long nsec) +{ + inode->i_ctime.tv_sec = sec; + inode->i_ctime.tv_nsec = nsec; +} +#endif + #undef gop_lookupname #define gop_lookupname osi_lookupname diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index dc1e32f98..903b5dd5c 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1144,8 +1144,7 @@ vattr2inode(struct inode *ip, struct vattr *vp) * any time the sysname list changes. */ ip->i_mtime.tv_nsec = afs_sysnamegen; - ip->i_ctime.tv_sec = vp->va_ctime.tv_sec; - ip->i_ctime.tv_nsec = 0; + afs_inode_set_ctime(ip, vp->va_ctime.tv_sec, 0); } /* afs_notify_change diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4 index 105e58cce..dc26b6056 100644 --- a/src/cf/linux-kernel-func.m4 +++ b/src/cf/linux-kernel-func.m4 @@ -238,6 +238,12 @@ AC_CHECK_LINUX_FUNC([wrap_directory_iterator], #include ], [(void)wrap_directory_iterator(NULL, NULL, NULL);]) +dnl Linux 6.6 requires the use of a getter/setter for accessing a inode's +dnl ctime member. Test for the setter inode_set_ctime +AC_CHECK_LINUX_FUNC([inode_set_ctime], + [#include ], + [inode_set_ctime(NULL, 0, 0);]) + dnl Consequences - things which get set as a result of the dnl above tests AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"], -- 2.43.0