]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ocfs2: Avoid livelock in ocfs2_readpage()
authorJan Kara <jack@suse.cz>
Mon, 15 Aug 2011 17:09:33 +0000 (10:09 -0700)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Thu, 22 Mar 2012 00:17:23 +0000 (17:17 -0700)
commitdd5266692a3303704f2f0031420c79d64ff34510
treeefcacea8d948c285749cf79688f74a3b9fbb040f
parentf69db2ed9d7c6eb53197b2d302f0a420adce4da2
ocfs2: Avoid livelock in ocfs2_readpage()

[Pulled before push to mainline]

When someone writes to an inode, readers accessing the same inode via
ocfs2_readpage() just busyloop trying to get ip_alloc_sem because
do_generic_file_read() looks up the page again and retries ->readpage()
when previous attempt failed with AOP_TRUNCATED_PAGE. When there are enough
readers, they can occupy all CPUs and in non-preempt kernel the system is
deadlocked because writer holding ip_alloc_sem is never run to release the
semaphore. Fix the problem by making reader block on ip_alloc_sem to break
the busy loop.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <jlbec@evilplan.org>
fs/ocfs2/aops.c