deadlocks caused by ext3/reiser dirty_inode calls duringdo_mmap_pgoff

From: Chris Mason
Date: Mon Jun 21 2004 - 11:59:32 EST


Hello everyone,

do_mmap_pgoff is called with a write lock on mmap_sem, and can trigger
calls to generic_file_mmap, which calls file_accessed to update the
atime on the file.

For reiserfs, this might start a transaction, which might have to wait
for the currently running transaction to finish. It looks like ext3 may
do the same thing, but I'm not 100% sure on that.

If the currently running transaction happens to by running
copy_from_user, like we do during write calls, it might be trying to get
a hold of a read lock on the mmap sem while trying to hand page faults.

This is effectively a lock inversion problem, and deadlocks. There's a
few choices:

1) don't start a transaction during atime updates.
2) don't update the atime until after we drop the mmap_sem.

Anyone have other ideas?

-chris


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/