Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp839454pxb; Wed, 13 Jan 2021 17:59:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyftpDeyNX5WUQhihz9koiPmEgZiieM94SG7JoPoFku/lwzpXHojp1UhlA/zSI9Oo9AoH3s X-Received: by 2002:aa7:c2c2:: with SMTP id m2mr4017205edp.80.1610589546433; Wed, 13 Jan 2021 17:59:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610589546; cv=none; d=google.com; s=arc-20160816; b=Kj7hpXrwqMbOQVaqZpvWOMuHl6cHoXbGY2TUwcMOdhRcK+pbj0E0rEPR64PnXkArnr WkFgVfsDxIEQ7jzQSxRZ5GL06WvUPXfp/XRkGBU5dihNfcmZRh09i5Da6zUwfsTN4AXL R2qoxkGXjxbm0P5qTzFz/KIf3v2iWKiErt7gb+fM8SuD9Ys4vsfPReQKVrAJ3VZOcAAH cPIu4ZCV4ZOKJ+l0s6dAnxA4wve45uvvl7g2A2CpcD4u2xiVTCAnDaQM3kZmKG0MtCCm 7AlvMwhO+QFR+IFWrWTVqX4ZJPUsQ+VpjCQ0rMKvPzycM7BHSEUvAvnMWp4Z8tmPlMO+ DsrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date; bh=/SYDEGe1otRwRdM2KsZzfMU5+YJFjlUVw124UFi787w=; b=X8LZ5MfEDXM79DKpTja6OtFY3wg2pWhgFEBaPODEtvWXRnnlJHsEZOFH5vr1aIPknF tEx9l6xdzA9bGPcfb7TjDdynjWS0EZvOnhCDaJj/rjs9hDNlPTULfCrDaubpjMwFTel+ 8jas0V87y+5JXYhYJL5W1GjNLyB3swoaSxfVP9RomZMNGUBxgoUumbGxQWbrjsh/0Y3L K59I27ABYSGLiAwtxJIlTIdcslCiso1NC9FM4xPlciuY0Pcwh/n4eLio4T6rFG8ZA9er 7TITG23w5vwTFYffJBWn6PDoyNZUCmHEq4WAWLdfvBnqVwyuYuAhQ5qHk6XrBXBAhBqe lsNw== ARC-Authentication-Results: i=1; mx.google.com; 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 r23si521546ejs.503.2021.01.13.17.58.43; Wed, 13 Jan 2021 17:59:06 -0800 (PST) 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; 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 S1728562AbhANB4E (ORCPT + 99 others); Wed, 13 Jan 2021 20:56:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729605AbhAMXr1 (ORCPT ); Wed, 13 Jan 2021 18:47:27 -0500 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4666C061575 for ; Wed, 13 Jan 2021 15:46:18 -0800 (PST) Received: from jlbec by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kzpq8-00A5k3-1M; Wed, 13 Jan 2021 23:46:12 +0000 Date: Wed, 13 Jan 2021 15:46:08 -0800 From: Joel Becker To: Bartosz Golaszewski Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH 3/4] configfs: implement committable items Message-ID: Mail-Followup-To: Bartosz Golaszewski , Christoph Hellwig , linux-kernel@vger.kernel.org, Bartosz Golaszewski References: <20201125152247.30809-1-brgl@bgdev.pl> <20201125152247.30809-4-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201125152247.30809-4-brgl@bgdev.pl> X-Burt-Line: Trees are cool. X-Red-Smith: Ninety feet between bases is perhaps as close as man has ever come to perfection. Sender: Joel Becker Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 25, 2020 at 04:22:46PM +0100, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > This implements configfs committable items. We mostly follow the > documentation except that we extend config_group_ops with uncommit_item() > callback for reverting the changes made by commit_item(). Woohoo! A long time coming, but thank you for working on the implementation! > Each committable group has two sub-directories: pending and live. New > items can only be created in pending/. Attributes can only be modified > while the item is in pending/. Once it's ready to be committed, it must > be moved over to live/ using the rename() system call. This is when the > commit_item() function will be called. The original API intended for live items to still be modifyable. The live/ path forbids mkdir()/rmdir(), but it allows store(). Otherwise, items can't be adjusted at all while in use, which is severely limiting. Obviously the store() handler must not allow transitions from valid-value->invalid-value, but the handler would reject invalid values anyway, wouldn't it? > diff --git a/fs/configfs/file.c b/fs/configfs/file.c > index 1f0270229d7b..a20e55fd05e8 100644 > --- a/fs/configfs/file.c > +++ b/fs/configfs/file.c > @@ -243,9 +243,17 @@ fill_write_buffer(struct configfs_buffer * buffer, const char __user * buf, size > static int > flush_write_buffer(struct file *file, struct configfs_buffer *buffer, size_t count) > { > + struct config_item *parent_item = buffer->item->ci_parent; > struct configfs_fragment *frag = to_frag(file); > + struct configfs_dirent *sd; > int res = -ENOENT; > > + if (parent_item && parent_item->ci_dentry) { > + sd = parent_item->ci_dentry->d_fsdata; > + if (sd->s_type & CONFIGFS_GROUP_LIVE) > + return -EPERM; > + } > + > down_read(&frag->frag_sem); > if (!frag->frag_dead) > res = buffer->attr->store(buffer->item, buffer->page, count); Basically, I would just leave this hunk out. Thanks, Joel -- "Now Someone's on the telephone, desperate in his pain. Someone's on the bathroom floor doing her cocaine. Someone's got his finger on the button in some room. No one can convince me we aren't gluttons for our doom." http://www.jlbec.org/ jlbec@evilplan.org