]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: Fix Direct I/O locking
authorJan Kara <jack@suse.cz>
Sun, 10 Feb 2008 06:08:38 +0000 (01:08 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 10 Feb 2008 06:08:38 +0000 (01:08 -0500)
commit3e76c03f6a5a6b595e68edf442dafc9faf94ebed
tree8201f2fc124d34098776799f8cec89a8f8b4f8bb
parentf38d04504f7aaec9bfbb3a7468e607239e23ee4c
ext4: Fix Direct I/O locking

We cannot start transaction in ext4_direct_IO() and just let it last
during the whole write because dio_get_page() acquires mmap_sem which
ranks above transaction start (e.g. because we have dependency chain
mmap_sem->PageLock->journal_start, or because we update atime while
holding mmap_sem) and thus deadlocks could happen. We solve the problem
by starting a transaction separately for each ext4_get_block() call.

We *could* have a problem that we allocate a block and before its data
are written out the machine crashes and thus we expose stale data. But
that does not happen because for hole-filling generic code falls back to
buffered writes and for file extension, we add inode to orphan list and
thus in case of crash, journal replay will truncate inode back to the
original size.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/inode.c