提交 11ea8eda 编写于 作者: S Sage Weil

ceph: fix page invalidation deadlock

We occasionally want to make a best-effort attempt to invalidate cache
pages without fear of blocking.  If this fails, we fall back to an async
invalidate in another thread.

Use invalidate_mapping_pages instead of invalidate_inode_page2, as that
will skip locked pages, and not deadlock.
Signed-off-by: NSage Weil <sage@newdream.net>
上级 039934b8
......@@ -1440,7 +1440,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
dout("check_caps trying to invalidate on %p\n", inode);
spin_unlock(&inode->i_lock);
ret = invalidate_inode_pages2(&inode->i_data);
ret = invalidate_mapping_pages(&inode->i_data, 0, -1);
spin_lock(&inode->i_lock);
if (ret == 0 && invalidating_gen == ci->i_rdcache_gen) {
/* success. */
......@@ -2180,7 +2180,7 @@ static int handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
spin_unlock(&inode->i_lock);
tried_invalidate = 1;
ret = invalidate_inode_pages2(&inode->i_data);
ret = invalidate_mapping_pages(&inode->i_data, 0, -1);
spin_lock(&inode->i_lock);
if (ret < 0) {
/* there were locked pages.. invalidate later
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册