summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2017-06-27 17:17:24 +0800
committerIlya Dryomov <idryomov@gmail.com>2017-07-07 17:25:13 +0200
commit4b9f2042fd2a9da7e6c7b4dd49eff19dc3754e4f (patch)
tree7856299e8f18a048896874a063a9e40131957f7a
parent62a65f36d016fff32179acdbfcb8b2d8d9e54757 (diff)
downloadop-kernel-dev-4b9f2042fd2a9da7e6c7b4dd49eff19dc3754e4f.zip
op-kernel-dev-4b9f2042fd2a9da7e6c7b4dd49eff19dc3754e4f.tar.gz
ceph: avoid accessing freeing inode in ceph_check_delayed_caps()
Signed-off-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r--fs/ceph/caps.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index f555245..7007ae2 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -3809,6 +3809,7 @@ bad:
*/
void ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
{
+ struct inode *inode;
struct ceph_inode_info *ci;
int flags = CHECK_CAPS_NODELAY;
@@ -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);
}
OpenPOWER on IntegriCloud