Skip to content

Commit

Permalink
ceph: avoid accessing freeing inode in ceph_check_delayed_caps()
Browse files Browse the repository at this point in the history
Signed-off-by: "Yan, Zheng" <[email protected]>
Signed-off-by: Ilya Dryomov <[email protected]>
  • Loading branch information
ukernel authored and idryomov committed Jul 7, 2017
1 parent 62a65f3 commit 4b9f204
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions fs/ceph/caps.c
Original file line number Diff line number Diff line change
Expand Up @@ -3809,6 +3809,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
*/
void ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
{
struct inode *inode;
struct ceph_inode_info *ci;
int flags = CHECK_CAPS_NODELAY;

Expand All @@ -3824,9 +3825,15 @@ void ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
time_before(jiffies, ci->i_hold_caps_max))
break;
list_del_init(&ci->i_cap_delay_list);

inode = igrab(&ci->vfs_inode);
spin_unlock(&mdsc->cap_delay_lock);
dout("check_delayed_caps on %p\n", &ci->vfs_inode);
ceph_check_caps(ci, flags, NULL);

if (inode) {
dout("check_delayed_caps on %p\n", inode);
ceph_check_caps(ci, flags, NULL);
iput(inode);
}
}
spin_unlock(&mdsc->cap_delay_lock);
}
Expand Down

0 comments on commit 4b9f204

Please sign in to comment.