|
@@ -2486,6 +2486,15 @@ int ocfs2_inode_lock_with_page(struct inode *inode,
|
|
ret = ocfs2_inode_lock_full(inode, ret_bh, ex, OCFS2_LOCK_NONBLOCK);
|
|
ret = ocfs2_inode_lock_full(inode, ret_bh, ex, OCFS2_LOCK_NONBLOCK);
|
|
if (ret == -EAGAIN) {
|
|
if (ret == -EAGAIN) {
|
|
unlock_page(page);
|
|
unlock_page(page);
|
|
|
|
+ /*
|
|
|
|
+ * If we can't get inode lock immediately, we should not return
|
|
|
|
+ * directly here, since this will lead to a softlockup problem.
|
|
|
|
+ * The method is to get a blocking lock and immediately unlock
|
|
|
|
+ * before returning, this can avoid CPU resource waste due to
|
|
|
|
+ * lots of retries, and benefits fairness in getting lock.
|
|
|
|
+ */
|
|
|
|
+ if (ocfs2_inode_lock(inode, ret_bh, ex) == 0)
|
|
|
|
+ ocfs2_inode_unlock(inode, ex);
|
|
ret = AOP_TRUNCATED_PAGE;
|
|
ret = AOP_TRUNCATED_PAGE;
|
|
}
|
|
}
|
|
|
|
|