/* We do a blocking lock and immediate unlock before returning, though, so that the lock has a great chance of being cached on this node by the time the VFS calls back to retry the aop. This has a potential to livelock as nodes ping locks back and forth, but that's a risk we're willing to take to avoid the lock inversion simply.  */
int ocfs2_inode_lock_with_page(struct inode *inode, struct buffer_head **ret_bh, int ex, struct page *page)
/* We do a blocking lock and immediate unlock before returning, though, so that the lock has a great chance of being cached on this node by the time the VFS calls back to retry the aop. This has a potential to livelock as nodes ping locks back and forth, but that's a risk we're willing to take to avoid the lock inversion simply.  */
int ocfs2_inode_lock_with_page(struct inode *inode, struct buffer_head **ret_bh, int ex, struct page *page)
{
	int ret;
	ret = ocfs2_inode_lock_full(inode, ret_bh, ex, OCFS2_LOCK_NONBLOCK);
	if (ret == -EAGAIN) {
		unlock_page(page);
		if (ocfs2_inode_lock(inode, ret_bh, ex) == 0)
			ocfs2_inode_unlock(inode, ex);
		ret = AOP_TRUNCATED_PAGE;
	}
	return ret;
}