Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp711262rdf; Fri, 3 Nov 2023 12:38:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFSfFYCMB8azS+yOxzyfnVlneVwK37MwkAWmfRyxa0gtb7ZFviSVQGB2ErWxPlMH3nIEBno X-Received: by 2002:a05:6871:8198:b0:1e9:858e:ff23 with SMTP id so24-20020a056871819800b001e9858eff23mr18513683oab.55.1699040281369; Fri, 03 Nov 2023 12:38:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699040281; cv=none; d=google.com; s=arc-20160816; b=NZzccHqWcCmLTwWxu9yMxDmmcjpZTvCgmCFCwT2ra+QqRjgm2Al59ss1+r8bMxHBss kyEtOwheJOo94Q4pIj3OnkxJpDKxiW/qv/xyCMlMNqxC3AXAj0Iyeoe82tBWOuNSCL3T 23WdUmla8a3FNSj4Lx0dfDZT7g0LHxZhj7pV/ArxMeQ5lI1pvFA0cpgo9Ee44D9R8uhj 3UkPPNlVmCPBZyEmboVRTMro7WouMz4lxPriQJgGssLVKqt9rx8lTiYdVvrzUEmfaRZo ZL644GXJaui4X4yAEj5NVKsygOaKexypqYxbb/aZxk6bfKQypYeSpE5J62fzXdMTpu4v DpKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=i0KUcHlFUhWeXHp6OMFIQFv23yDUyIxA3jyyhwS5c0c=; fh=K8p2f3OsjtSMZAlwhXYrt68qwaN8kcbqcV+587c1R+o=; b=RLTzJ8HwYcyhd6AYxqf5lNJBhvX5jctRng1zOuQ3A6N7cLcLpF/Xpmb1BqoIg8B0TN iPkHPtkYJTABN8Mr626l9qAmvbB2ZFXAXByWsc3UrVfEdTvV6maSKo88V7Y+Y1H07Wf/ iBAviMjzhZyYRSBEY2VeJESDEOAhtvgsuZvwoeqALFtiobXr+bLi4e0NYIc31A6Evyfk 9nNn0dQsJLoLOyVZb0XzOqQLYQP+/BINay8N2qk9aeTcivBxb+yP4wPcR5Jr7hxVDr57 RBJgrgNoFkwZbmU5QOgYnXvv95v0DlgvHm776yAA8BAV8EgBCBriOo+wjJXR32EytE7g yH+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=Mdmg2DuK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id u9-20020a656709000000b00563dfffe7b9si2134589pgf.810.2023.11.03.12.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 12:38:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=Mdmg2DuK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 27AC680260C6; Fri, 3 Nov 2023 12:37:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377764AbjKCThP (ORCPT + 99 others); Fri, 3 Nov 2023 15:37:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377583AbjKCThO (ORCPT ); Fri, 3 Nov 2023 15:37:14 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94834D75; Fri, 3 Nov 2023 12:37:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=i0KUcHlFUhWeXHp6OMFIQFv23yDUyIxA3jyyhwS5c0c=; b=Mdmg2DuKO+sc8DsT+tqPAJXmq3 DGYMePLeSY8IqQTg7Y00/p2bfXpiocx/8dk5Lf/+tMhZkxY4kRpor3gooJ+CmlBf8Hy7aGBCdjvCV EsQE03OeyFni1UxoV4qf1SPAvb/5WbxovqTIBAJR8n4XazAncqur7TjKn4dd4EUiWEDJCc7CbI9ez q9EKvDhvIv19qfdpJ/gq2zMCiFhEETfOna6G0WGMkNABMfsITmXF8wp2ue89Jk2uzSwcGSNHmiiRH lCh6vx3C7Qd/SveFeapLfYW+rEXPgAeTI8NgtscyF3vJaQkV9Ijv/SbldkULGOiMM3TkUsyypMbog qn8i7tzQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1qyzyX-00ATmK-22; Fri, 03 Nov 2023 19:37:01 +0000 Date: Fri, 3 Nov 2023 19:37:01 +0000 From: Al Viro To: Vegard Nossum Cc: Christian Brauner , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Nick Piggin , Waiman Long , linux-doc@vger.kernel.org Subject: Re: [PATCH] dcache: remove unnecessary NULL check in dget_dlock() Message-ID: <20231103193701.GP1957730@ZenIV> References: <20231022164520.915013-1-vegard.nossum@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231022164520.915013-1-vegard.nossum@oracle.com> Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 03 Nov 2023 12:37:43 -0700 (PDT) On Sun, Oct 22, 2023 at 06:45:20PM +0200, Vegard Nossum wrote: > @@ -1707,7 +1701,7 @@ static enum d_walk_ret find_submount(void *_data, struct dentry *dentry) > { > struct dentry **victim = _data; > if (d_mountpoint(dentry)) { > - __dget_dlock(dentry); > + dget_dlock(dentry); > *victim = dentry; *victim = dget_dlock(dentry); > return D_WALK_QUIT; > } > @@ -1853,7 +1847,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) > * don't need child lock because it is not subject > * to concurrency here > */ > - __dget_dlock(parent); > + dget_dlock(parent); > dentry->d_parent = parent; dentry->d_parent = dget_dlock(parent); > - * Given a dentry or %NULL pointer increment the reference count > - * if appropriate and return the dentry. A dentry will not be > - * destroyed when it has references. > + * Given a dentry, increment the reference count and return the > + * dentry. > + * > + * Context: @dentry->d_lock must be held. ... and dentry must be alive. There are many ways the caller could use to guarantee that - any of the "it's hashed", "it's positive", "its ->d_lockref.count is not negative" would suffice under ->d_lock.