]>
Commit | Line | Data |
---|---|---|
2b5e1b7b JR |
1 | From 50a0749eba31e821a7edf286f1e3b149f7d13c59 Mon Sep 17 00:00:00 2001 |
2 | From: Richard Yao <ryao@gentoo.org> | |
3 | Date: Mon, 25 Nov 2013 11:22:33 -0500 | |
4 | Subject: [PATCH] Linux 3.13 compat: Pass NULL for new delegated inode argument | |
5 | ||
6 | This check was originally added for SLES10, a093c6a, to check for | |
7 | a 'struct vfsmount *' argument which they added. However, since | |
8 | SLES10 is based on a 2.6.16 kernel which is no longer supported | |
9 | this functionality was dropped. The checks were refactored to | |
10 | support Linux 3.13 without concern for historical versions. | |
11 | ||
12 | Signed-off-by: Richard Yao <ryao@gentoo.org> | |
13 | Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> | |
14 | Closes #312 | |
15 | --- | |
16 | config/spl-build.m4 | 52 ++++++++++++++++++++++++++++++++++++++++---------- | |
17 | module/spl/spl-vnode.c | 22 ++++++++++++--------- | |
18 | 2 files changed, 55 insertions(+), 19 deletions(-) | |
19 | ||
20 | diff --git a/config/spl-build.m4 b/config/spl-build.m4 | |
21 | index 7d744db..8426780 100644 | |
22 | --- a/config/spl-build.m4 | |
23 | +++ b/config/spl-build.m4 | |
24 | @@ -1842,41 +1842,73 @@ AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST], | |
25 | EXTRA_KCFLAGS="$tmp_flags" | |
26 | ]) | |
27 | ||
28 | -dnl # | |
29 | -dnl # SLES API change, never adopted in mainline, | |
30 | -dnl # Third 'struct vfsmount *' argument removed. | |
31 | -dnl # | |
32 | AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK], | |
33 | [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args]) | |
34 | SPL_LINUX_TRY_COMPILE([ | |
35 | #include <linux/fs.h> | |
36 | ],[ | |
37 | - vfs_unlink(NULL, NULL); | |
38 | + vfs_unlink((struct inode *) NULL, (struct dentry *) NULL); | |
39 | ],[ | |
40 | AC_MSG_RESULT(yes) | |
41 | AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1, | |
42 | [vfs_unlink() wants 2 args]) | |
43 | ],[ | |
44 | AC_MSG_RESULT(no) | |
45 | + dnl # | |
46 | + dnl # Linux 3.13 API change | |
47 | + dnl # Added delegated inode | |
48 | + dnl # | |
49 | + AC_MSG_CHECKING([whether vfs_unlink() wants 3 args]) | |
50 | + SPL_LINUX_TRY_COMPILE([ | |
51 | + #include <linux/fs.h> | |
52 | + ],[ | |
53 | + vfs_unlink((struct inode *) NULL, | |
54 | + (struct dentry *) NULL, | |
55 | + (struct inode **) NULL); | |
56 | + ],[ | |
57 | + AC_MSG_RESULT(yes) | |
58 | + AC_DEFINE(HAVE_3ARGS_VFS_UNLINK, 1, | |
59 | + [vfs_unlink() wants 3 args]) | |
60 | + ],[ | |
61 | + AC_MSG_ERROR(no) | |
62 | + ]) | |
63 | + | |
64 | ]) | |
65 | ]) | |
66 | ||
67 | -dnl # | |
68 | -dnl # SLES API change, never adopted in mainline, | |
69 | -dnl # Third and sixth 'struct vfsmount *' argument removed. | |
70 | -dnl # | |
71 | AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME], | |
72 | [AC_MSG_CHECKING([whether vfs_rename() wants 4 args]) | |
73 | SPL_LINUX_TRY_COMPILE([ | |
74 | #include <linux/fs.h> | |
75 | ],[ | |
76 | - vfs_rename(NULL, NULL, NULL, NULL); | |
77 | + vfs_rename((struct inode *) NULL, (struct dentry *) NULL, | |
78 | + (struct inode *) NULL, (struct dentry *) NULL); | |
79 | ],[ | |
80 | AC_MSG_RESULT(yes) | |
81 | AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1, | |
82 | [vfs_rename() wants 4 args]) | |
83 | ],[ | |
84 | AC_MSG_RESULT(no) | |
85 | + dnl # | |
86 | + dnl # Linux 3.13 API change | |
87 | + dnl # Added delegated inode | |
88 | + dnl # | |
89 | + AC_MSG_CHECKING([whether vfs_rename() wants 5 args]) | |
90 | + SPL_LINUX_TRY_COMPILE([ | |
91 | + #include <linux/fs.h> | |
92 | + ],[ | |
93 | + vfs_rename((struct inode *) NULL, | |
94 | + (struct dentry *) NULL, | |
95 | + (struct inode *) NULL, | |
96 | + (struct dentry *) NULL, | |
97 | + (struct inode **) NULL); | |
98 | + ],[ | |
99 | + AC_MSG_RESULT(yes) | |
100 | + AC_DEFINE(HAVE_5ARGS_VFS_RENAME, 1, | |
101 | + [vfs_rename() wants 5 args]) | |
102 | + ],[ | |
103 | + AC_MSG_ERROR(no) | |
104 | + ]) | |
105 | ]) | |
106 | ]) | |
107 | ||
108 | diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c | |
109 | index 0784ff2..5496067 100644 | |
110 | --- a/module/spl/spl-vnode.c | |
111 | +++ b/module/spl/spl-vnode.c | |
112 | @@ -334,7 +334,11 @@ | |
113 | if (inode) | |
114 | ihold(inode); | |
115 | ||
116 | +#ifdef HAVE_2ARGS_VFS_UNLINK | |
117 | rc = vfs_unlink(parent.dentry->d_inode, dentry); | |
118 | +#else | |
119 | + rc = vfs_unlink(parent.dentry->d_inode, dentry, NULL); | |
120 | +#endif /* HAVE_2ARGS_VFS_UNLINK */ | |
121 | exit1: | |
122 | dput(dentry); | |
123 | } else { | |
124 | @@ -412,10 +416,10 @@ | |
125 | ||
126 | #ifdef HAVE_4ARGS_VFS_RENAME | |
127 | rc = vfs_rename(old_dir->d_inode, old_dentry, | |
128 | - new_dir->d_inode, new_dentry); | |
129 | + new_dir->d_inode, new_dentry); | |
130 | #else | |
131 | - rc = vfs_rename(old_dir->d_inode, old_dentry, oldnd.nd_mnt, | |
132 | - new_dir->d_inode, new_dentry, newnd.nd_mnt); | |
133 | + rc = vfs_rename(old_dir->d_inode, old_dentry, | |
134 | + new_dir->d_inode, new_dentry, NULL); | |
135 | #endif /* HAVE_4ARGS_VFS_RENAME */ | |
136 | exit4: | |
137 | unlock_rename(new_dir, old_dir); | |
138 | @@ -478,9 +482,9 @@ | |
139 | if (inode) | |
140 | atomic_inc(&inode->i_count); | |
141 | #ifdef HAVE_2ARGS_VFS_UNLINK | |
142 | - rc = vfs_unlink(nd.nd_dentry->d_inode, dentry); | |
143 | + rc = vfs_unlink(nd.nd_dentry->d_inode, dentry); | |
144 | #else | |
145 | - rc = vfs_unlink(nd.nd_dentry->d_inode, dentry, nd.nd_mnt); | |
146 | + rc = vfs_unlink(nd.nd_dentry->d_inode, dentry, NULL); | |
147 | #endif /* HAVE_2ARGS_VFS_UNLINK */ | |
148 | exit2: | |
149 | dput(dentry); | |
150 | @@ -571,11 +575,11 @@ | |
151 | SGOTO(exit5, rc); | |
152 | ||
153 | #ifdef HAVE_4ARGS_VFS_RENAME | |
154 | - rc = vfs_rename(old_dir->d_inode, old_dentry, | |
155 | - new_dir->d_inode, new_dentry); | |
156 | + rc = vfs_rename(old_dir->d_inode, old_dentry, | |
157 | + new_dir->d_inode, new_dentry); | |
158 | #else | |
159 | - rc = vfs_rename(old_dir->d_inode, old_dentry, oldnd.nd_mnt, | |
160 | - new_dir->d_inode, new_dentry, newnd.nd_mnt); | |
161 | + rc = vfs_rename(old_dir->d_inode, old_dentry, | |
162 | + new_dir->d_inode, new_dentry, NULL); | |
163 | #endif /* HAVE_4ARGS_VFS_RENAME */ | |
164 | exit5: | |
165 | dput(new_dentry); | |
166 | -- | |
167 | 1.8.5.1 | |
168 | ||
169 | From 3e96de17d723d6f6c9e2fd04b059b50d4e0bbef0 Mon Sep 17 00:00:00 2001 | |
170 | From: Richard Yao <ryao@gentoo.org> | |
171 | Date: Thu, 8 Aug 2013 04:30:55 -0400 | |
172 | Subject: [PATCH] Linux 3.13 compat: Remove unused flags variable from | |
173 | __cv_init() | |
174 | MIME-Version: 1.0 | |
175 | Content-Type: text/plain; charset=UTF-8 | |
176 | Content-Transfer-Encoding: 8bit | |
177 | ||
178 | GCC 4.8.1 complained about an unused flags variable when building | |
179 | against Linux 2.6.26.8: | |
180 | ||
181 | /var/tmp/portage/sys-kernel/spl-9999/work/spl-9999/module/spl/../../module/spl/spl-condvar.c: | |
182 | In function ‘__cv_init’: | |
183 | /var/tmp/portage/sys-kernel/spl-9999/work/spl-9999/module/spl/../../module/spl/spl-condvar.c:39:6: | |
184 | error: variable ‘flags’ set but not used | |
185 | [-Werror=unused-but-set-variable] | |
186 | int flags = KM_SLEEP; | |
187 | ^ | |
188 | cc1: all warnings being treated as errors | |
189 | ||
190 | Additionally, the superfluous code uses a preempt_count variable that is | |
191 | no longer available on Linux 3.13. Deleting the unnecessary code fixes a | |
192 | Linux 3.13 compatibility issue. | |
193 | ||
194 | Signed-off-by: Richard Yao <ryao@gentoo.org> | |
195 | Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> | |
196 | Closes #312 | |
197 | --- | |
198 | module/spl/spl-condvar.c | 8 -------- | |
199 | 1 file changed, 8 deletions(-) | |
200 | ||
201 | diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c | |
202 | index 283648a..8236412 100644 | |
203 | --- a/module/spl/spl-condvar.c | |
204 | +++ b/module/spl/spl-condvar.c | |
205 | @@ -36,8 +36,6 @@ | |
206 | void | |
207 | __cv_init(kcondvar_t *cvp, char *name, kcv_type_t type, void *arg) | |
208 | { | |
209 | - int flags = KM_SLEEP; | |
210 | - | |
211 | SENTRY; | |
212 | ASSERT(cvp); | |
213 | ASSERT(name == NULL); | |
214 | @@ -51,12 +49,6 @@ | |
215 | atomic_set(&cvp->cv_refs, 1); | |
216 | cvp->cv_mutex = NULL; | |
217 | ||
218 | - /* We may be called when there is a non-zero preempt_count or | |
219 | - * interrupts are disabled is which case we must not sleep. | |
220 | - */ | |
221 | - if (current_thread_info()->preempt_count || irqs_disabled()) | |
222 | - flags = KM_NOSLEEP; | |
223 | - | |
224 | SEXIT; | |
225 | } | |
226 | EXPORT_SYMBOL(__cv_init); | |
227 | -- | |
228 | 1.8.5.1 | |
229 |