summarylogtreecommitdiffstats
path: root/0002-Linux-Test-for-__vfs_write-rather-than-__vfs_read.patch
blob: 1e47d68b857dd756faa09596fc80503f5b9178ac (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
96
97
98
99
From d1e45fa924711f904c256f5055d6ebae6cc18a88 Mon Sep 17 00:00:00 2001
From: Damien Diederen <ddiederen@sinenomine.net>
Date: Mon, 18 Sep 2017 11:59:40 +0200
Subject: [PATCH 2/3] Linux: Test for __vfs_write rather than __vfs_read

The following commit:

    commit eb031849d52e61d24ba54e9d27553189ff328174
    Author: Christoph Hellwig <hch@lst.de>
    Date:   Fri Sep 1 17:39:23 2017 +0200

        fs: unexport __vfs_read/__vfs_write

unexports both __vfs_read and __vfs_write, but keeps the former in
fs.h--as it is is still being used by another part of the tree.

This situation results in a false positive in our Autoconf check,
which does not see the export statements, and ends up marking the
corresponding API as available.

That, in turn, causes some code which assumes symmetry with
__vfs_write to fail to compile.

Switch to testing for __vfs_write, which correctly marks the API as
unavailable.

Reviewed-on: https://gerrit.openafs.org/12728
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 929e77a886fc9853ee292ba1aa52a920c454e94b)

Reviewed-on: https://gerrit.openafs.org/12736
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit c42a25d28fbcc76fdcac2b5f29704f8f1b353b45)

Change-Id: I27c1c67bed6ebb922389ebb70cbb7fc238378b58
---
 acinclude.m4                 | 4 ++--
 src/afs/LINUX/osi_compat.h   | 4 ++--
 src/afs/LINUX/osi_vnodeops.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index d80cacd78..8353ca597 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -939,9 +939,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
 
 		 dnl Function existence checks
 
-		 AC_CHECK_LINUX_FUNC([__vfs_read],
+		 AC_CHECK_LINUX_FUNC([__vfs_write],
 				     [#include <linux/fs.h>],
-				     [__vfs_read(NULL, NULL, 0, NULL);])
+				     [__vfs_write(NULL, NULL, 0, NULL);])
                  AC_CHECK_LINUX_FUNC([bdi_init],
 				     [#include <linux/backing-dev.h>],
 				     [bdi_init(NULL);])
diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
index 8e72161bf..9ebe9c178 100644
--- a/src/afs/LINUX/osi_compat.h
+++ b/src/afs/LINUX/osi_compat.h
@@ -595,7 +595,7 @@ afs_d_invalidate(struct dentry *dp)
 static inline int
 afs_file_read(struct file *filp, char __user *buf, size_t len, loff_t *pos)
 {
-#if defined(HAVE_LINUX___VFS_READ)
+#if defined(HAVE_LINUX___VFS_WRITE)
     return __vfs_read(filp, buf, len, pos);
 #else
     return filp->f_op->read(filp, buf, len, pos);
@@ -605,7 +605,7 @@ afs_file_read(struct file *filp, char __user *buf, size_t len, loff_t *pos)
 static inline int
 afs_file_write(struct file *filp, char __user *buf, size_t len, loff_t *pos)
 {
-#if defined(HAVE_LINUX___VFS_READ)
+#if defined(HAVE_LINUX___VFS_WRITE)
     return __vfs_write(filp, buf, len, pos);
 #else
     return filp->f_op->write(filp, buf, len, pos);
diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
index f46d8dda8..3d9d71791 100644
--- a/src/afs/LINUX/osi_vnodeops.c
+++ b/src/afs/LINUX/osi_vnodeops.c
@@ -807,7 +807,7 @@ struct file_operations afs_file_fops = {
 #ifdef STRUCT_FILE_OPERATIONS_HAS_READ_ITER
   .read_iter =	afs_linux_read_iter,
   .write_iter =	afs_linux_write_iter,
-# if !defined(HAVE_LINUX___VFS_READ)
+# if !defined(HAVE_LINUX___VFS_WRITE)
   .read =	new_sync_read,
   .write =	new_sync_write,
 # endif
-- 
2.15.1