Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fs: icache RCU free inodes

RCU free the struct inode. This will allow:

- Subsequent store-free path walking patch. The inode must be consulted for
  permissions when walking, so an RCU inode reference is a must.
- sb_inode_list_lock to be moved inside i_lock because sb list walkers who want
  to take i_lock no longer need to take sb_inode_list_lock to walk the list in
  the first place. This will simplify and optimize locking.
- Could remove some nested trylock loops in dcache code
- Could potentially simplify things a bit in VM land. Do not need to take the
  page lock to follow page->mapping.

The downsides of this is the performance cost of using RCU. In a simple
creat/unlink microbenchmark, performance drops by about 10% due to inability to
reuse cache-hot slab objects. As iterations increase and RCU freeing starts
kicking over, this increases to about 20%.

In cases where inode lifetimes are longer (ie. many inodes may be allocated
during the average life span of a single inode), a lot of this cache reuse is
not applicable, so the regression caused by this patch is smaller.

The cache-hot regression could largely be avoided by using SLAB_DESTROY_BY_RCU,
however this adds some complexity to list walking and store-free path walking,
so I prefer to implement this at a later date, if it is shown to be a win in
real situations. I haven't found a regression in any non-micro benchmark so I
doubt it will be a problem.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
  • Loading branch information...
commit fa0d7e3de6d6fc5004ad9dea0dd6b286af8f03e9 1 parent 77812a1
Nick Piggin authored

Showing 60 changed files with 490 additions and 68 deletions. Show diff stats Hide diff stats

  1. +14 0 Documentation/filesystems/porting
  2. +8 2 arch/powerpc/platforms/cell/spufs/inode.c
  3. +8 1 drivers/staging/pohmelfs/inode.c
  4. +8 1 drivers/staging/smbfs/inode.c
  5. +8 1 fs/9p/vfs_inode.c
  6. +8 1 fs/adfs/super.c
  7. +8 1 fs/affs/super.c
  8. +9 1 fs/afs/super.c
  9. +8 2 fs/befs/linuxvfs.c
  10. +8 1 fs/bfs/inode.c
  11. +8 1 fs/block_dev.c
  12. +8 1 fs/btrfs/inode.c
  13. +10 1 fs/ceph/inode.c
  14. +8 1 fs/cifs/cifsfs.c
  15. +8 1 fs/coda/inode.c
  16. +11 1 fs/ecryptfs/super.c
  17. +8 1 fs/efs/super.c
  18. +8 1 fs/exofs/super.c
  19. +8 1 fs/ext2/super.c
  20. +8 1 fs/ext3/super.c
  21. +8 1 fs/ext4/super.c
  22. +8 1 fs/fat/inode.c
  23. +8 1 fs/freevxfs/vxfs_inode.c
  24. +8 1 fs/fuse/inode.c
  25. +8 1 fs/gfs2/super.c
  26. +8 1 fs/hfs/super.c
  27. +9 1 fs/hfsplus/super.c
  28. +8 1 fs/hostfs/hostfs_kern.c
  29. +8 1 fs/hpfs/super.c
  30. +8 1 fs/hppfs/hppfs.c
  31. +8 1 fs/hugetlbfs/inode.c
  32. +9 1 fs/inode.c
  33. +8 1 fs/isofs/inode.c
  34. +8 1 fs/jffs2/super.c
  35. +9 1 fs/jfs/super.c
  36. +8 1 fs/logfs/inode.c
  37. +8 1 fs/minix/inode.c
  38. +8 1 fs/ncpfs/inode.c
  39. +8 1 fs/nfs/inode.c
  40. +9 1 fs/nilfs2/super.c
  41. +8 1 fs/ntfs/inode.c
  42. +8 1 fs/ocfs2/dlmfs/dlmfs.c
  43. +8 1 fs/ocfs2/super.c
  44. +8 1 fs/openpromfs/inode.c
  45. +8 1 fs/proc/inode.c
  46. +8 1 fs/qnx4/inode.c
  47. +8 1 fs/reiserfs/super.c
  48. +8 1 fs/romfs/super.c
  49. +8 1 fs/squashfs/super.c
  50. +8 1 fs/sysv/inode.c
  51. +9 1 fs/ubifs/super.c
  52. +8 1 fs/udf/super.c
  53. +8 1 fs/ufs/super.c
  54. +12 1 fs/xfs/xfs_iget.c
  55. +4 1 include/linux/fs.h
  56. +0 1  include/linux/net.h
  57. +8 1 ipc/mqueue.c
  58. +8 1 mm/shmem.c
  59. +8 8 net/socket.c
  60. +9 1 net/sunrpc/rpc_pipe.c
14 Documentation/filesystems/porting
@@ -346,3 +346,17 @@ look at examples of other filesystems) for guidance.
346 346 for details of what locks to replace dcache_lock with in order to protect
347 347 particular things. Most of the time, a filesystem only needs ->d_lock, which
348 348 protects *all* the dcache state of a given dentry.
  349 +
  350 +--
  351 +[mandatory]
  352 +
  353 + Filesystems must RCU-free their inodes, if they can have been accessed
  354 +via rcu-walk path walk (basically, if the file can have had a path name in the
  355 +vfs namespace).
  356 +
  357 + i_dentry and i_rcu share storage in a union, and the vfs expects
  358 +i_dentry to be reinitialized before it is freed, so an:
  359 +
  360 + INIT_LIST_HEAD(&inode->i_dentry);
  361 +
  362 +must be done in the RCU callback.
10 arch/powerpc/platforms/cell/spufs/inode.c
@@ -71,12 +71,18 @@ spufs_alloc_inode(struct super_block *sb)
71 71 return &ei->vfs_inode;
72 72 }
73 73
74   -static void
75   -spufs_destroy_inode(struct inode *inode)
  74 +static void spufs_i_callback(struct rcu_head *head)
76 75 {
  76 + struct inode *inode = container_of(head, struct inode, i_rcu);
  77 + INIT_LIST_HEAD(&inode->i_dentry);
77 78 kmem_cache_free(spufs_inode_cache, SPUFS_I(inode));
78 79 }
79 80
  81 +static void spufs_destroy_inode(struct inode *inode)
  82 +{
  83 + call_rcu(&inode->i_rcu, spufs_i_callback);
  84 +}
  85 +
80 86 static void
81 87 spufs_init_once(void *p)
82 88 {
9 drivers/staging/pohmelfs/inode.c
@@ -826,6 +826,13 @@ const struct address_space_operations pohmelfs_aops = {
826 826 .set_page_dirty = __set_page_dirty_nobuffers,
827 827 };
828 828
  829 +static void pohmelfs_i_callback(struct rcu_head *head)
  830 +{
  831 + struct inode *inode = container_of(head, struct inode, i_rcu);
  832 + INIT_LIST_HEAD(&inode->i_dentry);
  833 + kmem_cache_free(pohmelfs_inode_cache, POHMELFS_I(inode));
  834 +}
  835 +
829 836 /*
830 837 * ->detroy_inode() callback. Deletes inode from the caches
831 838 * and frees private data.
@@ -842,8 +849,8 @@ static void pohmelfs_destroy_inode(struct inode *inode)
842 849
843 850 dprintk("%s: pi: %p, inode: %p, ino: %llu.\n",
844 851 __func__, pi, &pi->vfs_inode, pi->ino);
845   - kmem_cache_free(pohmelfs_inode_cache, pi);
846 852 atomic_long_dec(&psb->total_inodes);
  853 + call_rcu(&inode->i_rcu, pohmelfs_i_callback);
847 854 }
848 855
849 856 /*
9 drivers/staging/smbfs/inode.c
@@ -62,11 +62,18 @@ static struct inode *smb_alloc_inode(struct super_block *sb)
62 62 return &ei->vfs_inode;
63 63 }
64 64
65   -static void smb_destroy_inode(struct inode *inode)
  65 +static void smb_i_callback(struct rcu_head *head)
66 66 {
  67 + struct inode *inode = container_of(head, struct inode, i_rcu);
  68 + INIT_LIST_HEAD(&inode->i_dentry);
67 69 kmem_cache_free(smb_inode_cachep, SMB_I(inode));
68 70 }
69 71
  72 +static void smb_destroy_inode(struct inode *inode)
  73 +{
  74 + call_rcu(&inode->i_rcu, smb_i_callback);
  75 +}
  76 +
70 77 static void init_once(void *foo)
71 78 {
72 79 struct smb_inode_info *ei = (struct smb_inode_info *) foo;
9 fs/9p/vfs_inode.c
@@ -237,10 +237,17 @@ struct inode *v9fs_alloc_inode(struct super_block *sb)
237 237 *
238 238 */
239 239
240   -void v9fs_destroy_inode(struct inode *inode)
  240 +static void v9fs_i_callback(struct rcu_head *head)
241 241 {
  242 + struct inode *inode = container_of(head, struct inode, i_rcu);
  243 + INIT_LIST_HEAD(&inode->i_dentry);
242 244 kmem_cache_free(vcookie_cache, v9fs_inode2cookie(inode));
243 245 }
  246 +
  247 +void v9fs_destroy_inode(struct inode *inode)
  248 +{
  249 + call_rcu(&inode->i_rcu, v9fs_i_callback);
  250 +}
244 251 #endif
245 252
246 253 /**
9 fs/adfs/super.c
@@ -240,11 +240,18 @@ static struct inode *adfs_alloc_inode(struct super_block *sb)
240 240 return &ei->vfs_inode;
241 241 }
242 242
243   -static void adfs_destroy_inode(struct inode *inode)
  243 +static void adfs_i_callback(struct rcu_head *head)
244 244 {
  245 + struct inode *inode = container_of(head, struct inode, i_rcu);
  246 + INIT_LIST_HEAD(&inode->i_dentry);
245 247 kmem_cache_free(adfs_inode_cachep, ADFS_I(inode));
246 248 }
247 249
  250 +static void adfs_destroy_inode(struct inode *inode)
  251 +{
  252 + call_rcu(&inode->i_rcu, adfs_i_callback);
  253 +}
  254 +
248 255 static void init_once(void *foo)
249 256 {
250 257 struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;
9 fs/affs/super.c
@@ -95,11 +95,18 @@ static struct inode *affs_alloc_inode(struct super_block *sb)
95 95 return &i->vfs_inode;
96 96 }
97 97
98   -static void affs_destroy_inode(struct inode *inode)
  98 +static void affs_i_callback(struct rcu_head *head)
99 99 {
  100 + struct inode *inode = container_of(head, struct inode, i_rcu);
  101 + INIT_LIST_HEAD(&inode->i_dentry);
100 102 kmem_cache_free(affs_inode_cachep, AFFS_I(inode));
101 103 }
102 104
  105 +static void affs_destroy_inode(struct inode *inode)
  106 +{
  107 + call_rcu(&inode->i_rcu, affs_i_callback);
  108 +}
  109 +
103 110 static void init_once(void *foo)
104 111 {
105 112 struct affs_inode_info *ei = (struct affs_inode_info *) foo;
10 fs/afs/super.c
@@ -498,6 +498,14 @@ static struct inode *afs_alloc_inode(struct super_block *sb)
498 498 return &vnode->vfs_inode;
499 499 }
500 500
  501 +static void afs_i_callback(struct rcu_head *head)
  502 +{
  503 + struct inode *inode = container_of(head, struct inode, i_rcu);
  504 + struct afs_vnode *vnode = AFS_FS_I(inode);
  505 + INIT_LIST_HEAD(&inode->i_dentry);
  506 + kmem_cache_free(afs_inode_cachep, vnode);
  507 +}
  508 +
501 509 /*
502 510 * destroy an AFS inode struct
503 511 */
@@ -511,7 +519,7 @@ static void afs_destroy_inode(struct inode *inode)
511 519
512 520 ASSERTCMP(vnode->server, ==, NULL);
513 521
514   - kmem_cache_free(afs_inode_cachep, vnode);
  522 + call_rcu(&inode->i_rcu, afs_i_callback);
515 523 atomic_dec(&afs_count_active_inodes);
516 524 }
517 525
10 fs/befs/linuxvfs.c
@@ -284,12 +284,18 @@ befs_alloc_inode(struct super_block *sb)
284 284 return &bi->vfs_inode;
285 285 }
286 286
287   -static void
288   -befs_destroy_inode(struct inode *inode)
  287 +static void befs_i_callback(struct rcu_head *head)
289 288 {
  289 + struct inode *inode = container_of(head, struct inode, i_rcu);
  290 + INIT_LIST_HEAD(&inode->i_dentry);
290 291 kmem_cache_free(befs_inode_cachep, BEFS_I(inode));
291 292 }
292 293
  294 +static void befs_destroy_inode(struct inode *inode)
  295 +{
  296 + call_rcu(&inode->i_rcu, befs_i_callback);
  297 +}
  298 +
293 299 static void init_once(void *foo)
294 300 {
295 301 struct befs_inode_info *bi = (struct befs_inode_info *) foo;
9 fs/bfs/inode.c
@@ -248,11 +248,18 @@ static struct inode *bfs_alloc_inode(struct super_block *sb)
248 248 return &bi->vfs_inode;
249 249 }
250 250
251   -static void bfs_destroy_inode(struct inode *inode)
  251 +static void bfs_i_callback(struct rcu_head *head)
252 252 {
  253 + struct inode *inode = container_of(head, struct inode, i_rcu);
  254 + INIT_LIST_HEAD(&inode->i_dentry);
253 255 kmem_cache_free(bfs_inode_cachep, BFS_I(inode));
254 256 }
255 257
  258 +static void bfs_destroy_inode(struct inode *inode)
  259 +{
  260 + call_rcu(&inode->i_rcu, bfs_i_callback);
  261 +}
  262 +
256 263 static void init_once(void *foo)
257 264 {
258 265 struct bfs_inode_info *bi = foo;
9 fs/block_dev.c
@@ -409,13 +409,20 @@ static struct inode *bdev_alloc_inode(struct super_block *sb)
409 409 return &ei->vfs_inode;
410 410 }
411 411
412   -static void bdev_destroy_inode(struct inode *inode)
  412 +static void bdev_i_callback(struct rcu_head *head)
413 413 {
  414 + struct inode *inode = container_of(head, struct inode, i_rcu);
414 415 struct bdev_inode *bdi = BDEV_I(inode);
415 416
  417 + INIT_LIST_HEAD(&inode->i_dentry);
416 418 kmem_cache_free(bdev_cachep, bdi);
417 419 }
418 420
  421 +static void bdev_destroy_inode(struct inode *inode)
  422 +{
  423 + call_rcu(&inode->i_rcu, bdev_i_callback);
  424 +}
  425 +
419 426 static void init_once(void *foo)
420 427 {
421 428 struct bdev_inode *ei = (struct bdev_inode *) foo;
9 fs/btrfs/inode.c
@@ -6495,6 +6495,13 @@ struct inode *btrfs_alloc_inode(struct super_block *sb)
6495 6495 return inode;
6496 6496 }
6497 6497
  6498 +static void btrfs_i_callback(struct rcu_head *head)
  6499 +{
  6500 + struct inode *inode = container_of(head, struct inode, i_rcu);
  6501 + INIT_LIST_HEAD(&inode->i_dentry);
  6502 + kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
  6503 +}
  6504 +
6498 6505 void btrfs_destroy_inode(struct inode *inode)
6499 6506 {
6500 6507 struct btrfs_ordered_extent *ordered;
@@ -6564,7 +6571,7 @@ void btrfs_destroy_inode(struct inode *inode)
6564 6571 inode_tree_del(inode);
6565 6572 btrfs_drop_extent_cache(inode, 0, (u64)-1, 0);
6566 6573 free:
6567   - kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
  6574 + call_rcu(&inode->i_rcu, btrfs_i_callback);
6568 6575 }
6569 6576
6570 6577 int btrfs_drop_inode(struct inode *inode)
11 fs/ceph/inode.c
@@ -368,6 +368,15 @@ struct inode *ceph_alloc_inode(struct super_block *sb)
368 368 return &ci->vfs_inode;
369 369 }
370 370
  371 +static void ceph_i_callback(struct rcu_head *head)
  372 +{
  373 + struct inode *inode = container_of(head, struct inode, i_rcu);
  374 + struct ceph_inode_info *ci = ceph_inode(inode);
  375 +
  376 + INIT_LIST_HEAD(&inode->i_dentry);
  377 + kmem_cache_free(ceph_inode_cachep, ci);
  378 +}
  379 +
371 380 void ceph_destroy_inode(struct inode *inode)
372 381 {
373 382 struct ceph_inode_info *ci = ceph_inode(inode);
@@ -407,7 +416,7 @@ void ceph_destroy_inode(struct inode *inode)
407 416 if (ci->i_xattrs.prealloc_blob)
408 417 ceph_buffer_put(ci->i_xattrs.prealloc_blob);
409 418
410   - kmem_cache_free(ceph_inode_cachep, ci);
  419 + call_rcu(&inode->i_rcu, ceph_i_callback);
411 420 }
412 421
413 422
9 fs/cifs/cifsfs.c
@@ -334,10 +334,17 @@ cifs_alloc_inode(struct super_block *sb)
334 334 return &cifs_inode->vfs_inode;
335 335 }
336 336
  337 +static void cifs_i_callback(struct rcu_head *head)
  338 +{
  339 + struct inode *inode = container_of(head, struct inode, i_rcu);
  340 + INIT_LIST_HEAD(&inode->i_dentry);
  341 + kmem_cache_free(cifs_inode_cachep, CIFS_I(inode));
  342 +}
  343 +
337 344 static void
338 345 cifs_destroy_inode(struct inode *inode)
339 346 {
340   - kmem_cache_free(cifs_inode_cachep, CIFS_I(inode));
  347 + call_rcu(&inode->i_rcu, cifs_i_callback);
341 348 }
342 349
343 350 static void
9 fs/coda/inode.c
@@ -56,11 +56,18 @@ static struct inode *coda_alloc_inode(struct super_block *sb)
56 56 return &ei->vfs_inode;
57 57 }
58 58
59   -static void coda_destroy_inode(struct inode *inode)
  59 +static void coda_i_callback(struct rcu_head *head)
60 60 {
  61 + struct inode *inode = container_of(head, struct inode, i_rcu);
  62 + INIT_LIST_HEAD(&inode->i_dentry);
61 63 kmem_cache_free(coda_inode_cachep, ITOC(inode));
62 64 }
63 65
  66 +static void coda_destroy_inode(struct inode *inode)
  67 +{
  68 + call_rcu(&inode->i_rcu, coda_i_callback);
  69 +}
  70 +
64 71 static void init_once(void *foo)
65 72 {
66 73 struct coda_inode_info *ei = (struct coda_inode_info *) foo;
12 fs/ecryptfs/super.c
@@ -62,6 +62,16 @@ static struct inode *ecryptfs_alloc_inode(struct super_block *sb)
62 62 return inode;
63 63 }
64 64
  65 +static void ecryptfs_i_callback(struct rcu_head *head)
  66 +{
  67 + struct inode *inode = container_of(head, struct inode, i_rcu);
  68 + struct ecryptfs_inode_info *inode_info;
  69 + inode_info = ecryptfs_inode_to_private(inode);
  70 +
  71 + INIT_LIST_HEAD(&inode->i_dentry);
  72 + kmem_cache_free(ecryptfs_inode_info_cache, inode_info);
  73 +}
  74 +
65 75 /**
66 76 * ecryptfs_destroy_inode
67 77 * @inode: The ecryptfs inode
@@ -88,7 +98,7 @@ static void ecryptfs_destroy_inode(struct inode *inode)
88 98 }
89 99 }
90 100 ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat);
91   - kmem_cache_free(ecryptfs_inode_info_cache, inode_info);
  101 + call_rcu(&inode->i_rcu, ecryptfs_i_callback);
92 102 }
93 103
94 104 /**
9 fs/efs/super.c
@@ -65,11 +65,18 @@ static struct inode *efs_alloc_inode(struct super_block *sb)
65 65 return &ei->vfs_inode;
66 66 }
67 67
68   -static void efs_destroy_inode(struct inode *inode)
  68 +static void efs_i_callback(struct rcu_head *head)
69 69 {
  70 + struct inode *inode = container_of(head, struct inode, i_rcu);
  71 + INIT_LIST_HEAD(&inode->i_dentry);
70 72 kmem_cache_free(efs_inode_cachep, INODE_INFO(inode));
71 73 }
72 74
  75 +static void efs_destroy_inode(struct inode *inode)
  76 +{
  77 + call_rcu(&inode->i_rcu, efs_i_callback);
  78 +}
  79 +
73 80 static void init_once(void *foo)
74 81 {
75 82 struct efs_inode_info *ei = (struct efs_inode_info *) foo;
9 fs/exofs/super.c
@@ -150,12 +150,19 @@ static struct inode *exofs_alloc_inode(struct super_block *sb)
150 150 return &oi->vfs_inode;
151 151 }
152 152
  153 +static void exofs_i_callback(struct rcu_head *head)
  154 +{
  155 + struct inode *inode = container_of(head, struct inode, i_rcu);
  156 + INIT_LIST_HEAD(&inode->i_dentry);
  157 + kmem_cache_free(exofs_inode_cachep, exofs_i(inode));
  158 +}
  159 +
153 160 /*
154 161 * Remove an inode from the cache
155 162 */
156 163 static void exofs_destroy_inode(struct inode *inode)
157 164 {
158   - kmem_cache_free(exofs_inode_cachep, exofs_i(inode));
  165 + call_rcu(&inode->i_rcu, exofs_i_callback);
159 166 }
160 167
161 168 /*
9 fs/ext2/super.c
@@ -161,11 +161,18 @@ static struct inode *ext2_alloc_inode(struct super_block *sb)
161 161 return &ei->vfs_inode;
162 162 }
163 163
164   -static void ext2_destroy_inode(struct inode *inode)
  164 +static void ext2_i_callback(struct rcu_head *head)
165 165 {
  166 + struct inode *inode = container_of(head, struct inode, i_rcu);
  167 + INIT_LIST_HEAD(&inode->i_dentry);
166 168 kmem_cache_free(ext2_inode_cachep, EXT2_I(inode));
167 169 }
168 170
  171 +static void ext2_destroy_inode(struct inode *inode)
  172 +{
  173 + call_rcu(&inode->i_rcu, ext2_i_callback);
  174 +}
  175 +
169 176 static void init_once(void *foo)
170 177 {
171 178 struct ext2_inode_info *ei = (struct ext2_inode_info *) foo;
9 fs/ext3/super.c
@@ -479,6 +479,13 @@ static struct inode *ext3_alloc_inode(struct super_block *sb)
479 479 return &ei->vfs_inode;
480 480 }
481 481
  482 +static void ext3_i_callback(struct rcu_head *head)
  483 +{
  484 + struct inode *inode = container_of(head, struct inode, i_rcu);
  485 + INIT_LIST_HEAD(&inode->i_dentry);
  486 + kmem_cache_free(ext3_inode_cachep, EXT3_I(inode));
  487 +}
  488 +
482 489 static void ext3_destroy_inode(struct inode *inode)
483 490 {
484 491 if (!list_empty(&(EXT3_I(inode)->i_orphan))) {
@@ -489,7 +496,7 @@ static void ext3_destroy_inode(struct inode *inode)
489 496 false);
490 497 dump_stack();
491 498 }
492   - kmem_cache_free(ext3_inode_cachep, EXT3_I(inode));
  499 + call_rcu(&inode->i_rcu, ext3_i_callback);
493 500 }
494 501
495 502 static void init_once(void *foo)
9 fs/ext4/super.c
@@ -841,6 +841,13 @@ static int ext4_drop_inode(struct inode *inode)
841 841 return drop;
842 842 }
843 843
  844 +static void ext4_i_callback(struct rcu_head *head)
  845 +{
  846 + struct inode *inode = container_of(head, struct inode, i_rcu);
  847 + INIT_LIST_HEAD(&inode->i_dentry);
  848 + kmem_cache_free(ext4_inode_cachep, EXT4_I(inode));
  849 +}
  850 +
844 851 static void ext4_destroy_inode(struct inode *inode)
845 852 {
846 853 ext4_ioend_wait(inode);
@@ -853,7 +860,7 @@ static void ext4_destroy_inode(struct inode *inode)
853 860 true);
854 861 dump_stack();
855 862 }
856   - kmem_cache_free(ext4_inode_cachep, EXT4_I(inode));
  863 + call_rcu(&inode->i_rcu, ext4_i_callback);
857 864 }
858 865
859 866 static void init_once(void *foo)
9 fs/fat/inode.c
@@ -514,11 +514,18 @@ static struct inode *fat_alloc_inode(struct super_block *sb)
514 514 return &ei->vfs_inode;
515 515 }
516 516
517   -static void fat_destroy_inode(struct inode *inode)
  517 +static void fat_i_callback(struct rcu_head *head)
518 518 {
  519 + struct inode *inode = container_of(head, struct inode, i_rcu);
  520 + INIT_LIST_HEAD(&inode->i_dentry);
519 521 kmem_cache_free(fat_inode_cachep, MSDOS_I(inode));
520 522 }
521 523
  524 +static void fat_destroy_inode(struct inode *inode)
  525 +{
  526 + call_rcu(&inode->i_rcu, fat_i_callback);
  527 +}
  528 +
522 529 static void init_once(void *foo)
523 530 {
524 531 struct msdos_inode_info *ei = (struct msdos_inode_info *)foo;
9 fs/freevxfs/vxfs_inode.c
@@ -337,6 +337,13 @@ vxfs_iget(struct super_block *sbp, ino_t ino)
337 337 return ip;
338 338 }
339 339
  340 +static void vxfs_i_callback(struct rcu_head *head)
  341 +{
  342 + struct inode *inode = container_of(head, struct inode, i_rcu);
  343 + INIT_LIST_HEAD(&inode->i_dentry);
  344 + kmem_cache_free(vxfs_inode_cachep, inode->i_private);
  345 +}
  346 +
340 347 /**
341 348 * vxfs_evict_inode - remove inode from main memory
342 349 * @ip: inode to discard.
@@ -350,5 +357,5 @@ vxfs_evict_inode(struct inode *ip)
350 357 {
351 358 truncate_inode_pages(&ip->i_data, 0);
352 359 end_writeback(ip);
353   - kmem_cache_free(vxfs_inode_cachep, ip->i_private);
  360 + call_rcu(&ip->i_rcu, vxfs_i_callback);
354 361 }
9 fs/fuse/inode.c
@@ -99,6 +99,13 @@ static struct inode *fuse_alloc_inode(struct super_block *sb)
99 99 return inode;
100 100 }
101 101
  102 +static void fuse_i_callback(struct rcu_head *head)
  103 +{
  104 + struct inode *inode = container_of(head, struct inode, i_rcu);
  105 + INIT_LIST_HEAD(&inode->i_dentry);
  106 + kmem_cache_free(fuse_inode_cachep, inode);
  107 +}
  108 +
102 109 static void fuse_destroy_inode(struct inode *inode)
103 110 {
104 111 struct fuse_inode *fi = get_fuse_inode(inode);
@@ -106,7 +113,7 @@ static void fuse_destroy_inode(struct inode *inode)
106 113 BUG_ON(!list_empty(&fi->queued_writes));
107 114 if (fi->forget_req)
108 115 fuse_request_free(fi->forget_req);
109   - kmem_cache_free(fuse_inode_cachep, inode);
  116 + call_rcu(&inode->i_rcu, fuse_i_callback);
110 117 }
111 118
112 119 void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req,
9 fs/gfs2/super.c
@@ -1405,11 +1405,18 @@ static struct inode *gfs2_alloc_inode(struct super_block *sb)
1405 1405 return &ip->i_inode;
1406 1406 }
1407 1407
1408   -static void gfs2_destroy_inode(struct inode *inode)
  1408 +static void gfs2_i_callback(struct rcu_head *head)
1409 1409 {
  1410 + struct inode *inode = container_of(head, struct inode, i_rcu);
  1411 + INIT_LIST_HEAD(&inode->i_dentry);
1410 1412 kmem_cache_free(gfs2_inode_cachep, inode);
1411 1413 }
1412 1414
  1415 +static void gfs2_destroy_inode(struct inode *inode)
  1416 +{
  1417 + call_rcu(&inode->i_rcu, gfs2_i_callback);
  1418 +}
  1419 +
1413 1420 const struct super_operations gfs2_super_ops = {
1414 1421 .alloc_inode = gfs2_alloc_inode,
1415 1422 .destroy_inode = gfs2_destroy_inode,
9 fs/hfs/super.c
@@ -167,11 +167,18 @@ static struct inode *hfs_alloc_inode(struct super_block *sb)
167 167 return i ? &i->vfs_inode : NULL;
168 168 }
169 169
170   -static void hfs_destroy_inode(struct inode *inode)
  170 +static void hfs_i_callback(struct rcu_head *head)
171 171 {
  172 + struct inode *inode = container_of(head, struct inode, i_rcu);
  173 + INIT_LIST_HEAD(&inode->i_dentry);
172 174 kmem_cache_free(hfs_inode_cachep, HFS_I(inode));
173 175 }
174 176
  177 +static void hfs_destroy_inode(struct inode *inode)
  178 +{
  179 + call_rcu(&inode->i_rcu, hfs_i_callback);
  180 +}
  181 +
175 182 static const struct super_operations hfs_super_operations = {
176 183 .alloc_inode = hfs_alloc_inode,
177 184 .destroy_inode = hfs_destroy_inode,
10 fs/hfsplus/super.c
@@ -488,11 +488,19 @@ static struct inode *hfsplus_alloc_inode(struct super_block *sb)
488 488 return i ? &i->vfs_inode : NULL;
489 489 }
490 490
491   -static void hfsplus_destroy_inode(struct inode *inode)
  491 +static void hfsplus_i_callback(struct rcu_head *head)
492 492 {
  493 + struct inode *inode = container_of(head, struct inode, i_rcu);
  494 +
  495 + INIT_LIST_HEAD(&inode->i_dentry);
493 496 kmem_cache_free(hfsplus_inode_cachep, HFSPLUS_I(inode));
494 497 }
495 498
  499 +static void hfsplus_destroy_inode(struct inode *inode)
  500 +{
  501 + call_rcu(&inode->i_rcu, hfsplus_i_callback);
  502 +}
  503 +
496 504 #define HFSPLUS_INODE_SIZE sizeof(struct hfsplus_inode_info)
497 505
498 506 static struct dentry *hfsplus_mount(struct file_system_type *fs_type,
9 fs/hostfs/hostfs_kern.c
@@ -247,11 +247,18 @@ static void hostfs_evict_inode(struct inode *inode)
247 247 }
248 248 }
249 249
250   -static void hostfs_destroy_inode(struct inode *inode)
  250 +static void hostfs_i_callback(struct rcu_head *head)
251 251 {
  252 + struct inode *inode = container_of(head, struct inode, i_rcu);
  253 + INIT_LIST_HEAD(&inode->i_dentry);
252 254 kfree(HOSTFS_I(inode));
253 255 }
254 256
  257 +static void hostfs_destroy_inode(struct inode *inode)
  258 +{
  259 + call_rcu(&inode->i_rcu, hostfs_i_callback);
  260 +}
  261 +
255 262 static int hostfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
256 263 {
257 264 const char *root_path = vfs->mnt_sb->s_fs_info;
9 fs/hpfs/super.c
@@ -177,11 +177,18 @@ static struct inode *hpfs_alloc_inode(struct super_block *sb)
177 177 return &ei->vfs_inode;
178 178 }
179 179
180   -static void hpfs_destroy_inode(struct inode *inode)
  180 +static void hpfs_i_callback(struct rcu_head *head)
181 181 {
  182 + struct inode *inode = container_of(head, struct inode, i_rcu);
  183 + INIT_LIST_HEAD(&inode->i_dentry);
182 184 kmem_cache_free(hpfs_inode_cachep, hpfs_i(inode));
183 185 }
184 186
  187 +static void hpfs_destroy_inode(struct inode *inode)
  188 +{
  189 + call_rcu(&inode->i_rcu, hpfs_i_callback);
  190 +}
  191 +
185 192 static void init_once(void *foo)
186 193 {
187 194 struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo;
9 fs/hppfs/hppfs.c
@@ -632,11 +632,18 @@ void hppfs_evict_inode(struct inode *ino)
632 632 mntput(ino->i_sb->s_fs_info);
633 633 }
634 634
635   -static void hppfs_destroy_inode(struct inode *inode)
  635 +static void hppfs_i_callback(struct rcu_head *head)
636 636 {
  637 + struct inode *inode = container_of(head, struct inode, i_rcu);
  638 + INIT_LIST_HEAD(&inode->i_dentry);
637 639 kfree(HPPFS_I(inode));
638 640 }
639 641
  642 +static void hppfs_destroy_inode(struct inode *inode)
  643 +{
  644 + call_rcu(&inode->i_rcu, hppfs_i_callback);
  645 +}
  646 +
640 647 static const struct super_operations hppfs_sbops = {
641 648 .alloc_inode = hppfs_alloc_inode,
642 649 .destroy_inode = hppfs_destroy_inode,
9 fs/hugetlbfs/inode.c
@@ -663,11 +663,18 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb)
663 663 return &p->vfs_inode;
664 664 }
665 665
  666 +static void hugetlbfs_i_callback(struct rcu_head *head)
  667 +{
  668 + struct inode *inode = container_of(head, struct inode, i_rcu);
  669 + INIT_LIST_HEAD(&inode->i_dentry);
  670 + kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode));
  671 +}
  672 +
666 673 static void hugetlbfs_destroy_inode(struct inode *inode)
667 674 {
668 675 hugetlbfs_inc_free_inodes(HUGETLBFS_SB(inode->i_sb));
669 676 mpol_free_shared_policy(&HUGETLBFS_I(inode)->policy);
670   - kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode));
  677 + call_rcu(&inode->i_rcu, hugetlbfs_i_callback);
671 678 }
672 679
673 680 static const struct address_space_operations hugetlbfs_aops = {
10 fs/inode.c
@@ -272,6 +272,13 @@ void __destroy_inode(struct inode *inode)
272 272 }
273 273 EXPORT_SYMBOL(__destroy_inode);
274 274
  275 +static void i_callback(struct rcu_head *head)
  276 +{
  277 + struct inode *inode = container_of(head, struct inode, i_rcu);
  278 + INIT_LIST_HEAD(&inode->i_dentry);
  279 + kmem_cache_free(inode_cachep, inode);
  280 +}
  281 +
275 282 static void destroy_inode(struct inode *inode)
276 283 {
277 284 BUG_ON(!list_empty(&inode->i_lru));
@@ -279,7 +286,7 @@ static void destroy_inode(struct inode *inode)
279 286 if (inode->i_sb->s_op->destroy_inode)
280 287 inode->i_sb->s_op->destroy_inode(inode);
281 288 else
282   - kmem_cache_free(inode_cachep, (inode));
  289 + call_rcu(&inode->i_rcu, i_callback);
283 290 }
284 291
285 292 /*
@@ -432,6 +439,7 @@ void end_writeback(struct inode *inode)
432 439 BUG_ON(!(inode->i_state & I_FREEING));
433 440 BUG_ON(inode->i_state & I_CLEAR);
434 441 inode_sync_wait(inode);
  442 + /* don't need i_lock here, no concurrent mods to i_state */
435 443 inode->i_state = I_FREEING | I_CLEAR;
436 444 }
437 445 EXPORT_SYMBOL(end_writeback);
9 fs/isofs/inode.c
@@ -81,11 +81,18 @@ static struct inode *isofs_alloc_inode(struct super_block *sb)
81 81 return &ei->vfs_inode;
82 82 }
83 83
84   -static void isofs_destroy_inode(struct inode *inode)
  84 +static void isofs_i_callback(struct rcu_head *head)
85 85 {
  86 + struct inode *inode = container_of(head, struct inode, i_rcu);
  87 + INIT_LIST_HEAD(&inode->i_dentry);
86 88 kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode));
87 89 }
88 90
  91 +static void isofs_destroy_inode(struct inode *inode)
  92 +{
  93 + call_rcu(&inode->i_rcu, isofs_i_callback);
  94 +}
  95 +
89 96 static void init_once(void *foo)
90 97 {
91 98 struct iso_inode_info *ei = foo;
9 fs/jffs2/super.c
@@ -40,11 +40,18 @@ static struct inode *jffs2_alloc_inode(struct super_block *sb)
40 40 return &f->vfs_inode;
41 41 }
42 42
43   -static void jffs2_destroy_inode(struct inode *inode)
  43 +static void jffs2_i_callback(struct rcu_head *head)
44 44 {
  45 + struct inode *inode = container_of(head, struct inode, i_rcu);
  46 + INIT_LIST_HEAD(&inode->i_dentry);
45 47 kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode));
46 48 }
47 49
  50 +static void jffs2_destroy_inode(struct inode *inode)
  51 +{
  52 + call_rcu(&inode->i_rcu, jffs2_i_callback);
  53 +}
  54 +
48 55 static void jffs2_i_init_once(void *foo)
49 56 {
50 57 struct jffs2_inode_info *f = foo;
10 fs/jfs/super.c
@@ -115,6 +115,14 @@ static struct inode *jfs_alloc_inode(struct super_block *sb)
115 115 return &jfs_inode->vfs_inode;
116 116 }
117 117
  118 +static void jfs_i_callback(struct rcu_head *head)
  119 +{
  120 + struct inode *inode = container_of(head, struct inode, i_rcu);
  121 + struct jfs_inode_info *ji = JFS_IP(inode);
  122 + INIT_LIST_HEAD(&inode->i_dentry);
  123 + kmem_cache_free(jfs_inode_cachep, ji);
  124 +}
  125 +
118 126 static void jfs_destroy_inode(struct inode *inode)
119 127 {
120 128 struct jfs_inode_info *ji = JFS_IP(inode);
@@ -128,7 +136,7 @@ static void jfs_destroy_inode(struct inode *inode)
128 136 ji->active_ag = -1;
129 137 }
130 138 spin_unlock_irq(&ji->ag_lock);
131   - kmem_cache_free(jfs_inode_cachep, ji);
  139 + call_rcu(&inode->i_rcu, jfs_i_callback);
132 140 }
133 141
134 142 static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf)
9 fs/logfs/inode.c
@@ -141,13 +141,20 @@ struct inode *logfs_safe_iget(struct super_block *sb, ino_t ino, int *is_cached)
141 141 return __logfs_iget(sb, ino);
142 142 }
143 143
  144 +static void logfs_i_callback(struct rcu_head *head)
  145 +{
  146 + struct inode *inode = container_of(head, struct inode, i_rcu);
  147 + INIT_LIST_HEAD(&inode->i_dentry);
  148 + kmem_cache_free(logfs_inode_cache, logfs_inode(inode));
  149 +}
  150 +
144 151 static void __logfs_destroy_inode(struct inode *inode)
145 152 {
146 153 struct logfs_inode *li = logfs_inode(inode);
147 154
148 155 BUG_ON(li->li_block);
149 156 list_del(&li->li_freeing_list);
150   - kmem_cache_free(logfs_inode_cache, li);
  157 + call_rcu(&inode->i_rcu, logfs_i_callback);
151 158 }
152 159
153 160 static void logfs_destroy_inode(struct inode *inode)
9 fs/minix/inode.c
@@ -68,11 +68,18 @@ static struct inode *minix_alloc_inode(struct super_block *sb)
68 68 return &ei->vfs_inode;
69 69 }
70 70
71   -static void minix_destroy_inode(struct inode *inode)
  71 +static void minix_i_callback(struct rcu_head *head)
72 72 {
  73 + struct inode *inode = container_of(head, struct inode, i_rcu);
  74 + INIT_LIST_HEAD(&inode->i_dentry);
73 75 kmem_cache_free(minix_inode_cachep, minix_i(inode));
74 76 }
75 77
  78 +static void minix_destroy_inode(struct inode *inode)
  79 +{
  80 + call_rcu(&inode->i_rcu, minix_i_callback);
  81 +}
  82 +
76 83 static void init_once(void *foo)
77 84 {
78 85 struct minix_inode_info *ei = (struct minix_inode_info *) foo;
9 fs/ncpfs/inode.c
@@ -58,11 +58,18 @@ static struct inode *ncp_alloc_inode(struct super_block *sb)
58 58 return &ei->vfs_inode;
59 59 }
60 60
61   -static void ncp_destroy_inode(struct inode *inode)
  61 +static void ncp_i_callback(struct rcu_head *head)
62 62 {
  63 + struct inode *inode = container_of(head, struct inode, i_rcu);
  64 + INIT_LIST_HEAD(&inode->i_dentry);
63 65 kmem_cache_free(ncp_inode_cachep, NCP_FINFO(inode));
64 66 }
65 67
  68 +static void ncp_destroy_inode(struct inode *inode)
  69 +{
  70 + call_rcu(&inode->i_rcu, ncp_i_callback);
  71 +}
  72 +
66 73 static void init_once(void *foo)
67 74 {
68 75 struct ncp_inode_info *ei = (struct ncp_inode_info *) foo;
9 fs/nfs/inode.c
@@ -1438,11 +1438,18 @@ struct inode *nfs_alloc_inode(struct super_block *sb)
1438 1438 return &nfsi->vfs_inode;
1439 1439 }
1440 1440
1441   -void nfs_destroy_inode(struct inode *inode)
  1441 +static void nfs_i_callback(struct rcu_head *head)
1442 1442 {
  1443 + struct inode *inode = container_of(head, struct inode, i_rcu);
  1444 + INIT_LIST_HEAD(&inode->i_dentry);
1443 1445 kmem_cache_free(nfs_inode_cachep, NFS_I(inode));
1444 1446 }
1445 1447
  1448 +void nfs_destroy_inode(struct inode *inode)
  1449 +{
  1450 + call_rcu(&inode->i_rcu, nfs_i_callback);
  1451 +}
  1452 +
1446 1453 static inline void nfs4_init_once(struct nfs_inode *nfsi)
1447 1454 {
1448 1455 #ifdef CONFIG_NFS_V4
10 fs/nilfs2/super.c
@@ -162,10 +162,13 @@ struct inode *nilfs_alloc_inode(struct super_block *sb)
162 162 return &ii->vfs_inode;
163 163 }
164 164
165   -void nilfs_destroy_inode(struct inode *inode)
  165 +static void nilfs_i_callback(struct rcu_head *head)
166 166 {
  167 + struct inode *inode = container_of(head, struct inode, i_rcu);
167 168 struct nilfs_mdt_info *mdi = NILFS_MDT(inode);
168 169
  170 + INIT_LIST_HEAD(&inode->i_dentry);
  171 +
169 172 if (mdi) {
170 173 kfree(mdi->mi_bgl); /* kfree(NULL) is safe */
171 174 kfree(mdi);
@@ -173,6 +176,11 @@ void nilfs_destroy_inode(struct inode *inode)
173 176 kmem_cache_free(nilfs_inode_cachep, NILFS_I(inode));
174 177 }
175 178
  179 +void nilfs_destroy_inode(struct inode *inode)
  180 +{
  181 + call_rcu(&inode->i_rcu, nilfs_i_callback);
  182 +}
  183 +
176 184 static int nilfs_sync_super(struct nilfs_sb_info *sbi, int flag)
177 185 {
178 186 struct the_nilfs *nilfs = sbi->s_nilfs;
9 fs/ntfs/inode.c
@@ -332,6 +332,13 @@ struct inode *ntfs_alloc_big_inode(struct super_block *sb)
332 332 return NULL;
333 333 }
334 334
  335 +static void ntfs_i_callback(struct rcu_head *head)
  336 +{
  337 + struct inode *inode = container_of(head, struct inode, i_rcu);
  338 + INIT_LIST_HEAD(&inode->i_dentry);
  339 + kmem_cache_free(ntfs_big_inode_cache, NTFS_I(inode));
  340 +}
  341 +
335 342 void ntfs_destroy_big_inode(struct inode *inode)
336 343 {
337 344 ntfs_inode *ni = NTFS_I(inode);
@@ -340,7 +347,7 @@ void ntfs_destroy_big_inode(struct inode *inode)
340 347 BUG_ON(ni->page);
341 348 if (!atomic_dec_and_test(&ni->count))
342 349 BUG();
343   - kmem_cache_free(ntfs_big_inode_cache, NTFS_I(inode));
  350 + call_rcu(&inode->i_rcu, ntfs_i_callback);
344 351 }
345 352
346 353 static inline ntfs_inode *ntfs_alloc_extent_inode(void)
9 fs/ocfs2/dlmfs/dlmfs.c
@@ -351,11 +351,18 @@ static struct inode *dlmfs_alloc_inode(struct super_block *sb)
351 351 return &ip->ip_vfs_inode;
352 352 }
353 353
354   -static void dlmfs_destroy_inode(struct inode *inode)
  354 +static void dlmfs_i_callback(struct rcu_head *head)
355 355 {
  356 + struct inode *inode = container_of(head, struct inode, i_rcu);
  357 + INIT_LIST_HEAD(&inode->i_dentry);
356 358 kmem_cache_free(dlmfs_inode_cache, DLMFS_I(inode));
357 359 }
358 360
  361 +static void dlmfs_destroy_inode(struct inode *inode)
  362 +{
  363 + call_rcu(&inode->i_rcu, dlmfs_i_callback);
  364 +}
  365 +
359 366 static void dlmfs_evict_inode(struct inode *inode)
360 367 {
361 368 int status;
9 fs/ocfs2/super.c
@@ -569,11 +569,18 @@ static struct inode *ocfs2_alloc_inode(struct super_block *sb)
569 569 return &oi->vfs_inode;
570 570 }
571 571
572   -static void ocfs2_destroy_inode(struct inode *inode)
  572 +static void ocfs2_i_callback(struct rcu_head *head)
573 573 {
  574 + struct inode *inode = container_of(head, struct inode, i_rcu);
  575 + INIT_LIST_HEAD(&inode->i_dentry);
574 576 kmem_cache_free(ocfs2_inode_cachep, OCFS2_I(inode));
575 577 }
576 578
  579 +static void ocfs2_destroy_inode(struct inode *inode)
  580 +{
  581 + call_rcu(&inode->i_rcu, ocfs2_i_callback);
  582 +}
  583 +
577 584 static unsigned long long ocfs2_max_file_offset(unsigned int bbits,
578 585 unsigned int cbits)
579 586 {
9 fs/openpromfs/inode.c
@@ -343,11 +343,18 @@ static struct inode *openprom_alloc_inode(struct super_block *sb)
343 343 return &oi->vfs_inode;
344 344 }
345 345
346   -static void openprom_destroy_inode(struct inode *inode)
  346 +static void openprom_i_callback(struct rcu_head *head)
347 347 {
  348 + struct inode *inode = container_of(head, struct inode, i_rcu);
  349 + INIT_LIST_HEAD(&inode->i_dentry);
348 350 kmem_cache_free(op_inode_cachep, OP_I(inode));
349 351 }
350 352
  353 +static void openprom_destroy_inode(struct inode *inode)
  354 +{
  355 + call_rcu(&inode->i_rcu, openprom_i_callback);
  356 +}
  357 +
351 358 static struct inode *openprom_iget(struct super_block *sb, ino_t ino)
352 359 {
353 360 struct inode *inode;
9 fs/proc/inode.c
@@ -65,11 +65,18 @@ static struct inode *proc_alloc_inode(struct super_block *sb)
65 65 return inode;
66 66 }
67 67
68   -static void proc_destroy_inode(struct inode *inode)
  68 +static void proc_i_callback(struct rcu_head *head)
69 69 {
  70 + struct inode *inode = container_of(head, struct inode, i_rcu);
  71 + INIT_LIST_HEAD(&inode->i_dentry);
70 72 kmem_cache_free(proc_inode_cachep, PROC_I(inode));
71 73 }
72 74
  75 +static void proc_destroy_inode(struct inode *inode)
  76 +{
  77 + call_rcu(&inode->i_rcu, proc_i_callback);
  78 +}
  79 +
73 80 static void init_once(void *foo)
74 81 {
75 82 struct proc_inode *ei = (struct proc_inode *) foo;
9 fs/qnx4/inode.c
@@ -425,11 +425,18 @@ static struct inode *qnx4_alloc_inode(struct super_block *sb)
425 425 return &ei->vfs_inode;
426 426 }
427 427
428   -static void qnx4_destroy_inode(struct inode *inode)
  428 +static void qnx4_i_callback(struct rcu_head *head)
429 429 {
  430 + struct inode *inode = container_of(head, struct inode, i_rcu);
  431 + INIT_LIST_HEAD(&inode->i_dentry);
430 432 kmem_cache_free(qnx4_inode_cachep, qnx4_i(inode));
431 433 }
432 434
  435 +static void qnx4_destroy_inode(struct inode *inode)
  436 +{
  437 + call_rcu(&inode->i_rcu, qnx4_i_callback);
  438 +}
  439 +
433 440 static void init_once(void *foo)
434 441 {
435 442 struct qnx4_inode_info *ei = (struct qnx4_inode_info *) foo;
9 fs/reiserfs/super.c
@@ -529,11 +529,18 @@ static struct inode *reiserfs_alloc_inode(struct super_block *sb)
529 529 return &ei->vfs_inode;
530 530 }
531 531
532   -static void reiserfs_destroy_inode(struct inode *inode)
  532 +static void reiserfs_i_callback(struct rcu_head *head)
533 533 {
  534 + struct inode *inode = container_of(head, struct inode, i_rcu);
  535 + INIT_LIST_HEAD(&inode->i_dentry);
534 536 kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode));
535 537 }
536 538
  539 +static void reiserfs_destroy_inode(struct inode *inode)
  540 +{
  541 + call_rcu(&inode->i_rcu, reiserfs_i_callback);
  542 +}
  543 +
537 544 static void init_once(void *foo)
538 545 {
539 546 struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo;
9 fs/romfs/super.c
@@ -400,11 +400,18 @@ static struct inode *romfs_alloc_inode(struct super_block *sb)
400 400 /*
401 401 * return a spent inode to the slab cache
402 402 */
403   -static void romfs_destroy_inode(struct inode *inode)
  403 +static void romfs_i_callback(struct rcu_head *head)
404 404 {
  405 + struct inode *inode = container_of(head, struct inode, i_rcu);
  406 + INIT_LIST_HEAD(&inode->i_dentry);
405 407 kmem_cache_free(romfs_inode_cachep, ROMFS_I(inode));
406 408 }
407 409
  410 +static void romfs_destroy_inode(struct inode *inode)
  411 +{
  412 + call_rcu(&inode->i_rcu, romfs_i_callback);
  413 +}
  414 +
408 415 /*
409 416 * get filesystem statistics
410 417 */
9 fs/squashfs/super.c
@@ -440,11 +440,18 @@ static struct inode *squashfs_alloc_inode(struct super_block *sb)
440 440 }
441 441
442 442
443   -static void squashfs_destroy_inode(struct inode *inode)
  443 +static void squashfs_i_callback(struct rcu_head *head)
444 444 {
  445 + struct inode *inode = container_of(head, struct inode, i_rcu);
  446 + INIT_LIST_HEAD(&inode->i_dentry);
445 447 kmem_cache_free(squashfs_inode_cachep, squashfs_i(inode));
446 448 }
447 449
  450 +static void squashfs_destroy_inode(struct inode *inode)
  451 +{
  452 + call_rcu(&inode->i_rcu, squashfs_i_callback);
  453 +}
  454 +
448 455
449 456 static struct file_system_type squashfs_fs_type = {
450 457 .owner = THIS_MODULE,
9 fs/sysv/inode.c
@@ -333,11 +333,18 @@ static struct inode *sysv_alloc_inode(struct super_block *sb)
333 333 return &si->vfs_inode;
334 334 }
335 335
336   -static void sysv_destroy_inode(struct inode *inode)
  336 +static void sysv_i_callback(struct rcu_head *head)
337 337 {
  338 + struct inode *inode = container_of(head, struct inode, i_rcu);
  339 + INIT_LIST_HEAD(&inode->i_dentry);
338 340 kmem_cache_free(sysv_inode_cachep, SYSV_I(inode));
339 341 }
340 342
  343 +static void sysv_destroy_inode(struct inode *inode)
  344 +{
  345 + call_rcu(&inode->i_rcu, sysv_i_callback);
  346 +}
  347 +
341 348 static void init_once(void *p)
342 349 {
343 350 struct sysv_inode_info *si = (struct sysv_inode_info *)p;
10 fs/ubifs/super.c
@@ -272,12 +272,20 @@ static struct inode *ubifs_alloc_inode(struct super_block *sb)
272 272 return &ui->vfs_inode;
273 273 };
274 274
  275 +static void ubifs_i_callback(struct rcu_head *head)
  276 +{
  277