summaryrefslogtreecommitdiff
blob: 835de63e3de50c9d96d470b37051462470a2e9c5 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
commit b8b708fc416aa281fe1d1ce1d498cc381c81679c
Author: Marc Dionne <marc.c.dionne@gmail.com>
Date:   Wed Aug 11 19:28:53 2010 -0400

    Linux: Rework statfs super block operations configure test
    
    The configure test to detect if the statfs super block operation
    needs a dentry argument is based on vfs_statfs, and assumes that
    its signature matches the one of the operation.  In 2.6.36 this is
    no longer true and the test fails.
    
    Rework the test to actually test the operation we're interested in.
    
    This change is required for 2.6.36.
    
    Reviewed-on: http://gerrit.openafs.org/2545
    Reviewed-by: Derrick Brashear <shadow@dementia.org>
    Tested-by: Derrick Brashear <shadow@dementia.org>
    
    (cherry-picked from commit 08552ad8a94f7cc5908aabe8385711e09a6418e4)
    
    Change-Id: Ia690ea9de03790a8f576f99249fad8a7a7ba8bad
    Reviewed-on: http://gerrit.openafs.org/2553
    Reviewed-by: Derrick Brashear <shadow@dementia.org>
    Tested-by: Derrick Brashear <shadow@dementia.org>

diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
index 66b21e3..5eabaa9 100644
--- a/src/cf/linux-test4.m4
+++ b/src/cf/linux-test4.m4
@@ -734,9 +734,10 @@ AC_DEFUN([LINUX_STATFS_TAKES_DENTRY], [
     AC_TRY_KBUILD(
 [#include <linux/fs.h>
 #include <linux/statfs.h>],
-[
-extern int vfs_statfs(struct dentry *, struct kstatfs *);
-],
+[struct super_block _sb;
+struct dentry _dentry;
+struct kstatfs _kstatfs;
+(void)_sb.s_op->statfs(&_dentry, &_kstatfs);],
       ac_cv_linux_statfs_takes_dentry=yes,
       ac_cv_linux_statfs_takes_dentry=no)])
   AC_MSG_RESULT($ac_cv_linux_statfs_takes_dentry)])

commit e05b5937201ec313d2c8fa863f4dacec87ab687d
Author: Marc Dionne <marc.c.dionne@gmail.com>
Date:   Wed Aug 11 18:55:29 2010 -0400

    Linux: switch to evict_inode
    
    In 2.6.36, the delete_inode and clear_inode inode operations
    are replaced by evict_inode.
    Rename our current clear_inode to evict_inode, and add a few
    things that were previously handled by the generic delete_inode.
    
    This is required for 2.6.36.
    
    Reviewed-on: http://gerrit.openafs.org/2544
    Reviewed-by: Derrick Brashear <shadow@dementia.org>
    Tested-by: Derrick Brashear <shadow@dementia.org>
    
    (cherry-picked from commit fb01fbd7cd2d396df8a4605eaad9febc52ef3b61)
    
    Change-Id: I7ad09be8183d2503e89f7f64a1208b1dbb5fef9e
    Reviewed-on: http://gerrit.openafs.org/2552
    Reviewed-by: Derrick Brashear <shadow@dementia.org>
    Tested-by: Derrick Brashear <shadow@dementia.org>

diff --git a/acinclude.m4 b/acinclude.m4
index bbbe938..f94205a 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -757,6 +757,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
 		 LINUX_DEFINES_FOR_EACH_PROCESS
 		 LINUX_DEFINES_PREV_TASK
 		 LINUX_FS_STRUCT_SUPER_HAS_ALLOC_INODE
+		 LINUX_FS_STRUCT_SUPER_HAS_EVICT_INODE
 		 LINUX_FS_STRUCT_SUPER_BLOCK_HAS_S_BDI
 		 LINUX_STRUCT_BDI_HAS_NAME
 	         LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK
@@ -922,6 +923,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
 		 if test "x$ac_cv_linux_fs_struct_super_has_alloc_inode" = "xyes" ; then
 		  AC_DEFINE(STRUCT_SUPER_HAS_ALLOC_INODE, 1, [define if your struct super_operations has alloc_inode])
 		 fi
+		 if test "x$ac_cv_linux_fs_struct_super_has_evict_inode" = "xyes" ; then
+		  AC_DEFINE(STRUCT_SUPER_OPERATIONS_HAS_EVICT_INODE, 1, [define if your struct super_operations has evict_inode])
+		 fi
 		 if test "x$ac_cv_linux_fs_struct_address_space_has_page_lock" = "xyes"; then 
 		  AC_DEFINE(STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK, 1, [define if your struct address_space has page_lock])
 		 fi
diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c
index 49bfbee..e46c3eb 100644
--- a/src/afs/LINUX/osi_vfsops.c
+++ b/src/afs/LINUX/osi_vfsops.c
@@ -342,6 +342,25 @@ afs_destroy_inodecache(void)
 }
 #endif
 
+#if defined(STRUCT_SUPER_OPERATIONS_HAS_EVICT_INODE)
+static void
+afs_evict_inode(struct inode *ip)
+{
+    struct vcache *vcp = VTOAFS(ip);
+
+    if (vcp->vlruq.prev || vcp->vlruq.next)
+	osi_Panic("inode freed while on LRU");
+    if (vcp->hnext)
+	osi_Panic("inode freed while still hashed");
+
+    truncate_inode_pages(&ip->i_data, 0);
+    end_writeback(ip);
+
+#if !defined(STRUCT_SUPER_HAS_ALLOC_INODE)
+    afs_osi_Free(ip->u.generic_ip, sizeof(struct vcache));
+#endif
+}
+#else
 static void
 afs_clear_inode(struct inode *ip)
 {
@@ -356,6 +375,7 @@ afs_clear_inode(struct inode *ip)
     afs_osi_Free(ip->u.generic_ip, sizeof(struct vcache));
 #endif
 }
+#endif
 
 /* afs_put_super
  * Called from unmount to release super_block. */
@@ -456,7 +476,11 @@ struct super_operations afs_sops = {
   .alloc_inode =	afs_alloc_inode,
   .destroy_inode =	afs_destroy_inode,
 #endif
+#if defined(STRUCT_SUPER_OPERATIONS_HAS_EVICT_INODE)
+  .evict_inode =	afs_evict_inode,
+#else
   .clear_inode =	afs_clear_inode,
+#endif
   .put_super =		afs_put_super,
   .statfs =		afs_statfs,
 #if !defined(AFS_LINUX24_ENV)
diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
index 5603b21..66b21e3 100644
--- a/src/cf/linux-test4.m4
+++ b/src/cf/linux-test4.m4
@@ -467,6 +467,18 @@ printk("%p\n", _super.alloc_inode);],
   AC_MSG_RESULT($ac_cv_linux_fs_struct_super_has_alloc_inode)])
 
 
+AC_DEFUN([LINUX_FS_STRUCT_SUPER_HAS_EVICT_INODE], [
+  AC_MSG_CHECKING([for evict_inode in struct super_operations])
+  AC_CACHE_VAL([ac_cv_linux_fs_struct_super_has_evict_inode], [
+    AC_TRY_KBUILD(
+[#include <linux/fs.h>],
+[struct super_operations _super;
+printk("%p\n", _super.evict_inode);],
+      ac_cv_linux_fs_struct_super_has_evict_inode=yes,
+      ac_cv_linux_fs_struct_super_has_evict_inode=no)])
+  AC_MSG_RESULT($ac_cv_linux_fs_struct_super_has_evict_inode)])
+
+
 AC_DEFUN([LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG], [
   AC_MSG_CHECKING([for 3rd argument in posix_lock_file found in new kernels])
   AC_CACHE_VAL([ac_cv_linux_kernel_posix_lock_file_wait_arg], [

commit e2e8881db7757ccac5ce3d5fc5603c40c5b47a43
Author: Marc Dionne <marc.c.dionne@gmail.com>
Date:   Wed Aug 11 17:18:32 2010 -0400

    Linux: use %pI4 if NIPQUAD is not available
    
    The definition of NIPQUAD has been removed from the kernel headers
    in the mainline kernel.  Replace it by using the %pI4 format
    specifier which takes the IP address as a single argument.
    
    There should be no change in the output.
    
    This fix is required for 2.6.36.
    
    Reviewed-on: http://gerrit.openafs.org/2542
    Tested-by: Derrick Brashear <shadow@dementia.org>
    Reviewed-by: Derrick Brashear <shadow@dementia.org>
    
    (cherry-picked from commit d4018b2673e6532543984838290ffb891b970fea)
    
    Change-Id: I49a4f55f71857c5a95df174bf017e27b5bcd0a95
    Reviewed-on: http://gerrit.openafs.org/2551
    Reviewed-by: Derrick Brashear <shadow@dementia.org>
    Tested-by: Derrick Brashear <shadow@dementia.org>

diff --git a/src/afs/LINUX/osi_module.c b/src/afs/LINUX/osi_module.c
index ed9be8a..de8da52 100644
--- a/src/afs/LINUX/osi_module.c
+++ b/src/afs/LINUX/osi_module.c
@@ -134,8 +134,12 @@ static int c_show(struct seq_file *m, void *p)
 		if (!tc->cellHosts[j]) break;
 
 		addr = tc->cellHosts[j]->addr->sa_ip;
+#if defined(NIPQUAD)
 		seq_printf(m, "%u.%u.%u.%u #%u.%u.%u.%u\n",
 			   NIPQUAD(addr), NIPQUAD(addr));
+#else
+		seq_printf(m, "%pI4 #%pI4\n", &addr, &addr);
+#endif
 	}
 
 	return 0;

commit 58e56d080b8d19117b60f04ecb37af0c6dcafc1a
Author: Marc Dionne <marc.c.dionne@gmail.com>
Date:   Wed Aug 11 18:20:59 2010 -0400

    Linux: adapt to truncate sequence changes
    
    As part of changes to the truncate sequence, inode_setattr() no
    longer exists, and all filesystems have to define the setattr op
    so we can assume that it is not NULL.
    
    Introduce a compat inline function afs_inode_setattr that hides
    the tests and the different versions from the main code.
    
    Note that the existing test for the inode_setattr() return type
    will fail, but the value is no longer used in that case.
    
    This is required for 2.6.36
    
    Reviewed-on: http://gerrit.openafs.org/2543
    Reviewed-by: Derrick Brashear <shadow@dementia.org>
    Tested-by: Derrick Brashear <shadow@dementia.org>
    
    (cherry-picked from commit eaf3378f537935f6b9843886b43d)
    
    Change-Id: I1261e1e67d54409276d8b3530f9ec4f879604733
    Reviewed-on: http://gerrit.openafs.org/2550
    Reviewed-by: Derrick Brashear <shadow@dementia.org>
    Tested-by: Derrick Brashear <shadow@dementia.org>

diff --git a/acinclude.m4 b/acinclude.m4
index 984b7ff..bbbe938 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -828,6 +828,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
 		 LINUX_STRUCT_CTL_TABLE_HAS_CTL_NAME
 		 LINUX_HAVE_IGET
 		 LINUX_HAVE_I_SIZE_READ
+		 LINUX_HAVE_INODE_SETATTR
 		 LINUX_FS_STRUCT_NAMEIDATA_HAS_PATH
 	         LINUX_EXPORTS_INIT_MM
                  LINUX_EXPORTS_SYS_CHDIR
diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
index 54b985a..078c6c3 100644
--- a/src/afs/LINUX/osi_compat.h
+++ b/src/afs/LINUX/osi_compat.h
@@ -119,3 +119,23 @@ init_once_func(void * foo) {
 # endif
 #endif
 #endif
+
+static inline int
+afs_inode_setattr(struct osi_file *afile, struct iattr *newattrs) {
+
+    int code = 0;
+    struct inode *inode = OSIFILE_INODE(afile);
+#if !defined(HAVE_LINUX_INODE_SETATTR)
+    code = inode->i_op->setattr(afile->filp->f_dentry, newattrs);
+#elif defined(INODE_SETATTR_NOT_VOID)
+#if defined(AFS_LINUX26_ENV)
+    if (inode->i_op && inode->i_op->setattr)
+	code = inode->i_op->setattr(afile->filp->f_dentry, newattrs);
+    else
+#endif
+	code = inode_setattr(inode, newattrs);
+#else
+    inode_setattr(inode, newattrs);
+#endif
+    return code;
+}
diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c
index 1f9e8cf..1fc583b 100644
--- a/src/afs/LINUX/osi_file.c
+++ b/src/afs/LINUX/osi_file.c
@@ -21,6 +21,7 @@
 #if !defined(HAVE_IGET)
 #include "h/exportfs.h"
 #endif
+#include "osi_compat.h"
 
 int afs_osicred_initialized = 0;
 struct AFS_UCRED afs_osi_cred;
@@ -237,17 +238,7 @@ osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
     lock_kernel();
     code = inode_change_ok(inode, &newattrs);
     if (!code)
-#ifdef INODE_SETATTR_NOT_VOID
-#if defined(AFS_LINUX26_ENV)
-	if (inode->i_op && inode->i_op->setattr)
-	    code = inode->i_op->setattr(afile->filp->f_dentry, &newattrs);
-	else
-#endif
-	    code = inode_setattr(inode, &newattrs);
-#else
-        inode_setattr(inode, &newattrs);
-#endif
-    unlock_kernel();
+	code = afs_inode_setattr(afile, &newattrs);
     if (!code)
 	truncate_inode_pages(&inode->i_data, asize);
 #else
diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
index 3e200b0..5603b21 100644
--- a/src/cf/linux-test4.m4
+++ b/src/cf/linux-test4.m4
@@ -1278,3 +1278,19 @@ _bdi.name = NULL;],
   if test "x$ac_cv_linux_struct_bdi_has_name" = "xyes"; then
     AC_DEFINE([STRUCT_BDI_HAS_NAME], 1, [define if struct backing_dev_info has a name member])
   fi])
+
+AC_DEFUN([LINUX_HAVE_INODE_SETATTR], [
+  AC_MSG_CHECKING([for linux inode_setattr()])
+  AC_CACHE_VAL([ac_cv_linux_inode_setattr], [
+    save_CPPFLAGS="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
+    AC_TRY_KBUILD(
+[#include <linux/fs.h>],
+[inode_setattr(NULL);],
+      ac_cv_linux_inode_setattr=yes,
+      ac_cv_linux_inode_setattr=no)
+    CPPFLAGS="$save_CPPFLAGS"])
+  AC_MSG_RESULT($ac_cv_linux_inode_setattr)
+  if test "x$ac_cv_linux_inode_setattr" = "xyes"; then
+    AC_DEFINE([HAVE_LINUX_INODE_SETATTR], 1, [define if your kernel has inode_setattr()])
+  fi])

commit 58bffd741cdc917f164f19b4621aa2567e6a5b3e
Author: Marc Dionne <marc.c.dionne@gmail.com>
Date:   Fri May 28 17:48:12 2010 -0400

    Linux: 2.6.35 - fsync no longer takes a dentry
    
    In 2.6.35, the fsync file operations drops the dentry argument.
    Add a configure test and cope.
    
    Reviewed-on: http://gerrit.openafs.org/2064
    Reviewed-by: Derrick Brashear <shadow@dementia.org>
    Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
    Tested-by: Derrick Brashear <shadow@dementia.org>
    
    (cherry-picked from commit 4d89ce0a89e9b9e2709e6f6d730f245b5bce744b)
    
    Change-Id: Ifa1f6d2d3c7de03346ba509fab03040ef4f7f26e
    Reviewed-on: http://gerrit.openafs.org/2549
    Reviewed-by: Derrick Brashear <shadow@dementia.org>
    Tested-by: Derrick Brashear <shadow@dementia.org>

diff --git a/acinclude.m4 b/acinclude.m4
index d4a175c..984b7ff 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -781,6 +781,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
 	  	 LINUX_IOP_I_PUT_LINK_TAKES_COOKIE
 	  	 LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA
 	  	 LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T
+		 LINUX_FOP_F_FSYNC_TAKES_DENTRY
 	  	 LINUX_AOP_WRITEBACK_CONTROL
 		 LINUX_FS_STRUCT_FOP_HAS_FLOCK
 		 LINUX_FS_STRUCT_FOP_HAS_SENDFILE
diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
index ceeba94..ebabc72 100644
--- a/src/afs/LINUX/osi_vnodeops.c
+++ b/src/afs/LINUX/osi_vnodeops.c
@@ -447,8 +447,10 @@ afs_linux_release(struct inode *ip, struct file *fp)
 }
 
 static int
-#if defined(AFS_LINUX24_ENV)
+#if defined(AFS_LINUX24_ENV) && defined(FOP_FSYNC_TAKES_DENTRY)
 afs_linux_fsync(struct file *fp, struct dentry *dp, int datasync)
+#elif defined(AFS_LINUX24_ENV)
+afs_linux_fsync(struct file *fp, int datasync)
 #else
 afs_linux_fsync(struct file *fp, struct dentry *dp)
 #endif
diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
index 2677f04..3e200b0 100644
--- a/src/cf/linux-test4.m4
+++ b/src/cf/linux-test4.m4
@@ -929,6 +929,23 @@ fl_owner_t id;
       ac_cv_linux_func_f_flush_takes_fl_owner_t=no)])
   AC_MSG_RESULT($ac_cv_linux_func_f_flush_takes_fl_owner_t)])
 
+AC_DEFUN([LINUX_FOP_F_FSYNC_TAKES_DENTRY], [
+  AC_MSG_CHECKING([whether file_operations.fsync takes a dentry argument])
+  AC_CACHE_VAL([ac_cv_linux_func_f_fsync_takes_dentry], [
+    AC_TRY_KBUILD(
+[#include <linux/fs.h>],
+[struct inode _inode;
+struct file _file;
+struct dentry _d;
+(void)_inode.i_fop->fsync(&_file, &_d, 0);],
+      ac_cv_linux_func_f_fsync_takes_dentry=yes,
+      ac_cv_linux_func_f_fsync_takes_dentry=no)])
+  AC_MSG_RESULT($ac_cv_linux_func_f_fsync_takes_dentry)
+  if test "x$ac_cv_linux_func_f_fsync_takes_dentry" = "xyes"; then
+    AC_DEFINE([FOP_FSYNC_TAKES_DENTRY], 1, [define if your fops.fsync takes an dentry argument])
+  fi
+])
+
 AC_DEFUN([LINUX_HAVE_KMEM_CACHE_T], [
   AC_MSG_CHECKING([whether kmem_cache_t exists])
   AC_CACHE_VAL([ac_cv_linux_have_kmem_cache_t], [