]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
ceph: avoid accessing freeing inode in ceph_check_delayed_caps()
authorYan, Zheng <zyan@redhat.com>
Tue, 27 Jun 2017 09:17:24 +0000 (17:17 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 7 Jul 2017 15:25:13 +0000 (17:25 +0200)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/caps.c

index f5552455223fab595c8a2880aab496ee85cdbc1d..7007ae2a5ad2ec4e506ca8216c2fd5253ee35bca 100644 (file)
@@ -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);
 }