tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
openafs: fix on kernel 3.16 with upstream patches
Domen Kožar
11 years ago
5853c2da
4eedbfd7
+186
3 changed files
expand all
collapse all
unified
split
pkgs
servers
openafs-client
ae86b07f827d6f3e2032a412f5f6cb3951a27d2d.patch
default.nix
f3c0f74186f4a323ffc5f125d961fe384d396cac.patch
+51
pkgs/servers/openafs-client/ae86b07f827d6f3e2032a412f5f6cb3951a27d2d.patch
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
From e284db57f94c8f97ed1c95dcd0bd9518d86c050c Mon Sep 17 00:00:00 2001
2
+
From: Marc Dionne <marc.dionne@your-file-system.com>
3
+
Date: Wed, 18 Jun 2014 08:53:48 -0400
4
+
Subject: [PATCH] Linux 3.16: Switch to iter_file_splice_write
5
+
6
+
Users of generic_file_splice_write need to switch to
7
+
using iter_file_splice_write.
8
+
9
+
Change-Id: If4801d27e030e1cb986f483cf437a2cfa7398eb3
10
+
Reviewed-on: http://gerrit.openafs.org/11302
11
+
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
12
+
Tested-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
13
+
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
14
+
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
15
+
---
16
+
acinclude.m4 | 3 +++
17
+
src/afs/LINUX/osi_vnodeops.c | 4 ++++
18
+
2 files changed, 7 insertions(+), 0 deletions(-)
19
+
20
+
diff --git a/acinclude.m4 b/acinclude.m4
21
+
index ae8f1ed..9e39d90 100644
22
+
--- a/acinclude.m4
23
+
+++ b/acinclude.m4
24
+
@@ -958,6 +958,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
25
+
AC_CHECK_LINUX_FUNC([inode_setattr],
26
+
[#include <linux/fs.h>],
27
+
[inode_setattr(NULL, NULL);])
28
+
+ AC_CHECK_LINUX_FUNC([iter_file_splice_write],
29
+
+ [#include <linux/fs.h>],
30
+
+ [iter_file_splice_write(NULL,NULL,NULL,0,0);])
31
+
AC_CHECK_LINUX_FUNC([kernel_setsockopt],
32
+
[#include <linux/net.h>],
33
+
[kernel_setsockopt(NULL, 0, 0, NULL, 0);])
34
+
diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
35
+
index 6f4000b..2685915 100644
36
+
--- a/src/afs/LINUX/osi_vnodeops.c
37
+
+++ b/src/afs/LINUX/osi_vnodeops.c
38
+
@@ -827,7 +827,11 @@ struct file_operations afs_file_fops = {
39
+
.sendfile = generic_file_sendfile,
40
+
#endif
41
+
#if defined(STRUCT_FILE_OPERATIONS_HAS_SPLICE)
42
+
+# if defined(HAVE_LINUX_ITER_FILE_SPLICE_WRITE)
43
+
+ .splice_write = iter_file_splice_write,
44
+
+# else
45
+
.splice_write = generic_file_splice_write,
46
+
+# endif
47
+
.splice_read = generic_file_splice_read,
48
+
#endif
49
+
.release = afs_linux_release,
50
+
--
51
+
1.7.1
+5
pkgs/servers/openafs-client/default.nix
···
10
url = http://www.openafs.org/dl/openafs/1.6.9/openafs-1.6.9-src.tar.bz2;
11
sha256 = "1isgw7znp10w0mr3sicnjzbc12bd1gdwfqqr667w6p3syyhs6bkv";
12
};
0
0
0
0
0
13
14
buildInputs = [ autoconf automake flex yacc ncurses perl which ];
15
···
10
url = http://www.openafs.org/dl/openafs/1.6.9/openafs-1.6.9-src.tar.bz2;
11
sha256 = "1isgw7znp10w0mr3sicnjzbc12bd1gdwfqqr667w6p3syyhs6bkv";
12
};
13
+
14
+
patches = [
15
+
./f3c0f74186f4a323ffc5f125d961fe384d396cac.patch
16
+
./ae86b07f827d6f3e2032a412f5f6cb3951a27d2d.patch
17
+
];
18
19
buildInputs = [ autoconf automake flex yacc ncurses perl which ];
20
+130
pkgs/servers/openafs-client/f3c0f74186f4a323ffc5f125d961fe384d396cac.patch
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
From: Marc Dionne <marc.dionne@your-file-system.com>
2
+
Date: Wed, 18 Jun 2014 13:06:39 +0000 (-0400)
3
+
Subject: Linux 3.16: Convert to new write_iter/read_iter ops
4
+
X-Git-Tag: openafs-stable-1_6_10pre1~76
5
+
X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=f3c0f74186f4a323ffc5f125d961fe384d396cac
6
+
7
+
Linux 3.16: Convert to new write_iter/read_iter ops
8
+
9
+
Change read/write operations to the new write_iter/read_iter
10
+
operations.
11
+
12
+
Reviewed-on: http://gerrit.openafs.org/11303
13
+
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
14
+
Tested-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
15
+
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
16
+
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
17
+
(cherry picked from commit a303bb257ed9e790d8c14644779e9508167887b6)
18
+
19
+
Change-Id: I3f66104be067698a4724ed78537765cf26d4aa10
20
+
Reviewed-on: http://gerrit.openafs.org/11309
21
+
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
22
+
Tested-by: BuildBot <buildbot@rampaginggeek.com>
23
+
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
24
+
---
25
+
26
+
diff --git a/acinclude.m4 b/acinclude.m4
27
+
index 83a1a8c..13d70db 100644
28
+
--- a/acinclude.m4
29
+
+++ b/acinclude.m4
30
+
@@ -836,6 +836,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
31
+
AC_CHECK_LINUX_STRUCT([inode], [i_security], [fs.h])
32
+
AC_CHECK_LINUX_STRUCT([file_operations], [flock], [fs.h])
33
+
AC_CHECK_LINUX_STRUCT([file_operations], [iterate], [fs.h])
34
+
+ AC_CHECK_LINUX_STRUCT([file_operations], [read_iter], [fs.h])
35
+
AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h])
36
+
AC_CHECK_LINUX_STRUCT([file_system_type], [mount], [fs.h])
37
+
AC_CHECK_LINUX_STRUCT([inode_operations], [truncate], [fs.h])
38
+
diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
39
+
index 441cce7..818debe 100644
40
+
--- a/src/afs/LINUX/osi_vnodeops.c
41
+
+++ b/src/afs/LINUX/osi_vnodeops.c
42
+
@@ -99,8 +99,11 @@ afs_linux_VerifyVCache(struct vcache *avc, cred_t **retcred) {
43
+
return afs_convert_code(code);
44
+
}
45
+
46
+
-#ifdef HAVE_LINUX_GENERIC_FILE_AIO_READ
47
+
-# ifdef LINUX_HAS_NONVECTOR_AIO
48
+
+#if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER) || defined(HAVE_LINUX_GENERIC_FILE_AIO_READ)
49
+
+# if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER)
50
+
+static ssize_t
51
+
+afs_linux_read_iter(struct kiocb *iocb, struct iov_iter *iter)
52
+
+# elif defined(LINUX_HAS_NONVECTOR_AIO)
53
+
static ssize_t
54
+
afs_linux_aio_read(struct kiocb *iocb, char __user *buf, size_t bufsize,
55
+
loff_t pos)
56
+
@@ -113,6 +116,11 @@ afs_linux_aio_read(struct kiocb *iocb, const struct iovec *buf,
57
+
struct file *fp = iocb->ki_filp;
58
+
ssize_t code = 0;
59
+
struct vcache *vcp = VTOAFS(fp->f_dentry->d_inode);
60
+
+# if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER)
61
+
+ loff_t pos = iocb->ki_pos;
62
+
+ unsigned long bufsize = iter->nr_segs;
63
+
+# endif
64
+
+
65
+
66
+
AFS_GLOCK();
67
+
afs_Trace4(afs_iclSetp, CM_TRACE_AIOREADOP, ICL_TYPE_POINTER, vcp,
68
+
@@ -125,7 +133,11 @@ afs_linux_aio_read(struct kiocb *iocb, const struct iovec *buf,
69
+
* so we optimise by not using it */
70
+
osi_FlushPages(vcp, NULL); /* ensure stale pages are gone */
71
+
AFS_GUNLOCK();
72
+
+# if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER)
73
+
+ code = generic_file_read_iter(iocb, iter);
74
+
+# else
75
+
code = generic_file_aio_read(iocb, buf, bufsize, pos);
76
+
+# endif
77
+
AFS_GLOCK();
78
+
}
79
+
80
+
@@ -170,8 +182,11 @@ afs_linux_read(struct file *fp, char *buf, size_t count, loff_t * offp)
81
+
* also take care of re-positioning the pointer if file is open in append
82
+
* mode. Call fake open/close to ensure we do writes of core dumps.
83
+
*/
84
+
-#ifdef HAVE_LINUX_GENERIC_FILE_AIO_READ
85
+
-# ifdef LINUX_HAS_NONVECTOR_AIO
86
+
+#if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER) || defined(HAVE_LINUX_GENERIC_FILE_AIO_READ)
87
+
+# if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER)
88
+
+static ssize_t
89
+
+afs_linux_write_iter(struct kiocb *iocb, struct iov_iter *iter)
90
+
+# elif defined(LINUX_HAS_NONVECTOR_AIO)
91
+
static ssize_t
92
+
afs_linux_aio_write(struct kiocb *iocb, const char __user *buf, size_t bufsize,
93
+
loff_t pos)
94
+
@@ -184,6 +199,10 @@ afs_linux_aio_write(struct kiocb *iocb, const struct iovec *buf,
95
+
ssize_t code = 0;
96
+
struct vcache *vcp = VTOAFS(iocb->ki_filp->f_dentry->d_inode);
97
+
cred_t *credp;
98
+
+# if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER)
99
+
+ loff_t pos = iocb->ki_pos;
100
+
+ unsigned long bufsize = iter->nr_segs;
101
+
+# endif
102
+
103
+
AFS_GLOCK();
104
+
105
+
@@ -199,7 +218,11 @@ afs_linux_aio_write(struct kiocb *iocb, const struct iovec *buf,
106
+
ReleaseWriteLock(&vcp->lock);
107
+
if (code == 0) {
108
+
AFS_GUNLOCK();
109
+
+# if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER)
110
+
+ code = generic_file_write_iter(iocb, iter);
111
+
+# else
112
+
code = generic_file_aio_write(iocb, buf, bufsize, pos);
113
+
+# endif
114
+
AFS_GLOCK();
115
+
}
116
+
117
+
@@ -788,7 +811,12 @@ struct file_operations afs_dir_fops = {
118
+
};
119
+
120
+
struct file_operations afs_file_fops = {
121
+
-#ifdef HAVE_LINUX_GENERIC_FILE_AIO_READ
122
+
+#ifdef STRUCT_FILE_OPERATIONS_HAS_READ_ITER
123
+
+ .read_iter = afs_linux_read_iter,
124
+
+ .write_iter = afs_linux_write_iter,
125
+
+ .read = new_sync_read,
126
+
+ .write = new_sync_write,
127
+
+#elif defined(HAVE_LINUX_GENERIC_FILE_AIO_READ)
128
+
.aio_read = afs_linux_aio_read,
129
+
.aio_write = afs_linux_aio_write,
130
+
.read = do_sync_read,