summarylogtreecommitdiffstats
path: root/0004-linux-Make-iops-mkdir-return-a-struct-dentry.patch
blob: 7967a92dfc3475fad2ca307818fab0a066d55928 (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 f6deca487803fa5ec872450c575eec87316b5c79 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Thu, 26 Jun 2025 10:08:49 -0600
Subject: [PATCH 04/18] linux: Make iops mkdir return a struct dentry *

The Linux 6.15 commit:
'Change inode_operations.mkdir to return struct dentry *' (88d5baf69082)
changed the signature for the return value for mkdir member of the
inope_operations structure.

The new return value for mkdir needs to be as follows:

    NULL if the directory was created and no other dentry was used
    ERR_PTR() if an error occured
    non-NULL pointer to a different dentry was used.

OpenAFS does not use a different dentry, so returning NULL or ERR_PTR
is sufficient.

Introduce a new autoconf check to determine if the inode_ops.mkdir needs
to return a pointer to a dentry.

Update afs_linux_mkdir to use ERR_PTR() on the return value.

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

Change-Id: I96af366fc70076980ba0ba10e4b30f1db0f65e78
Reviewed-on: https://gerrit.openafs.org/16419
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit eeb4f7012ce8b22ff24d073e52e837ef36507afb)
---
 src/afs/LINUX/osi_vnodeops.c | 12 ++++++++++--
 src/cf/linux-kernel-sig.m4   |  9 +++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
index c0d1109f0..a7cfc7602 100644
--- a/src/afs/LINUX/osi_vnodeops.c
+++ b/src/afs/LINUX/osi_vnodeops.c
@@ -2079,8 +2079,11 @@ out:
     crfree(credp);
     return afs_convert_code(code);
 }
-
-#if defined(IOP_TAKES_MNT_IDMAP)
+#if defined(HAVE_LINUX_INODE_OPERATIONS_MKDIR_RETURN_DENTRY)
+static struct dentry *
+afs_linux_mkdir(struct mnt_idmap *idmap, struct inode *dip,
+		struct dentry *dp, umode_t mode)
+#elif defined(IOP_TAKES_MNT_IDMAP)
 static int
 afs_linux_mkdir(struct mnt_idmap *idmap, struct inode *dip,
 		struct dentry *dp, umode_t mode)
@@ -2131,7 +2134,12 @@ out:
     AFS_GUNLOCK();
 
     crfree(credp);
+
+#if defined(HAVE_LINUX_INODE_OPERATIONS_MKDIR_RETURN_DENTRY)
+    return ERR_PTR(afs_convert_code(code));
+#else
     return afs_convert_code(code);
+#endif
 }
 
 static int
diff --git a/src/cf/linux-kernel-sig.m4 b/src/cf/linux-kernel-sig.m4
index 5301f3503..c9b8fe8ed 100644
--- a/src/cf/linux-kernel-sig.m4
+++ b/src/cf/linux-kernel-sig.m4
@@ -41,4 +41,13 @@ dnl define.
 AS_IF([test AS_VAR_GET([ac_cv_linux_operation_inode_operations_create_mnt_idmap]) = yes],
       [AC_DEFINE([IOP_TAKES_MNT_IDMAP], 1,
                  [define if inodeops require struct mnt_idmap])])
+
+dnl Linux 6.15 changed the return value for inode_operations.mkdir to a struct dentry *
+AC_CHECK_LINUX_OPERATION([inode_operations], [mkdir], [return_dentry],
+                         [#include <linux/fs.h>],
+                         [struct dentry *],
+                         [struct mnt_idmap *idmap,
+                         struct inode *inode, struct dentry *dentry,
+                         umode_t umode])
+
 ])
\ No newline at end of file
-- 
2.51.0