Compare commits

2 Commits

Author SHA256 Message Date
e135b1291b Accepting request 1268384 from filesystems
OBS-URL: https://build.opensuse.org/request/show/1268384
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/openafs?expand=0&rev=53
2025-04-10 19:59:55 +00:00
Christof Hanke
945e15c009 - add perl-rpm-packaging to BuildRequires: to resolve
"Have Choice"-Error  for arch ppc64le 
- update to latest git branch stable-1_8_x
- add upstream-patches required for kernel 6.14
  + 4702930f8dd87a6cad1d59ef8c127003fded1f31.patch
    (LINUX: Refactor afs_linux_dentry_revalidate())
  + 0306f3fdac736e15620f5802bdce510d25bb2450.patch 
    (Linux-6.14: Handle dops.d_revalidate with parent)

OBS-URL: https://build.opensuse.org/package/show/filesystems/openafs?expand=0&rev=135
2025-04-10 12:18:55 +00:00
10 changed files with 378 additions and 8 deletions

View File

@@ -0,0 +1,133 @@
commit 0306f3fdac736e15620f5802bdce510d25bb2450
Author: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri Feb 7 11:10:27 2025 -0700
Linux-6.14: Handle dops.d_revalidate with parent
The Linux 6.14 commit:
'5be1fa8abd7b0 Pass parent directory inode and expected name to
->d_revalidate()'
added 2 parameters to the dentry_operations.d_revalidate method. These
new parameters are being provided as a convenience so a filesystem's
d_revalidate function can avoid some boilerplate code for obtaining the
dentry's ->d_parent and ->d_name. The caller ensures that these two
values are stable.
Add a new autoconf test to determine if dentry_operations.d_revalidate
has the new parameters.
Update afs_linux_dentry_revalidate() to accept the new parameters.
Change-Id: I7676ce9ae6ac48e37c8d9fbb3fefc455f80c41e1
Reviewed-on: https://gerrit.openafs.org/16253
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
index afd2f8112..82c74c431 100644
--- a/src/afs/LINUX/osi_vnodeops.c
+++ b/src/afs/LINUX/osi_vnodeops.c
@@ -1592,32 +1592,43 @@ dentry_revalidate_common(struct vcache *pvcp, const char *name, struct dentry *d
#endif
}
-#if defined(DOP_REVALIDATE_TAKES_UNSIGNED)
+#if defined(DOP_REVALIDATE_TAKES_PARENT_INODE)
+static int
+afs_linux_dentry_revalidate(struct inode *parent_inode, const struct qstr *name,
+ struct dentry *dp, unsigned int flags)
+{
+ if ((flags & LOOKUP_RCU) != 0) {
+ return -ECHILD;
+ }
+ return dentry_revalidate_common(VTOAFS(parent_inode), name->name, dp);
+}
+#else
+# if defined(DOP_REVALIDATE_TAKES_UNSIGNED)
static int
afs_linux_dentry_revalidate(struct dentry *dp, unsigned int flags)
-#elif defined(DOP_REVALIDATE_TAKES_NAMEIDATA)
+# elif defined(DOP_REVALIDATE_TAKES_NAMEIDATA)
static int
afs_linux_dentry_revalidate(struct dentry *dp, struct nameidata *nd)
-#else
+# else
static int
afs_linux_dentry_revalidate(struct dentry *dp, int flags)
-#endif
+# endif
{
int code;
struct dentry *parent;
-#ifdef LOOKUP_RCU
+# ifdef LOOKUP_RCU
/* We don't support RCU path walking */
-# if defined(DOP_REVALIDATE_TAKES_UNSIGNED)
+# if defined(DOP_REVALIDATE_TAKES_UNSIGNED)
if ((flags & LOOKUP_RCU) != 0) {
return -ECHILD;
}
-# else
+# else
if ((nd->flags & LOOKUP_RCU) != 0) {
return -ECHILD;
}
+# endif
# endif
-#endif
parent = dget_parent(dp);
code = dentry_revalidate_common(VTOAFS(parent->d_inode),
@@ -1626,6 +1637,7 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
return code;
}
+#endif /* DOP_REVALIDATE_TAKES_PARENT_INODE */
static void
afs_dentry_iput(struct dentry *dp, struct inode *ip)
diff --git a/src/cf/linux-kernel-assorted.m4 b/src/cf/linux-kernel-assorted.m4
index 88f9e1897..03459137f 100644
--- a/src/cf/linux-kernel-assorted.m4
+++ b/src/cf/linux-kernel-assorted.m4
@@ -17,6 +17,7 @@ LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA
LINUX_IOP_I_PUT_LINK_TAKES_COOKIE
LINUX_DOP_D_DELETE_TAKES_CONST
LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA
+LINUX_DOP_D_REVALIDATE_TAKES_PARENT_INODE
LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T
LINUX_FOP_F_FSYNC_TAKES_DENTRY
LINUX_FOP_F_FSYNC_TAKES_RANGE
diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
index b22930690..c7c0c2318 100644
--- a/src/cf/linux-test4.m4
+++ b/src/cf/linux-test4.m4
@@ -885,3 +885,21 @@ AC_DEFUN([LINUX_FILE_LOCK_CORE], [
[define if file_lock_core exists],
[])
])
+
+dnl linux 6.14 updated dentry_operations.d_revalidate with 2 additional
+dnl parameters, the inode of the parent directory and the name the dentry
+dnl is expected to have. Using these are optional. Both parameters are
+dnl stable.
+AC_DEFUN([LINUX_DOP_D_REVALIDATE_TAKES_PARENT_INODE], [
+ AC_CHECK_LINUX_BUILD([whether dop.d_revalidate takes inode and qstr],
+ [ac_cv_linux_func_d_revalidate_takes_parent_inode],
+ [#include <linux/fs.h>
+ #include <linux/namei.h>
+ static int reval(struct inode *parent_inode, const struct qstr *name,
+ struct dentry *d, unsigned int flags) { return 0; }
+ struct dentry_operations dops;],
+ [dops.d_revalidate = reval;],
+ [DOP_REVALIDATE_TAKES_PARENT_INODE],
+ [define if your dops.d_revalidate takes a parent inode],
+ [-Werror])
+])
\ No newline at end of file

View File

@@ -0,0 +1,211 @@
commit 4702930f8dd87a6cad1d59ef8c127003fded1f31
Author: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri Feb 14 15:18:52 2025 -0700
LINUX: Refactor afs_linux_dentry_revalidate()
The signature for Linux's dentry_operations.d_revalidate method has
undergone several changes, leading to increased use of #if directives in
afs_linux_dentry_revalidate().
To make the code more maintainable for future changes involving the
parent inode and the dentry's name, split out most of our logic in
afs_linux_dentry_revalidate() into a new function,
dentry_revalidate_common(). Keep the logic for getting the parent and
checking for LOOKUP_RCU in the caller, afs_linux_dentry_revalidate().
Written in collaboration with adeason@sinenomine.net.
Change-Id: Ic45ac12fceba8c5ba98d2b9c454ed28c44f3ece2
Reviewed-on: https://gerrit.openafs.org/16258
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
index 91f7e76be..afd2f8112 100644
--- a/src/afs/LINUX/osi_vnodeops.c
+++ b/src/afs/LINUX/osi_vnodeops.c
@@ -1373,43 +1373,24 @@ check_dentry_race(struct dentry *dp)
}
#endif /* D_SPLICE_ALIAS_RACE */
-/* Validate a dentry. Return 1 if unchanged, 0 if VFS layer should re-evaluate.
- * In kernels 2.2.10 and above, we are passed an additional flags var which
- * may have either the LOOKUP_FOLLOW OR LOOKUP_DIRECTORY set in which case
- * we are advised to follow the entry if it is a link or to make sure that
- * it is a directory. But since the kernel itself checks these possibilities
- * later on, we shouldn't have to do it until later. Perhaps in the future..
+/*
+ * Validate a dentry. Return 1 if unchanged, 0 if VFS layer should re-evaluate.
*
- * The code here assumes that on entry the global lock is not held
+ * @param[in] pvcp vcache for the parent directory containing 'dp'
+ * @param[in] name the name of the directory entry for 'dp'
+ * @param[in] dp the dentry we are checking
*/
static int
-#if defined(DOP_REVALIDATE_TAKES_UNSIGNED)
-afs_linux_dentry_revalidate(struct dentry *dp, unsigned int flags)
-#elif defined(DOP_REVALIDATE_TAKES_NAMEIDATA)
-afs_linux_dentry_revalidate(struct dentry *dp, struct nameidata *nd)
-#else
-afs_linux_dentry_revalidate(struct dentry *dp, int flags)
-#endif
+dentry_revalidate_common(struct vcache *pvcp, const char *name, struct dentry *dp)
{
cred_t *credp = NULL;
- struct vcache *vcp, *pvcp, *tvc = NULL;
- struct dentry *parent;
+ struct vcache *vcp, *tvc = NULL;
int valid;
struct afs_fakestat_state fakestate;
int force_drop = 0;
afs_uint32 parent_dv;
int code = 0;
-#ifdef LOOKUP_RCU
- /* We don't support RCU path walking */
-# if defined(DOP_REVALIDATE_TAKES_UNSIGNED)
- if (flags & LOOKUP_RCU)
-# else
- if (nd->flags & LOOKUP_RCU)
-# endif
- return -ECHILD;
-#endif
-
#ifdef D_SPLICE_ALIAS_RACE
if (check_dentry_race(dp)) {
valid = 0;
@@ -1437,7 +1418,7 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
if (code) {
goto error;
}
- if ((strcmp(dp->d_name.name, ".directory") == 0)) {
+ if ((strcmp(name, ".directory") == 0)) {
tryEvalOnly = 1;
}
if (tryEvalOnly)
@@ -1453,13 +1434,11 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
goto bad_dentry;
}
}
- } else if (vcp->mvstat == AFS_MVSTAT_ROOT && *dp->d_name.name != '/') {
+ } else if (vcp->mvstat == AFS_MVSTAT_ROOT && name[0] != '/') {
osi_Assert(vcp->mvid.parent != NULL);
}
- parent = dget_parent(dp);
- pvcp = VTOAFS(parent->d_inode);
- parent_dv = parent_vcache_dv(parent->d_inode, credp);
+ parent_dv = parent_vcache_dv(AFSTOV(pvcp), credp);
/* If the parent's DataVersion has changed or the vnode
* is longer valid, we need to do a full lookup. VerifyVCache
@@ -1472,7 +1451,7 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
if (credp == NULL) {
credp = crref();
}
- code = afs_lookup(pvcp, (char *)dp->d_name.name, &tvc, credp);
+ code = afs_lookup(pvcp, (char *)name, &tvc, credp);
code = filter_enoent(code);
if (code == ENOENT) {
/* ENOENT is not an error here. */
@@ -1483,7 +1462,6 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
if (code) {
/* We couldn't perform the lookup, so we don't know if the
* dentry is valid or not. */
- dput(parent);
goto error;
}
@@ -1506,19 +1484,16 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
* _not_ okay. Force it to be unhashed, since the given name
* doesn't point to this file anymore.
*/
- dput(parent);
force_drop = 1;
goto bad_dentry;
}
code = afs_CreateAttr(&vattr);
if (code) {
- dput(parent);
goto error;
}
if (afs_getattr(vcp, vattr, credp)) {
- dput(parent);
afs_DestroyAttr(vattr);
code = EIO;
goto error;
@@ -1533,23 +1508,15 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
/* should we always update the attributes at this point? */
/* unlikely--the vcache entry hasn't changed */
- dput(parent);
-
} else {
-
/* 'dp' represents a cached negative lookup. */
- parent = dget_parent(dp);
- pvcp = VTOAFS(parent->d_inode);
- parent_dv = parent_vcache_dv(parent->d_inode, credp);
+ parent_dv = parent_vcache_dv(AFSTOV(pvcp), credp);
if (parent_dv > dp->d_time || !(pvcp->f.states & CStatd)
|| afs_IsDynroot(pvcp)) {
- dput(parent);
goto bad_dentry;
}
-
- dput(parent);
}
good_dentry:
@@ -1625,6 +1592,41 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
#endif
}
+#if defined(DOP_REVALIDATE_TAKES_UNSIGNED)
+static int
+afs_linux_dentry_revalidate(struct dentry *dp, unsigned int flags)
+#elif defined(DOP_REVALIDATE_TAKES_NAMEIDATA)
+static int
+afs_linux_dentry_revalidate(struct dentry *dp, struct nameidata *nd)
+#else
+static int
+afs_linux_dentry_revalidate(struct dentry *dp, int flags)
+#endif
+{
+ int code;
+ struct dentry *parent;
+
+#ifdef LOOKUP_RCU
+ /* We don't support RCU path walking */
+# if defined(DOP_REVALIDATE_TAKES_UNSIGNED)
+ if ((flags & LOOKUP_RCU) != 0) {
+ return -ECHILD;
+ }
+# else
+ if ((nd->flags & LOOKUP_RCU) != 0) {
+ return -ECHILD;
+ }
+# endif
+#endif
+
+ parent = dget_parent(dp);
+ code = dentry_revalidate_common(VTOAFS(parent->d_inode),
+ dp->d_name.name, dp);
+ dput(parent);
+
+ return code;
+}
+
static void
afs_dentry_iput(struct dentry *dp, struct inode *ip)
{

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0069c920ea173ff34f729dce26788c9a55966a9b71cc76c53176b0017771f5be
size 3372548
oid sha256:05e7d966cffd6fe72fd6976065200e5573457aa35748874d57eec6ecbed23670
size 3373158

View File

@@ -1 +1 @@
062fe23f3bd1c46786420373649e8414 /home/hanke/obs/home:hauky:branches:filesystems/openafs/openafs-stable-1_8_x-doc.tar.bz2
6cce2b29b2027dcbed7911da86f2f5e5 /home/hanke/obs/home:hauky:branches:filesystems/openafs/openafs-stable-1_8_x-doc.tar.bz2

View File

@@ -1 +1 @@
0069c920ea173ff34f729dce26788c9a55966a9b71cc76c53176b0017771f5be /home/hanke/obs/home:hauky:branches:filesystems/openafs/openafs-stable-1_8_x-doc.tar.bz2
05e7d966cffd6fe72fd6976065200e5573457aa35748874d57eec6ecbed23670 /home/hanke/obs/home:hauky:branches:filesystems/openafs/openafs-stable-1_8_x-doc.tar.bz2

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:764cfd8501ca2d8796c41ed588a9664d5e317fd8253757504df2bf136db65afe
size 14644448
oid sha256:5088353cec7628b9ab0640e2ab8a228add749669ff3f7567b760ccedda64f830
size 14654297

View File

@@ -1 +1 @@
333aca22efa0c5fbdd522eee084d16d9 /home/hanke/obs/home:hauky:branches:filesystems/openafs/openafs-stable-1_8_x-src.tar.bz2
c35b8393068ac020d8d0a3baa9ac7fc5 /home/hanke/obs/home:hauky:branches:filesystems/openafs/openafs-stable-1_8_x-src.tar.bz2

View File

@@ -1 +1 @@
764cfd8501ca2d8796c41ed588a9664d5e317fd8253757504df2bf136db65afe /home/hanke/obs/home:hauky:branches:filesystems/openafs/openafs-stable-1_8_x-src.tar.bz2
5088353cec7628b9ab0640e2ab8a228add749669ff3f7567b760ccedda64f830 /home/hanke/obs/home:hauky:branches:filesystems/openafs/openafs-stable-1_8_x-src.tar.bz2

View File

@@ -1,3 +1,19 @@
-------------------------------------------------------------------
Wed Apr 9 06:47:28 UTC 2025 - Christof Hanke <christof.hanke@mpcdf.mpg.de>
- add perl-rpm-packaging to BuildRequires: to resolve
"Have Choice"-Error for arch ppc64le
-------------------------------------------------------------------
Wed Apr 9 05:28:26 UTC 2025 - Christof Hanke <christof.hanke@mpcdf.mpg.de>
- update to latest git branch stable-1_8_x
- add upstream-patches required for kernel 6.14
+ 4702930f8dd87a6cad1d59ef8c127003fded1f31.patch
(LINUX: Refactor afs_linux_dentry_revalidate())
+ 0306f3fdac736e15620f5802bdce510d25bb2450.patch
(Linux-6.14: Handle dops.d_revalidate with parent)
-------------------------------------------------------------------
Mon Jan 27 08:28:38 UTC 2025 - Christof Hanke <christof.hanke@mpcdf.mpg.de>

View File

@@ -103,6 +103,10 @@ Source58: openafs.cacheinfo
Source98: kmp_only.files
Source99: openafs.changes
# FIX build of kernel module for version 6.14
Patch01: 4702930f8dd87a6cad1d59ef8c127003fded1f31.patch
Patch02: 0306f3fdac736e15620f5802bdce510d25bb2450.patch
# GENERAL BuildRequires and Requires
#
@@ -124,6 +128,9 @@ BuildRequires: libtool
BuildRequires: ncurses-devel
BuildRequires: pkg-config
BuildRequires: swig
%ifarch ppc64le
BuildRequires: perl-rpm-packaging
%endif
Requires(post): %fillup_prereq
@@ -314,6 +321,9 @@ done
%setup -q -n openafs-%{upstream_version} -T -b 0 -b 1
%patch -P 01 -p1
%patch -P 02 -p1
./regen.sh
%build