Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5011014pxb; Wed, 26 Jan 2022 02:55:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6uGnToS7xH39I2RFnAN9PcuYaROXnHyTVbUVOu1pqnWX8fnHTzF2WLEI4yBBsU13ZYHGz X-Received: by 2002:a17:906:7d52:: with SMTP id l18mr19724336ejp.69.1643194500364; Wed, 26 Jan 2022 02:55:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643194500; cv=none; d=google.com; s=arc-20160816; b=oTqXe4MJNu9eHZFbik682SYfglnQHUZLYT81BoUa9xfYEjV9idFiXG9cdBFSjMxiUD 3b2MHJkEPGjmU5rvY04oruvU0MRhNjB7km+C7fELX3Pm7v0J7rLmxnGcIGubG+c/H40Y +I19UUFUXngnCbQ5XdY3byis9B9vxgVntxBz7O6DE1GYD3XRFfHuU/5XW5gzBG36aWpq 0A4PmF4qiYmi/lYGGRU+FRM03wGQgf3LES+GMvAAQftRVAGNqP3I39ecq4gJrvjjAvab n+nCzAQbxB18b9BSDbSUke42p0BddJx5rvlc6nbxNEPyTMiDS/Un5zFJYirxJ9cvv7j6 3mxQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=r2sq8NNfQfbWI8wK6CCJvSQBlG7rZ5GBhPXi5DbZCSQ=; b=HTMaetA8UBQvr3QjoF4dmZLZMApJmhzhpUyE8jj8SaLReAJQ9K4t6X99+BrdLkiB3v WtYK34jZA+XSmgKoZOhDM1DM0dX97vV2pVILF9Kmm/pD/DL9+DfKnG9t7ywq30oFjTl+ GJtIbm722GtdzLUiyyEJlgCq3pBlMTz9OnYGa7yNwkP0ZVowlcmBuhPLoEd/EIPPnGyj O8PIex536cPTgJSB26pgkBAMee6Le3N79uWBFuN5zAJziDqLZvAEtdr9bt4j2hn/ETAP Tu9yxLSab0x6allwC7zS4aSGEazfZ8azASEz7LOG2wFrfCOcmhWnumy3t9gl69Axua7V J9Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CD6N+fuc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sc1si764696ejc.804.2022.01.26.02.54.35; Wed, 26 Jan 2022 02:55:00 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CD6N+fuc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233590AbiAYWOT (ORCPT + 99 others); Tue, 25 Jan 2022 17:14:19 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45284 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230384AbiAYWOS (ORCPT ); Tue, 25 Jan 2022 17:14:18 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B03CDB81B6B for ; Tue, 25 Jan 2022 22:14:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56ED3C340E0; Tue, 25 Jan 2022 22:14:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643148856; bh=wzQ7De1OASBwcj3eJi86mBXPWkiGQw8ikhGXdFZuX4s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CD6N+fucU5W+Oe0l9yslZOos70un8YyAOxgmEVyiljOD5LNiUrrshae3qKmqz/UfW zRo5ffiEfJbWjIcVeOeKFBVlfi8vThLQ4Dp7jTb25WDhtEwOg+GO8zQJV0sgnYoc7B zUBR3soAR5Uil1cGxJO4zU/P2+yKngc3sDIJFNcBvovrpmW1Iv9kvRVwMBCQVDwATl hF6ATYuwsiQq+b8Tc4GiWzJMQISjrXzgNWvEqpruia1PUZaQu8HmvOW10mpVu3jwoz Oo1lIDqQOZbnTen10a52SgQm6goBIQ4PCtwIU9xzZ5vRJTkrP6ydheCM6WG71/qvO3 j2hYTsaW5tIcg== Date: Tue, 25 Jan 2022 22:13:58 +0000 From: Eric Biggers To: Harry Austen Cc: linux-f2fs-devel@lists.sourceforge.net, jaegeuk@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [f2fs-dev] [PATCH] f2fs: fix fileattr_set unsupported attribute handling Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 25, 2022 at 10:01:49PM +0000, Harry Austen wrote: > On Monday, 24 January 2022 19:25:44 GMT Eric Biggers wrote: > > On Sat, Jan 22, 2022 at 12:59:03PM +0000, Harry Austen wrote: > > > FS_IOC_SETFLAGS ioctl should return EOPNOTSUPP if the file attribute > > > (e.g. FS_NOCOW_FL) is not supported, rather than silently ignoring it > > > and returning success. > > > > > > Fixes: 9b1bb01c8ae7 (f2fs: convert to fileattr) > > > Signed-off-by: Harry Austen > > > --- > > > > > > fs/f2fs/file.c | 3 +-- > > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > > > index 92ec2699bc85..061bf35c2582 100644 > > > --- a/fs/f2fs/file.c > > > +++ b/fs/f2fs/file.c > > > @@ -3085,9 +3085,8 @@ int f2fs_fileattr_set(struct user_namespace > > > *mnt_userns,> > > > return -EIO; > > > > > > if (!f2fs_is_checkpoint_ready(F2FS_I_SB(inode))) > > > > > > return -ENOSPC; > > > > > > - if (fsflags & ~F2FS_GETTABLE_FS_FL) > > > + if (fsflags & ~F2FS_SETTABLE_FS_FL) > > > > > > return -EOPNOTSUPP; > > > > > > - fsflags &= F2FS_SETTABLE_FS_FL; > > > > > > if (!fa->flags_valid) > > > > > > mask &= FS_COMMON_FL; > > > > This is intentional, and matches what ext4 does; see the comment in the ext4 > > implementation of this: > > > > /* > > * chattr(1) grabs flags via GETFLAGS, modifies the result and > > * passes that to SETFLAGS. So we cannot easily make SETFLAGS > > * more restrictive than just silently masking off visible but > > * not settable flags as we always did. > > */ > > Ah, my apologies. I thought it looked a little too obvious. Clearly I > should have looked at the ext4 code. Please disregard this patch. > > Is there anything else that could be done to improve unsettable > attribute handling? For example, is there a reason FS_NOCOW_FL is > gettable but not settable? Could it be added to the settable list? A lot of flags are gettable by FS_IOC_GETFLAGS but not settable by FS_IOC_SETFLAGS, typically because they can only be set through a dedicated interface. For example, the encrypt flag can only be set using FS_IOC_SET_ENCRYPTION_POLICY, or via inheritance. > > > > Also, even if this patch was correct, the Fixes tag is wrong. > > Having looked at this a bit more, I assume you are saying this due to > the missing double quotes around the commit summary? (just so I know for > next time as this is my first attempt at sending a kernel patch) > There's that, but more importantly the commit you listed is wrong. The relevant code was added by an earlier commit, and that commit just moved it. - Eric