linux/fs/ext4
Jiaying Zhang 8c0bec2151 ext4: remove i_mutex lock in ext4_evict_inode to fix lockdep complaining
The i_mutex lock and flush_completed_IO() added by commit 2581fdc810
in ext4_evict_inode() causes lockdep complaining about potential
deadlock in several places.  In most/all of these LOCKDEP complaints
it looks like it's a false positive, since many of the potential
circular locking cases can't take place by the time the
ext4_evict_inode() is called; but since at the very least it may mask
real problems, we need to address this.

This change removes the flush_completed_IO() and i_mutex lock in
ext4_evict_inode().  Instead, we take a different approach to resolve
the software lockup that commit 2581fdc810 intends to fix.  Rather
than having ext4-dio-unwritten thread wait for grabing the i_mutex
lock of an inode, we use mutex_trylock() instead, and simply requeue
the work item if we fail to grab the inode's i_mutex lock.

This should speed up work queue processing in general and also
prevents the following deadlock scenario: During page fault,
shrink_icache_memory is called that in turn evicts another inode B.
Inode B has some pending io_end work so it calls ext4_ioend_wait()
that waits for inode B's i_ioend_count to become zero.  However, inode
B's ioend work was queued behind some of inode A's ioend work on the
same cpu's ext4-dio-unwritten workqueue.  As the ext4-dio-unwritten
thread on that cpu is processing inode A's ioend work, it tries to
grab inode A's i_mutex lock.  Since the i_mutex lock of inode A is
still hold before the page fault happened, we enter a deadlock.

Signed-off-by: Jiaying Zhang <jiayingz@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-08-31 11:50:51 -04:00
..
Kconfig
Makefile
acl.c switch posix_acl_equiv_mode() to umode_t * 2011-08-01 02:10:06 -04:00
acl.h
balloc.c
bitmap.c
block_validity.c
dir.c
ext4.h ext4: remove i_mutex lock in ext4_evict_inode to fix lockdep complaining 2011-08-31 11:50:51 -04:00
ext4_extents.h
ext4_jbd2.c
ext4_jbd2.h ext4: Fix ext4_should_writeback_data() for no-journal mode 2011-08-13 11:25:18 -04:00
extents.c
file.c
fsync.c Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 2011-08-01 13:56:03 -10:00
hash.c
ialloc.c ext4: use the correct error exit path in ext4_init_inode_table() 2011-08-01 06:32:19 -04:00
indirect.c ext4: flush any pending end_io requests before DIO reads w/dioread_nolock 2011-08-19 19:13:32 -04:00
inode.c ext4: remove i_mutex lock in ext4_evict_inode to fix lockdep complaining 2011-08-31 11:50:51 -04:00
ioctl.c
mballoc.c ext4: prevent memory leaks from ext4_mb_init_backend() on error path 2011-08-01 17:41:46 -04:00
mballoc.h
migrate.c
mmp.c
move_extent.c
namei.c ext4: Properly count journal credits for long symlinks 2011-08-11 17:23:40 -07:00
page-io.c ext4: remove i_mutex lock in ext4_evict_inode to fix lockdep complaining 2011-08-31 11:50:51 -04:00
resize.c ext4: use ext4_kvzalloc()/ext4_kvmalloc() for s_group_desc and s_group_info 2011-08-01 08:45:38 -04:00
super.c ext4: call ext4_ioend_wait and ext4_flush_completed_IO in ext4_evict_inode 2011-08-13 12:17:13 -04:00
symlink.c
truncate.h
xattr.c
xattr.h
xattr_security.c
xattr_trusted.c
xattr_user.c