From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from flow-b2-smtp.messagingengine.com (flow-b2-smtp.messagingengine.com [202.12.124.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6CC1392C3A; Tue, 29 Sep 2026 03:43:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.137 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790653390; cv=none; b=Spd0zIWSZ++8T9uPDSwntay8L8yfs/o34HarnLP/0fcQuyq6Tmk34WtofZIoP7InFIobvlzAvoEkfU/FKZG8tAxP1sCWzSvkm9rEEYUmqiQukIOoQcM0MYcKcVRVEzsyi/KuZfjRKqNWu7pSVipIc9XJK5xWVxboJYxVXmChgNI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790653390; c=relaxed/simple; bh=rZgqwFYUjwIvny8Pu3lHjPvnuFX4DEivlleG/gsbcJM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eQYtRGNy6WMqVpGI9mQY4ImzY1rKm8bL/xVYwYdt9RC0c6faW114f51Hj7Te3t2yPrAH4u/P1JNROV7M16+CZoxp+uxxn9rWbUvdZlkGx2cAxvKT/03Bktfb5lGOfVT6AsMFkuve4BvmPQzhjJqlyP280YK6oj9sa6W2ZPKow6o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=m/bjmYXV; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Pxstf1lI; arc=none smtp.client-ip=202.12.124.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="m/bjmYXV"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Pxstf1lI" Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailflow.stl.internal (Postfix) with ESMTP id 51A15130193A; Mon, 28 Sep 2026 23:43:07 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Mon, 28 Sep 2026 23:43:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm1; t=1790653387; x=1790660587; bh=mN/2SSV8bIw24exSybjBxan284YWLD0YYt6t0Umtf4c=; b= m/bjmYXVAasRh0xyF47KEJG7Zmxn+6bI3gtqt6ip5j8TEoMZ9giVbJuvHbF32LqQ J1gB7diA96j64dY9ryX7i43LR5NE/GXc6xeEHLMIUsXaApdieqrSshs1tGV7eGIN cBUfQXA+T6z0cao/bSPqATRc0x9EDT8ldEERb05yMPmFLsMlN+L72e9O680wJRJZ zK7L9yLeSEqtGdum6RwlFdBIeS66RVKw4AAvBo6WoY8CFdqTosftV2pKqhxPvgit x2WTD0Y/SNSJJTWkGVgXjDNZ/Wzano1HkG4RwF+n94lSOkPGDOYxUrtjK2wxrbGE B8ypvNrW2u15OJmYsv/n/A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1790653387; x=1790660587; bh=m N/2SSV8bIw24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bhk/SVJdYTVGY/z5TZwQ X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Sep 2026 23:42:59 -0400 (EDT) From: NeilBrown To: Miklos Szeredi , Amir Goldstein , Kees Cook , Joel Granados , Richard Weinberger , Anton Ivanov , Johannes Berg , Breno Leitao , Andreas Hindborg , Jan Harkes , Hugh Dickins , Baolin Wang , Namjae Jeon , Hyunchul Lee , Carlos Maiolino , Alexander Viro , Christian Brauner Cc: Jeff Layton , Jan Kara , linux-fsdevel@vger.kernel.org, fuse-devel@lists.linux.dev, linux-kernel@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-um@lists.infradead.org, codalist@coda.cs.cmu.edu, coda@cs.cmu.edu, linux-mm@kvack.org, ntfs@lists.linux.dev, linux-xfs@vger.kernel.org Subject: [PATCH 4/7] configfs: remove d_add() calls before configfs_attach_group() Date: Tue, 29 Sep 2026 13:36:04 +1000 Message-ID: <20260929034158.1455429-5-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260929034158.1455429-1-neilb@ownmail.net> References: <20260929034158.1455429-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: NeilBrown These d_add() calls cannot be necessary. The inode given is NULL so all they do is attach the dentry to the hash table. If configfs_attach_group() fails, then d_drop() is called so the dentry will be detached. If configfs_attach_group() succeeds, then configfs_attach_group -> configfs_attach_item ->configfs_create_dir must have succeeded, so d_instantiate() will have been called and the dentry hashed there. So the only effect is that the dentry will be hashed-negative for a short period which will allow a lookup to find nothing without waiting for the directory i_rwsem. I can find no indication that this might be important. Adding a dentry as negative, and then later making it positive is an unusual pattern and appears to be unnecessary, so it is best avoided. Signed-off-by: NeilBrown --- fs/configfs/dir.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 3c88f13f1ca2..145a092171fe 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -715,8 +715,6 @@ static int create_default_group(struct dentry *parent, ret = -ENOMEM; child = d_alloc_name(parent, group->cg_item.ci_name); if (child) { - d_add(child, NULL); - ret = configfs_attach_group(&group->cg_item, child, frag); if (!ret) { sd = child->d_fsdata; @@ -1901,8 +1899,6 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) err = -ENOMEM; dentry = d_alloc_name(root, group->cg_item.ci_name); if (dentry) { - d_add(dentry, NULL); - err = configfs_dirent_exists(dentry); if (!err) err = configfs_attach_group(&group->cg_item, -- 2.50.0.107.gf914562f5916.dirty