From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 621CF1E4BC; Sat, 27 Jan 2024 14:47:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706366842; cv=none; b=bczmnJ0xowbzkTOZ5L2KX+/sprQL33Y25w8gO5mBuoOE1f3TEVx08VHf9f2E8m6TaFONd5SX8ijTnmjCTPzSuaxqV3v2+2EnfAQJq8RZHOYh4xDFvIjYLavr2eW51+AODEbNCN2t7m+FbocqASz+vb1T9coCTCx5UaX327K8vyA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706366842; c=relaxed/simple; bh=FZLyxs2KTnrtcfMD37K8ga7IQTtn1kDf3zqroJHBu0I=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bEgrDhkjpnnGd7qFECr+IiV+mVhIcMUwjMav7nWHh1MLOr1b63V77wvAHqAx4FQwTYUUSr7pOoG3Z3rw8TnmFbl3SzGe/q6phCnetW14WzasR7sIFEqHooeM/20IFcOh2LZfhcfQb1eXoZSs50yJsVvZ8noGDDX44K4MLa5Of4I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EA99C433C7; Sat, 27 Jan 2024 14:47:20 +0000 (UTC) Date: Sat, 27 Jan 2024 09:47:17 -0500 From: Steven Rostedt To: Linus Torvalds Cc: LKML , Linux Trace Devel , Masami Hiramatsu , Mathieu Desnoyers , Christian Brauner , Ajay Kaher , Geert Uytterhoeven , linux-fsdevel Subject: Re: [PATCH] eventfs: Have inodes have unique inode numbers Message-ID: <20240127094717.63c09edb@rorschach.local.home> In-Reply-To: References: <20240126150209.367ff402@gandalf.local.home> <20240126162626.31d90da9@gandalf.local.home> <0C9AF227-60F1-4D9B-9099-1A86502359BA@goodmis.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 26 Jan 2024 14:26:08 -0800 Linus Torvalds wrote: > nother thing that worries me is that odd locking that releases the > lock in the middle. I don't understand why you release the > tracefs_mutex() over create_file(), for example. There's a lot of > "take, drop, re-take, re-drop" of that mutex that seems strange. This was because the create_file/dir() would call into the VFS which would grab locks, and on a final dput() on a ei dentry that is to be freed, calls back into eventfs_set_ei_status_free() which also grabs the eventfs_mutex. But it gets called with the same VFS locks that are taken by create_file/dir() VFS calls. This was caught by lockdep. Hence the dropping of those locks. The eventfs_mutex is just protecting the ei list and also assigning and clearing the ei->dentry. Now that dentry is used to synchronize the last close, and also to know if the ei was ever referenced. If ei->dentry is NULL it can be freed immediately (after SRCU) when the directory is deleted. But if ei->dentry is set, it means that something may still have a reference to it and must be freed after the last dput() and SRCU. Now some of this was needed due to the way the dir wrapper worked so I may be able to revisit this and possibly just use an ei->ref counter. But I wasted enough time on this and I'm way behind in my other responsibilities, so this is not something I can work on now. -- Steve