summarylogtreecommitdiffstats
path: root/0012-linux-change-lookup_one_len-to-lookup_noperm.patch
blob: c6092b07167edf88046b47e17a706d24159d24ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
From 3142218debedc3a9f6bb234909e7fe2889ea2b6f Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Mon, 7 Jul 2025 16:57:23 -0600
Subject: [PATCH 12/18] linux: change lookup_one_len to lookup_noperm

The linux 6.16 commit:
    'VFS: rename lookup_one_len family to lookup_noperm and remove
     permission check' (fa6fe07d15363)

Renamed the lookup_one_len() function to lookup_noperm().

Create a wrapper, afs_lookup_noperm(), to call lookup_noperm() if
available, otherwise use lookup_one_len().

Add an autoconf test to determine the presence of lookup_noperm().

The only location that uses afs_lookup_noperm is afs_linux_sillyrename.
Within this context, the code does not require the permission check that
was part of lookup_one_len().

Reviewed-on: https://gerrit.openafs.org/16435
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
(cherry picked from commit d3c424dcaba6ed8415a7617f0ae3622fe84e988a)

Change-Id: Ibe202694162f79defdf546eb4907504856263a4f
Reviewed-on: https://gerrit.openafs.org/16498
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
(cherry picked from commit a580c6388ae08b8af0fa03d866f7db5e9c87a209)
---
 src/afs/LINUX/osi_compat.h   | 10 ++++++++++
 src/afs/LINUX/osi_vnodeops.c |  3 +--
 src/cf/linux-kernel-func.m4  |  7 +++++++
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
index 0fc72a384..d43dec5ef 100644
--- a/src/afs/LINUX/osi_compat.h
+++ b/src/afs/LINUX/osi_compat.h
@@ -855,4 +855,14 @@ afs_put_page(struct page *p)
 #endif
 }
 
+static inline struct dentry *
+afs_lookup_noperm(char *name, struct dentry *dp)
+{
+#if defined(HAVE_LINUX_LOOKUP_NOPERM)
+    return lookup_noperm(&QSTR(name), dp);
+#else
+    return lookup_one_len(name, dp, strlen(name));
+#endif
+}
+
 #endif /* AFS_LINUX_OSI_COMPAT_H */
diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
index b0b600256..070a2ca75 100644
--- a/src/afs/LINUX/osi_vnodeops.c
+++ b/src/afs/LINUX/osi_vnodeops.c
@@ -1981,8 +1981,7 @@ afs_linux_sillyrename(struct inode *dir, struct dentry *dentry,
 	__name = afs_newname();
 	AFS_GUNLOCK();
 
-	__dp = lookup_one_len(__name, dentry->d_parent, strlen(__name));
-
+	__dp = afs_lookup_noperm(__name, dentry->d_parent);
 	if (IS_ERR(__dp)) {
 	    osi_FreeSmallSpace(__name);
 	    return EBUSY;
diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
index d991ee313..8be20ba90 100644
--- a/src/cf/linux-kernel-func.m4
+++ b/src/cf/linux-kernel-func.m4
@@ -343,6 +343,13 @@ AC_CHECK_LINUX_FUNC([filemap_get_folio],
                       static struct folio *folio;]],
                     [[folio = __filemap_get_folio(NULL, 0, 0, 0);]])
 
+dnl Linux 6.16, lookup_noperm replaces lookup_one_len
+AC_CHECK_LINUX_FUNC([lookup_noperm],
+		    [[#include <linux/namei.h>
+		      #include <linux/dcache.h>
+		      static struct dentry *dp;]],
+		    [[dp = lookup_noperm(NULL, NULL);]])
+
 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.51.0