diff mbox

Ceph: Make sure stale dentries should be unhashed successfully in time.

Message ID 43180B106D8B514FB730205E2D1199E40399EE7C@EX02.corp.qihoo.net (mailing list archive)
State New, archived
Headers show

Commit Message

陈玉鹏 March 2, 2018, 7:40 a.m. UTC
Prior to kernel v3.19, d_invalidate() might not unhash stale dentries due to reference count,
so the stale dentries are left in the memory, causing a delayed expiration.

Fixes: http://tracker.ceph.com/issues/23097

Signed-off-by: Yupeng Chen <chenyupeng-it@360.cn>
---
 fs/ceph/inode.c | 4 ++++
 1 file changed, 4 insertions(+)

-- 
1.8.3.1

Comments

Ilya Dryomov March 2, 2018, 9:18 a.m. UTC | #1
On Fri, Mar 2, 2018 at 8:40 AM, 陈玉鹏 <chenyupeng-it@360.cn> wrote:
> Prior to kernel v3.19, d_invalidate() might not unhash stale dentries due to reference count,
> so the stale dentries are left in the memory, causing a delayed expiration.
>
> Fixes: http://tracker.ceph.com/issues/23097
>
> Signed-off-by: Yupeng Chen <chenyupeng-it@360.cn>
> ---
>  fs/ceph/inode.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
> index c6ec5aa..70a38f2 100644
> --- a/fs/ceph/inode.c
> +++ b/fs/ceph/inode.c
> @@ -1345,6 +1345,10 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req)
>                              dn, d_inode(dn), ceph_vinop(d_inode(dn)),
>                              ceph_vinop(in));
>                         d_invalidate(dn);
> +                       /* Prito to v3.19,d_invalidate might unhash the dentry unsuccessfully.*/
> +                       if (!d_unhashed(dn)) {
> +                               d_drop(dn);
> +                       }
>                         have_lease = false;
>                 }
>

Kernel 3.19 came out three years ago, what are aiming for here?

This won't be the only issue you see if you keep running something
older than 3.19.  Tons of things have been fixed since then.  I'd
strongly recommend an upgrade.

Thanks,

                Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
陈玉鹏 March 2, 2018, 11:04 a.m. UTC | #2
Hi,   Ilya

    We encountered this problem in our production environment in which hosts are running CentOS 7.2.

Indeed, the kernel shipped with that release is a little outdated for the kernel ceph-client,  so we would consider an upgrade.

Thanks,

    Yupeng
diff mbox

Patch

diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index c6ec5aa..70a38f2 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -1345,6 +1345,10 @@  int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req)
 			     dn, d_inode(dn), ceph_vinop(d_inode(dn)),
 			     ceph_vinop(in));
 			d_invalidate(dn);
+			/* Prito to v3.19,d_invalidate might unhash the dentry unsuccessfully.*/
+			if (!d_unhashed(dn)) {
+				d_drop(dn);
+			}
 			have_lease = false;
 		}