Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19627760rwd; Wed, 28 Jun 2023 11:50:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5VgzUBgtbN+G2tz2pDYWW9w4JX//TcMDM91W3vzXmLeb7bhI/myi9Fu64ayfgm0EhfVrFU X-Received: by 2002:a17:907:8a0c:b0:992:48b7:99e3 with SMTP id sc12-20020a1709078a0c00b0099248b799e3mr4036043ejc.63.1687978210766; Wed, 28 Jun 2023 11:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687978210; cv=none; d=google.com; s=arc-20160816; b=fUNYDWjUbE9cgFE9+Orrnfkl9HL68ad3OqWmFk+/3Ufmm/gLChrAlBhzoBQnauxM/t aExlVoC5oO8YQJlSlYMCgJttGfWKBPy6T2Cyyw4N8HYygIu29pkfS8rtxvEBtFGbZAsy /oHAMr1ihbfvnaGAaPgUGB4HQgGqFq5DS2DwekBrSaH2QeqqzSyvd6QiJO4dQeZuVcav DZvHefJoZseH6YDDSd5dR+jxmb/Bd8YZtP0iMj5cPL1lDfKrliG93EDnn+GGw87aojPh gftt4WWoIAt3xAr3Pxv/dVKlPujAvcLs30tWPE9c/6ZoadBTtRAmPssJvuNsZDiMo2Qa 8dqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=leV2hLQfETjmyUc9L3jsHRSv2DzDzOjVdJn9A7KX5ss=; fh=4LkmhPw6th2NMtHFHqCdx/9FELG07gjbGO4c+rHhDeU=; b=Xb4YPMDO7+rxzrTOr4zqkBRvoRgpDNFGUZkLQ5cX0emYSiOFUwz46vJBBVm/gbXHIR aICn1om2fZfvdbOPUg27cg7DU1Hf67NlDgJnXcYWyto2bR28yBGG1rQF1Ua99qxnE8C5 gA5n9E76eWyp+ir91jFxFQiGV9T6z61OlelJ49mHurGHFd5vsNsbZUjZClD8FABBKlar FuAztdlPiEdnZ7WYtUc3IS9ocWGALM2yRN5n467Gx3Cu4yzMdZ3e95vY7xbXoDAp2h5v DG4DjRg7En0ZQFmXemvKhcFETG6h5Y9Up9hXlTRu2dJMIGeQ7a4OsvESiz0fRSbF0COT 7XPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r96Qzmwl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gg18-20020a170906e29200b009886d484ad6si5848415ejb.759.2023.06.28.11.49.43; Wed, 28 Jun 2023 11:50:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r96Qzmwl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230401AbjF1SmN (ORCPT + 99 others); Wed, 28 Jun 2023 14:42:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbjF1SmL (ORCPT ); Wed, 28 Jun 2023 14:42:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE5C410F5; Wed, 28 Jun 2023 11:42:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 639856142A; Wed, 28 Jun 2023 18:42:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41A4BC433C8; Wed, 28 Jun 2023 18:42:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687977728; bh=s+CFIQ47Nde7laYIREkJnwD6OP0zOQzRI431me7l5hM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=r96QzmwlwrrCKx+UBddlEPORTg571sdls578CN138pCbKjYbvVHbeEwBB+YEI/Pi3 WWYvoqWWWCuimtfQ3WjeWhwNlwhF0KtCIqtOaP+XN9kppPSgPqyU8jfWo84XdQyr5Y PqlZT3ZXZgVIDHeStH6VizDAk1Xy0Qovl+03GMwI= Date: Wed, 28 Jun 2023 20:42:05 +0200 From: Greg KH To: Suren Baghdasaryan Cc: Tejun Heo , Christian Brauner , peterz@infradead.org, lujialin4@huawei.com, lizefan.x@bytedance.com, hannes@cmpxchg.org, mingo@redhat.com, ebiggers@kernel.org, oleg@redhat.com, akpm@linux-foundation.org, viro@zeniv.linux.org.uk, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-fsdevel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH 1/2] kernfs: add kernfs_ops.free operation to free resources tied to the file Message-ID: <2023062845-stabilize-boogieman-1925@gregkh> References: <20230628-meisennest-redlich-c09e79fde7f7@brauner> <20230628-faden-qualvoll-6c33b570f54c@brauner> <20230628-spotten-anzweifeln-e494d16de48a@brauner> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Wed, Jun 28, 2023 at 11:18:20AM -0700, Suren Baghdasaryan wrote: > On Wed, Jun 28, 2023 at 11:02 AM Tejun Heo wrote: > > > > On Wed, Jun 28, 2023 at 07:35:20PM +0200, Christian Brauner wrote: > > > > To summarize my understanding of your proposal, you suggest adding new > > > > kernfs_ops for the case you marked (1) and change ->release() to do > > > > only (2). Please correct me if I misunderstood. Greg, Tejun, WDYT? > > > > > > Yes. I can't claim to know all the intricate implementation details of > > > kernfs ofc but this seems sane to me. > > > > This is going to be massively confusing for vast majority of kernfs users. > > The contract kernfs provides is that you can tell kernfs that you want out > > and then you can do so synchronously in a finite amount of time (you still > > have to wait for in-flight operations to finish but that's under your > > control). Adding an operation which outlives that contract as something > > usual to use is guaranteed to lead to obscure future crnashes. For a > > temporary fix, it's fine as long as it's marked clearly but please don't > > make it something seemingly widely useable. > > > > We have a long history of modules causing crashes because of this. The > > severing semantics is not there just for fun. > > I'm sure there are reasons things are working as they do today. Sounds > like we can't change the ->release() logic from what it is today... > Then the question is how do we fix this case needing to release a > resource which can be released only when there are no users of the > file? My original suggestion was to add a kernfs_ops operation which > would indicate there are no more users but that seems to be confusing. > Are there better ways to fix this issue? Just make sure that you really only remove the file when all users are done with it? Do you have control of that from the driver side? But, why is this kernfs file so "special" that it must have this special construct? Why not do what all other files that handle polling do and just remove and get out of there when done? thanks, greg k-h