From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 895F8C43381 for ; Thu, 21 Feb 2019 08:30:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 61B442148D for ; Thu, 21 Feb 2019 08:30:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725866AbfBUIat (ORCPT ); Thu, 21 Feb 2019 03:30:49 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:38110 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725385AbfBUIat (ORCPT ); Thu, 21 Feb 2019 03:30:49 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.91 #2 (Red Hat Linux)) id 1gwjkZ-00079b-2F; Thu, 21 Feb 2019 08:30:35 +0000 Date: Thu, 21 Feb 2019 08:30:35 +0000 From: Al Viro To: Fam Zheng Cc: linux-fsdevel@vger.kernel.org, Fam Zheng , =?utf-8?B?5q6154aK5pil?= , Shine Liu Subject: Re: d_add and dentry leak Message-ID: <20190221083034.GA2217@ZenIV.linux.org.uk> References: <88C84EC4-6B70-455E-9203-A6DB398D3FA4@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <88C84EC4-6B70-455E-9203-A6DB398D3FA4@bytedance.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu, Feb 21, 2019 at 03:45:06PM +0800, Fam Zheng wrote: > We’ve noticed an issue that frequent open,close,open,close... of /dev/ptmx eventually causes soft lockup. > > Here is a summary of what happened. > > Upon user opening /dev/ptmx, devpts_pty_new calls d_alloc_name and d_add, the new dentry is inserted into dcache_hashtable. > > Later when closing, devpts_pty_kill calls d_delete and dput, ... since it looks like a normal negative dentry, to be eventually evicted upon memory pressure. That's not the worst problem in there, actually - consider touch /tmp/a mount --bind /tmp/a /dev/pts/ followed by devpts_pty_kill() taking that sucker out...