Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocfs2: trylock in ocfs2_readpage()

Similarly to the page lock / cluster lock inversion in ocfs2_readpage, we
can deadlock on ip_alloc_sem. We can down_read_trylock() instead and just
return AOP_TRUNCATED_PAGE if the operation fails.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>

+5 -1
+5 -1
fs/ocfs2/aops.c
··· 222 222 goto out; 223 223 } 224 224 225 - down_read(&OCFS2_I(inode)->ip_alloc_sem); 225 + if (down_read_trylock(&OCFS2_I(inode)->ip_alloc_sem) == 0) { 226 + ret = AOP_TRUNCATED_PAGE; 227 + goto out_meta_unlock; 228 + } 226 229 227 230 /* 228 231 * i_size might have just been updated as we grabed the meta lock. We ··· 261 258 ocfs2_data_unlock(inode, 0); 262 259 out_alloc: 263 260 up_read(&OCFS2_I(inode)->ip_alloc_sem); 261 + out_meta_unlock: 264 262 ocfs2_meta_unlock(inode, 0); 265 263 out: 266 264 if (unlock)