Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3800731pxf; Mon, 22 Mar 2021 15:54:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykFQ+XS9DJx1+ktGtOpm3j9BGO8d9+7dDRhI0rSl2aN+u/Jklv1zRtsCFIOmHQ3Vaomgnq X-Received: by 2002:a05:6402:35c9:: with SMTP id z9mr1897673edc.94.1616453673820; Mon, 22 Mar 2021 15:54:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616453673; cv=none; d=google.com; s=arc-20160816; b=npDZZLaR0YP1c45vCSnN3Y98K6Nsr/7YGfWVFgKBu9vaR05deBcAaDhHCHz0FpAOnI VOA1XInNycMIpq/zHroZ9OLv1a/R3gRDium2vVPDp0XOWkoUAfduTI8mpb+i2yoh+lsb mr0HlEDejFOHsKLrUkPmYBQMNNoyFLPO2mnsWBpz387yHvvcrEdCfDfJt9miOiXKXIuF 7caxD/Kv/LU0K/n7Q8Cg3V8Ayyy3dRjRXu5Ee0gOETApP++814iIaKEYNaZE7leyTAzK g1BqI5uNgkZDV4IoG6xn5omwgwNgJr6/JHqg+ouEANotYO3V8/7EYHWXZGGfItQ72beb ofEA== 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=RsolNofqH9LLLHhQQzd7LXToxUMGK0/+cf7Hano0KGM=; b=SBdhQLzA29//Bztd+3hr24Q46/xCKRBpZKrf6HgP6w8RPp/I3ryOMGfcqJIKFb52Eo 8FuU/qqbp048ElzKgYzzCO/I0/j6hud8lp2/CX5B+bfj9tPRJPQD3OLqsy/F3PIW7bZ0 Z9WH4UnZaWqJJlIwQAU5QsEJu37BI13Vnef7zskp2w+ZdaMxFI0k8wIpnzv9LyeKC0Ns H/brTiQDPdJyaMNw5Rn4yFqLET0Y+qXVPiApVkaSH3dp5SVJiiEqMnta/Swi+wyHkcG8 zrM6Zx61ipCMdvjWMBIe7eKNxvIdzuVz3DVeuIP9XxbctPAnweFucKVvVJ224cxNywm+ REww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ucbc0tXc; 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 i6si12584014ejk.722.2021.03.22.15.54.11; Mon, 22 Mar 2021 15:54:33 -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=@kernel.org header.s=k20201202 header.b=Ucbc0tXc; 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 S230245AbhCVWw0 (ORCPT + 99 others); Mon, 22 Mar 2021 18:52:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:37494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230179AbhCVWvz (ORCPT ); Mon, 22 Mar 2021 18:51:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A191C61934; Mon, 22 Mar 2021 22:51:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616453514; bh=yVoEM8LaGuagHtZ7+mbGkmOdHq82G3SojkjBmnlu8to=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ucbc0tXct62/N5UleHxcuqtwafv0G71BN8MDIfu2u4KJ3OXbMVubJK4FEg+5q7Nc9 xqxmOBeUC5Bxz1rxhRhVeOy3kOW6F/se4ZRKjcKI/NoAOZvpmEPvRAnEYR2oJjjF5A WLBgexYuJ1sZ4tJ9/kjf0MWLNYxgokoEmv3sW8oZ3tM/0+/dIW63Dlqmgad4tMpaMi bd/kjYlrYwzxNVW4Ksej/016TQtcUdr2pm4sDLpfnbnbvwwyS/Qlw3x7dFuEWKEl58 GugsXxVkhVSfLAoSPrRSKcX9SBXs0DoSqX+G41ZxegA9664GWB54c/E46gXGSn4EbF 45mz7vAdgZSyg== Date: Mon, 22 Mar 2021 15:51:54 -0700 From: "Darrick J. Wong" To: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, Al Viro , linux-kernel@vger.kernel.org, Christoph Hellwig Subject: Re: [PATCH v2 18/18] vfs: remove unused ioctl helpers Message-ID: <20210322225154.GF22094@magnolia> References: <20210322144916.137245-1-mszeredi@redhat.com> <20210322144916.137245-19-mszeredi@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210322144916.137245-19-mszeredi@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 22, 2021 at 03:49:16PM +0100, Miklos Szeredi wrote: > Remove vfs_ioc_setflags_prepare(), vfs_ioc_fssetxattr_check() and > simple_fill_fsxattr(), which are no longer used. > > Signed-off-by: Miklos Szeredi Woo hoo, so much boilerplate goes away! Reviewed-by: Darrick J. Wong --D > --- > fs/inode.c | 87 ---------------------------------------------- > include/linux/fs.h | 12 ------- > 2 files changed, 99 deletions(-) > > diff --git a/fs/inode.c b/fs/inode.c > index a047ab306f9a..ae526fd9c0a4 100644 > --- a/fs/inode.c > +++ b/fs/inode.c > @@ -12,7 +12,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -2314,89 +2313,3 @@ struct timespec64 current_time(struct inode *inode) > return timestamp_truncate(now, inode); > } > EXPORT_SYMBOL(current_time); > - > -/* > - * Generic function to check FS_IOC_SETFLAGS values and reject any invalid > - * configurations. > - * > - * Note: the caller should be holding i_mutex, or else be sure that they have > - * exclusive access to the inode structure. > - */ > -int vfs_ioc_setflags_prepare(struct inode *inode, unsigned int oldflags, > - unsigned int flags) > -{ > - /* > - * The IMMUTABLE and APPEND_ONLY flags can only be changed by > - * the relevant capability. > - * > - * This test looks nicer. Thanks to Pauline Middelink > - */ > - if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL) && > - !capable(CAP_LINUX_IMMUTABLE)) > - return -EPERM; > - > - return fscrypt_prepare_setflags(inode, oldflags, flags); > -} > -EXPORT_SYMBOL(vfs_ioc_setflags_prepare); > - > -/* > - * Generic function to check FS_IOC_FSSETXATTR values and reject any invalid > - * configurations. > - * > - * Note: the caller should be holding i_mutex, or else be sure that they have > - * exclusive access to the inode structure. > - */ > -int vfs_ioc_fssetxattr_check(struct inode *inode, const struct fsxattr *old_fa, > - struct fsxattr *fa) > -{ > - /* > - * Can't modify an immutable/append-only file unless we have > - * appropriate permission. > - */ > - if ((old_fa->fsx_xflags ^ fa->fsx_xflags) & > - (FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND) && > - !capable(CAP_LINUX_IMMUTABLE)) > - return -EPERM; > - > - /* > - * Project Quota ID state is only allowed to change from within the init > - * namespace. Enforce that restriction only if we are trying to change > - * the quota ID state. Everything else is allowed in user namespaces. > - */ > - if (current_user_ns() != &init_user_ns) { > - if (old_fa->fsx_projid != fa->fsx_projid) > - return -EINVAL; > - if ((old_fa->fsx_xflags ^ fa->fsx_xflags) & > - FS_XFLAG_PROJINHERIT) > - return -EINVAL; > - } > - > - /* Check extent size hints. */ > - if ((fa->fsx_xflags & FS_XFLAG_EXTSIZE) && !S_ISREG(inode->i_mode)) > - return -EINVAL; > - > - if ((fa->fsx_xflags & FS_XFLAG_EXTSZINHERIT) && > - !S_ISDIR(inode->i_mode)) > - return -EINVAL; > - > - if ((fa->fsx_xflags & FS_XFLAG_COWEXTSIZE) && > - !S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) > - return -EINVAL; > - > - /* > - * It is only valid to set the DAX flag on regular files and > - * directories on filesystems. > - */ > - if ((fa->fsx_xflags & FS_XFLAG_DAX) && > - !(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) > - return -EINVAL; > - > - /* Extent size hints of zero turn off the flags. */ > - if (fa->fsx_extsize == 0) > - fa->fsx_xflags &= ~(FS_XFLAG_EXTSIZE | FS_XFLAG_EXTSZINHERIT); > - if (fa->fsx_cowextsize == 0) > - fa->fsx_xflags &= ~FS_XFLAG_COWEXTSIZE; > - > - return 0; > -} > -EXPORT_SYMBOL(vfs_ioc_fssetxattr_check); > diff --git a/include/linux/fs.h b/include/linux/fs.h > index 9e7f6a592a70..1e88ace15004 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -3571,18 +3571,6 @@ extern int vfs_fadvise(struct file *file, loff_t offset, loff_t len, > extern int generic_fadvise(struct file *file, loff_t offset, loff_t len, > int advice); > > -int vfs_ioc_setflags_prepare(struct inode *inode, unsigned int oldflags, > - unsigned int flags); > - > -int vfs_ioc_fssetxattr_check(struct inode *inode, const struct fsxattr *old_fa, > - struct fsxattr *fa); > - > -static inline void simple_fill_fsxattr(struct fsxattr *fa, __u32 xflags) > -{ > - memset(fa, 0, sizeof(*fa)); > - fa->fsx_xflags = xflags; > -} > - > /* > * Flush file data before changing attributes. Caller must hold any locks > * required to prevent further writes to this file until we're done setting > -- > 2.30.2 >