kernel-ark/fs/gfs2
Benjamin Marzinski 7a9f53b3c1 [GFS2] Alternate gfs2_iget to avoid looking up inodes being freed
There is a possible deadlock between two processes on the same node, where one
process is deleting an inode, and another process is looking for allocated but
unused inodes to delete in order to create more space.

process A does an iput() on inode X, and it's i_count drops to 0. This causes
iput_final() to be called, which puts an inode into state I_FREEING at
generic_delete_inode(). There no point between when iput_final() is called, and
when I_FREEING is set where GFS2 could acquire any glocks. Once I_FREEING is
set, no other process on that node can successfully look up that inode until
the delete finishes.

process B locks the the resource group for the same inode in get_local_rgrp(),
which is called by gfs2_inplace_reserve_i()

process A tries to lock the resource group for the inode in
gfs2_dinode_dealloc(), but it's already locked by process B

process B waits in find_inode for the inode to have the I_FREEING state cleared.

Deadlock.

This patch solves the problem by adding an alternative to gfs2_iget(),
gfs2_iget_skip(), that simply skips any inodes that are in the I_FREEING
state.o The alternate test function is just like the original one, except that
it fails if the inode is being freed, and sets a skipped flag. The alternate
set function is just like the original, except that it fails if the skipped
flag is set. Only try_rgrp_unlink() calls gfs2_iget_skip() instead of
gfs2_iget().

Signed-off-by: Benjamin E. Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2007-10-10 08:56:29 +01:00
..
locking [GFS2] GFS2: chmod hung - fix race in thread creation 2007-10-10 08:56:22 +01:00
acl.c Introduce is_owner_or_cap() to wrap CAP_FOWNER use with fsuid check 2007-07-17 12:00:03 -07:00
acl.h [GFS2] Remove gfs2_check_acl() 2006-11-30 10:37:32 -05:00
bmap.c [GFS2] Fix ordering of dirty/journal for ordered buffer unstuffing 2007-10-10 08:56:05 +01:00
bmap.h [GFS2] Fix bmap to map extents properly 2006-10-20 09:13:40 -04:00
daemon.c [GFS2] Reduce number of gfs2_scand processes to one 2007-10-10 08:55:08 +01:00
daemon.h [GFS2] Reduce number of gfs2_scand processes to one 2007-10-10 08:55:08 +01:00
dir.c [GFS2] Alternate gfs2_iget to avoid looking up inodes being freed 2007-10-10 08:56:29 +01:00
dir.h [GFS2] Clean up inode number handling 2007-07-09 08:22:24 +01:00
eaops.c [GFS2] mark struct *_operations const 2007-10-10 08:55:03 +01:00
eaops.h [GFS2] mark struct *_operations const 2007-10-10 08:55:03 +01:00
eattr.c [GFS2] Add nanosecond timestamp feature 2007-07-09 08:23:12 +01:00
eattr.h [GFS2] gfs2 misc endianness annotations 2006-11-30 10:33:46 -05:00
gfs2.h [GFS2] Update copyright, tidy up incore.h 2006-09-01 11:05:15 -04:00
glock.c [GFS2] Move inode deletion out of blocking_cb 2007-10-10 08:56:17 +01:00
glock.h [GFS2] flocks from same process trip kernel BUG at fs/gfs2/glock.c:1118! 2007-10-10 08:56:14 +01:00
glops.c [GFS2] Clean up gfs2_trans_add_revoke() 2007-10-10 08:56:12 +01:00
glops.h [GFS2] Make headers compile on their own 2006-09-05 10:39:21 -04:00
incore.h [GFS2] Clean up journaled data writing 2007-10-10 08:56:24 +01:00
inode.c [GFS2] Alternate gfs2_iget to avoid looking up inodes being freed 2007-10-10 08:56:29 +01:00
inode.h [GFS2] Alternate gfs2_iget to avoid looking up inodes being freed 2007-10-10 08:56:29 +01:00
Kconfig [DLM/GFS2] indent help text 2007-02-05 13:38:20 -05:00
lm.c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
lm.h [GFS2] Use void * instead of typedef for locking module interface 2006-09-08 10:17:58 -04:00
locking.c [GFS2] Export lm_interface to kernel headers 2006-09-19 08:45:18 -04:00
log.c [GFS2] Clean up journaled data writing 2007-10-10 08:56:24 +01:00
log.h [GFS2] Clean up journaled data writing 2007-10-10 08:56:24 +01:00
lops.c [GFS2] Clean up journaled data writing 2007-10-10 08:56:24 +01:00
lops.h [GFS2] assertion failure after writing to journaled file, umount 2007-07-09 08:23:47 +01:00
main.c [GFS2] Reduce number of gfs2_scand processes to one 2007-10-10 08:55:08 +01:00
Makefile [GFS2] Fix sign problem in quota/statfs and cleanup _host structures 2007-07-09 08:23:10 +01:00
meta_io.c [GFS2] Data corruption fix 2007-10-10 08:56:26 +01:00
meta_io.h [GFS2] Clean up journaled data writing 2007-10-10 08:56:24 +01:00
mount.c [GFS2] Add NULL entry to token table 2007-10-10 08:55:34 +01:00
mount.h [GFS2] Make headers compile on their own 2006-09-05 10:39:21 -04:00
ops_address.c [GFS2] Data corruption fix 2007-10-10 08:56:26 +01:00
ops_address.h [GFS2] Addendum patch 2 for gfs2_grow 2007-07-09 08:22:19 +01:00
ops_dentry.c [GFS2] Clean up inode number handling 2007-07-09 08:22:24 +01:00
ops_dentry.h [GFS2] Make headers compile on their own 2006-09-05 10:39:21 -04:00
ops_export.c [GFS2] Alternate gfs2_iget to avoid looking up inodes being freed 2007-10-10 08:56:29 +01:00
ops_file.c [GFS2] flocks from same process trip kernel BUG at fs/gfs2/glock.c:1118! 2007-10-10 08:56:14 +01:00
ops_file.h [GFS2] Only set inode flags when required 2006-11-30 10:34:45 -05:00
ops_fstype.c [GFS2] Alternate gfs2_iget to avoid looking up inodes being freed 2007-10-10 08:56:29 +01:00
ops_fstype.h [GFS2] Fix sign problem in quota/statfs and cleanup _host structures 2007-07-09 08:23:10 +01:00
ops_inode.c [GFS2] Clean up journaled data writing 2007-10-10 08:56:24 +01:00
ops_inode.h [PATCH] mark struct inode_operations const 2 2007-02-12 09:48:46 -08:00
ops_super.c [GFS2] Clean up journaled data writing 2007-10-10 08:56:24 +01:00
ops_super.h [PATCH] Mark struct super_operations const 2007-02-12 09:48:47 -08:00
ops_vm.c mm: fault feedback #2 2007-07-19 10:04:41 -07:00
ops_vm.h [GFS2] Make headers compile on their own 2006-09-05 10:39:21 -04:00
quota.c [GFS2] Fix quota do_list operation hang 2007-10-10 08:55:27 +01:00
quota.h [GFS2] Make headers compile on their own 2006-09-05 10:39:21 -04:00
recovery.c [GFS2] Ensure journal file cache is flushed after recovery 2007-10-10 08:55:12 +01:00
recovery.h [GFS2] split and annotate gfs2_log_head 2006-11-30 10:33:14 -05:00
rgrp.c [GFS2] Alternate gfs2_iget to avoid looking up inodes being freed 2007-10-10 08:56:29 +01:00
rgrp.h [GFS2] Addendum patch 2 for gfs2_grow 2007-07-09 08:22:19 +01:00
super.c [GFS2] Reduce number of gfs2_scand processes to one 2007-10-10 08:55:08 +01:00
super.h [GFS2] Fix sign problem in quota/statfs and cleanup _host structures 2007-07-09 08:23:10 +01:00
sys.c [GFS2] Reduce number of gfs2_scand processes to one 2007-10-10 08:55:08 +01:00
sys.h [GFS2] Make headers compile on their own 2006-09-05 10:39:21 -04:00
trans.c [GFS2] Clean up gfs2_trans_add_revoke() 2007-10-10 08:56:12 +01:00
trans.h [GFS2] Clean up gfs2_trans_add_revoke() 2007-10-10 08:56:12 +01:00
util.c [GFS2] Fix sign problem in quota/statfs and cleanup _host structures 2007-07-09 08:23:10 +01:00
util.h Merge master.kernel.org:/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw 2006-12-07 09:13:20 -08:00