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.4 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,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 591B3C004C9 for ; Tue, 7 May 2019 19:55:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 28FAF208CB for ; Tue, 7 May 2019 19:55:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726821AbfEGTzp (ORCPT ); Tue, 7 May 2019 15:55:45 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:51248 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726605AbfEGTzH (ORCPT ); Tue, 7 May 2019 15:55:07 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hO6B5-0006uV-Gs; Tue, 07 May 2019 19:55:03 +0000 Date: Tue, 7 May 2019 20:55:03 +0100 From: Al Viro To: Linus Torvalds Cc: yangerkun , linux-fsdevel , yi.zhang@huawei.com, houtao1@huawei.com, miaoxie@huawei.com Subject: Re: system panic while dentry reference count overflow Message-ID: <20190507195503.GJ23075@ZenIV.linux.org.uk> References: <20190507004046.GE23075@ZenIV.linux.org.uk> <20190507041552.GH23075@ZenIV.linux.org.uk> <20190507191613.GI23075@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Tue, May 07, 2019 at 12:23:23PM -0700, Linus Torvalds wrote: > On Tue, May 7, 2019 at 12:16 PM Al Viro wrote: > > > > Negative ->d_lockref.count are used for "lockref is dead"... > > We can change that to just -1, can't we? It's equally easy to test for. Provided that lockref.c is updated accordingly (look at e.g. lockref_get_not_zero()). > Those aren't supposed to be incremented anyway, which is the whole point. > > But we could do what the page refs also did: consider refcounts in the > "small negative range" to be very special, because they are either > critically close to an overflow, or they are actually a sign of a > fatal underflow due to some bug. And make one of those be the dead > marker. lockref_get_not_zero() hitting dead dentry is not abnormal, so we'd better not complain in such case... BTW, wouldn't that WARN_ON() in dget() belong in lockref_get()?