Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4956656pxj; Wed, 12 May 2021 17:42:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziDywn9rCarzOSZF1wCDEsM7UJ03LlgU1sRwCOcD8x4A6Fs/pmyOVcuVPlbn8SPKSlL6Gu X-Received: by 2002:a05:6830:1e15:: with SMTP id s21mr27972154otr.144.1620866534654; Wed, 12 May 2021 17:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620866534; cv=none; d=google.com; s=arc-20160816; b=eH4keT5QdMHXk2BV9WeqJMqfUyTlhR5C9hrykQGUM692iJFsbCv6CvzFlGb7BxMFx4 dLgo2lPFjrvKnYIpH4xu3EG/JJRpwr70/U2r9tYgDlwJdfhmmzJ7FOke1Cxnd01tEpGI szTVJ6crHgJnvs93JpAblfgR8QFVQTCLBCOj/4Ub+Ewp8UGDiqEtBRzp5WK23K7soGcN MsWeYUbc064MjytNiowgQyc8jyeuEbHjBzsdKGUqjj1/YH1jeyL+KvBLzL3qLG4YO7Y3 U2ZhHYgnxaYu7qkp4rFP8QTyUWH5Rt04m17273X1ld4pCoC+TGGPzpTfXibIlrmSQoh8 3Y+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=MP25mFNYjdZfEJ+K2afJBNsaU0wrWzUC+MJo8UFw/5Q=; b=EBL4TMNgwSEYbnIovVxvh3NI3YsHjEV4FCMyHYAZHHCnfcPxK9S6bS3PI8Ydny31U0 dStcD/kX3xZR9uiEm4X6s9kjQ06YFPM4gFe60dye/+C/SbIdvjP+BeAla4wF2wXg47v6 COWeIIvD6U1tTnHwB/heBBIQfhi1OmUaD++rn/G2Vwj/z21+e/v5mXptRJ0GHtNHLRv6 HBiNQqV2ePqHEZj+08Gy9veacU3hxBPXeuypriqOJgi7VbHPUJxoZu8tt10Zc4S0Oo+C t7dJf398MbPthADh7EXsbYV6myKUv9OIsLTS63yx9JYKAMRukY/jP7Pg/Iv9/pXU2iDx YsgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=ApaXlJJO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n17si1583843oic.248.2021.05.12.17.41.56; Wed, 12 May 2021 17:42:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=ApaXlJJO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384527AbhELUQM (ORCPT + 99 others); Wed, 12 May 2021 16:16:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378627AbhELTR2 (ORCPT ); Wed, 12 May 2021 15:17:28 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF8C0C06129E for ; Wed, 12 May 2021 12:11:27 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id di13so28372906edb.2 for ; Wed, 12 May 2021 12:11:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MP25mFNYjdZfEJ+K2afJBNsaU0wrWzUC+MJo8UFw/5Q=; b=ApaXlJJOrWAXC+lybZWDPHlyWBmTCYMUKgAVwD/5GGx44YUdkuGHZ2qKn+pAzij60S F6w5dsMzxmvDRTL4Mna0QFE/GsRsgxB5N3Un2MFYeI++ewdn+jD3NHFhJD2gnHxm7mML 1Cf4x0JmAJNGLn+c1bzcMnIaEj7kX+n7Ps56m3rEyx0Dzkc/a7jvld2OARw/U78P5P8g tHGVHxjXUyq0GmJROsGaR1rh3AlIWeZSScmGAPwmtiiqmUG/FTF7vub0KFSLTjLcbNm3 3zyMYWiIl1LJfrrx6q+QHNr32GEUhHfOJg0jXDL8nLafEi6DKzyjNg9x5KrzjhYcpVrb jWJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MP25mFNYjdZfEJ+K2afJBNsaU0wrWzUC+MJo8UFw/5Q=; b=tzd4tIC9fkjk42r5uxy9w4SxoT5mf4wUWYzfNH9Y2kNUaDs6baROqgl3wFZm+oEiUY NQ0roLwTDGlBJCqxBmjjMIPOmCbN1WvbKxWWufboWfllgBBZOzkRMtGFbjFappQfsPKy eUBThGuafn3uxDvXO20CKzk7fsWQ5m2g5E0n869sOtBcugoq4bnbeELxA8RwD6SlCFK+ XiBk3Sy8FYzBsLviJ6R5uqObBzdgPShHs0rmfj0e5M2MkZkUXroujvOP7yCmq5qZJSkx 8W+CxFspKFFnT+7pI5l2CJtR6NMCQcm6KLKdjcufjUi+AZCr533YOEw4Oct9XTDoKgb2 Vacg== X-Gm-Message-State: AOAM530z9kWu4Bfv6kZ/ffNBro9dZn4i/XRzB9q6kCkP+WwWysIw8V7u HENx6yR/h9RQbBBawXzEVrA1PpvlXIecuLyBa/RvIg== X-Received: by 2002:aa7:dc0b:: with SMTP id b11mr46060566edu.124.1620846686535; Wed, 12 May 2021 12:11:26 -0700 (PDT) MIME-Version: 1.0 References: <20210502193216.24872-1-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Wed, 12 May 2021 21:11:15 +0200 Message-ID: Subject: configfs: commitable items (was Re: [GIT PULL] gpio: updates for v5.13) To: Al Viro Cc: Andy Shevchenko , Linus Walleij , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Kent Gibson , Christoph Hellwig , Joel Becker Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Al! This is a follow-up to your review of the configfs rename operation for committable items. I'd like to start with a disclaimer: I have a very limited knowledge of the linux VFS and am more of a driver & platform guy. That means I may be asking silly questions so please be patient with me. You've mentioned two sets of problems: one with my rename implementation and one with the general architecture of configfs. While I can try to take on the latter as a side-project, I'll definitely need guidance in the form of your old notes you mentioned. For the former: I'd like to ask for advice on how to approach it. My goal is to get an acceptable implementation of committable items in for v5.14 and then potentially try to improve the overall configfs design later. > FWIW, I'm not happy about the userland API of that thing (what is supposed > to happen if you create, move to live, then create another with the same > name and try to move it to live or original back from live?), but > Documentation/filesystems/configfs.rst is too sparse on such details. > So I would like to see the specifics on that as well. _Before_ signing > up on anything, including "we can fix it up after merge". Do you not like just the details like this (i.e. fixing this use-case and documenting the behavior would be fine) or do you have an entirely different idea for committable items? I'm open for other designs as admittedly the hard-coded "live" and "pending" directories aren't very elegant. Regarding the repeating names: are there any helpers I could use for finding the sibling (live for pending and vice versa) and then inspecting its children for a repeating name? Any caveats to watch out for? > Rename implementation is simply bogus. You are, for some reason, attaching > stuff to *destination*, which won't be seen by anyone not currently using > it. It's the old_dentry that will be seen from that point on - you are > moving it to new location by that d_move(). So I rather wonder how much > had that thing been tested. And I'm pretty much certain that you are > mishandling the refcounts on configfs-internal objects, with everything > that entails in terms of UAF and leaks. I admit I don't really understand the meaning of "won't be seen by anyone not currently using it". Should this cause some visible problems in user-space or is it just related to VFS' accounting? Could you point me to any existing example of the rename() callback that would be useful in my case? The documentation does not really explain the goal of rename wrt both the vfs and underlying fs' structures. I assume d_move() should not be here at all (no other rename() callback seems to call it) but does moving of the configfs sub-tree to the live/pending sibling make sense? Is the fact that configfs has its own tree with children and siblings in parallel to the VFS a problem? To my inexperienced eye this looks redundant if the VFS already keeps track of this. Is this one of the things that should be reworked? Best regards, Bartosz Golaszewski