Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19613884rwd; Wed, 28 Jun 2023 11:35:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7pT00Lk1YncTZ9YFkO6QWqoPeuQHHOHBBwV9ef5kSnRx6kfl4rU2AjIkptINSX82kkkAyA X-Received: by 2002:a05:6a20:12cb:b0:126:1700:f6eb with SMTP id v11-20020a056a2012cb00b001261700f6ebmr12194725pzg.16.1687977358110; Wed, 28 Jun 2023 11:35:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687977358; cv=none; d=google.com; s=arc-20160816; b=APJaoCjdR4VymkdosgS6K/nYWbJEDQjKQ4XaSXf2Mrus3J2lauA+a+OWVht6cW/sm+ cidHsKpoxK+Om6hlvLJweyZPHxjzaBTgVQfmnh8ZbOqwp4zhWDlgpipmgRCNu/o6Vthw ZuRutfee5raVZCRnr5ItGwEOZMIm8ASIaajjqrmryFqLf7a2NPAZdN3se0ZzkCSXuXMl LvVdsHuyXvLCZTEaPuZ911goOJdCxaRfF9jq14jeuZTS4s+VoxWKqRs/PhAs6yPHSxlc mO4EFcURgpAeqGDX2Epyavaiyj10dgStDgsY3MDPpy6dMvGVvdn67S5YOpl9dCOFvExR r8XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=/K9OS0zmztPbtY0PgdFfjCYBxDyy7aJx/bjVFEWW/zU=; fh=gWOXbR8Go8ZZzSq1qnvwsWT+mN+uIrppteKEhejTBsg=; b=P3MTF35dmFSHPGXnnH/UmKlLIvRclSIrDDI+qxl0QKnYiazIm3QLGaSbU+J4s7Wzdj CRcfL1YLaU7/RQqQBUXmPUa8059in+rw/H8boXMR1EK7kXQZhp1J2DefEMS+qTMfhYjm kJJ4Y2JJ+CM0sYOPP64M+1vg2H2v0TX/Abh6FYuO77ixR+AuQB2qKV0fYkFg0T8EmeUX LKlPbKHvhOQYBWQRmXGbSUgAot6HB9eXPtVYD6dwJNlN4JfefpYCQZSsy1X5Q1YMxXiJ +jF24iZZ8WyL/JVoduy9WD8KnAWekj4WvkbHQfidgaZerzO115TaobzUzuSAGmdv1J1G ebEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=581WkyNE; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cd23-20020a056a00421700b0067de347ee12si3202888pfb.164.2023.06.28.11.35.44; Wed, 28 Jun 2023 11:35:58 -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=@google.com header.s=20221208 header.b=581WkyNE; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231454AbjF1SSk (ORCPT + 99 others); Wed, 28 Jun 2023 14:18:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229610AbjF1SSh (ORCPT ); Wed, 28 Jun 2023 14:18:37 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBA0D1BC3 for ; Wed, 28 Jun 2023 11:18:35 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id 3f1490d57ef6-c13280dfb09so33413276.2 for ; Wed, 28 Jun 2023 11:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687976314; x=1690568314; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=/K9OS0zmztPbtY0PgdFfjCYBxDyy7aJx/bjVFEWW/zU=; b=581WkyNE3unzDgNYmmnMuhz9DPFGMaDG8zfvPvFTpQuAjINSYngeXP4UhZ8hqBx/+c FBq81FPsrzb47Zp3QB5HxpqS/oR1q15toQie6f+Vk5+LsWUiWzMadgauzQZ/ucTi65pA 1UjENO+Fktt/FHXzaN01E1DE/M4GNO9pF3vMgdQzGFEm8O+RAgajutwOe3j5gLL8EW6q mMLClQugPV3+9irnbY9yyK+g8uInwDPPlISGXw2oaVrq9ojyIqPqeFuAl6tZpedC0Q4Z 1l6ivjmficvNIra9S7wCin0ish9T9cq9as4OitA+p68B+VyO4uNW1/ZY7rn7UfMxQa+5 HLqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687976314; x=1690568314; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/K9OS0zmztPbtY0PgdFfjCYBxDyy7aJx/bjVFEWW/zU=; b=Za96AN0kWUi4dJgVaAvz7o9xFL9SOCmXQ5OomQxImBxOBRqHZpEYxXVNO+dxbkWoaU BTL2GBkU0pCRjwsvQ2t5hqxn3idtK+y/eVh28UoasIlX+VyMzn97xbyxjxTSKVqjImRr GgEICOhv6Q3y/ppeP/u24Vgr0IWsEgiGWvg+WjiU6iTNrfPwSc/ZOUlHWD3L3hRj+jbo OfASw7X8NiedwC5N8oQZDjCJw6omLYcDpfwA8gT2i/xjpZdWXflukxOkGaWhvbgu1fwv HaPRbgEpC3mxX5lW4UbxFTm3rRZJtbeUMOdZk7YZR3kwQGOeZniWJUYao+ChzOk7InAD XlLQ== X-Gm-Message-State: AC+VfDwuE/ZnPLxxl4Yzcyt822O59cA9QcRTbi/Hf+Kwk+8FzMLOu1r2 wVHgkkJx5cRkTGBSMhuuojTDljT50kNvnbaxU6wRSQ== X-Received: by 2002:a25:2f8f:0:b0:c1a:5904:fe8e with SMTP id v137-20020a252f8f000000b00c1a5904fe8emr10924745ybv.34.1687976314500; Wed, 28 Jun 2023 11:18:34 -0700 (PDT) MIME-Version: 1.0 References: <20230628-meisennest-redlich-c09e79fde7f7@brauner> <20230628-faden-qualvoll-6c33b570f54c@brauner> <20230628-spotten-anzweifeln-e494d16de48a@brauner> In-Reply-To: From: Suren Baghdasaryan Date: Wed, 28 Jun 2023 11:18:20 -0700 Message-ID: Subject: Re: [PATCH 1/2] kernfs: add kernfs_ops.free operation to free resources tied to the file To: Tejun Heo Cc: Christian Brauner , gregkh@linuxfoundation.org, 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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:02=E2=80=AFAM 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 ne= w > > > 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 ou= t > and then you can do so synchronously in a finite amount of time (you stil= l > 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? Thanks, Suren. > > Thanks. > > -- > tejun