From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1120C5B57E for ; Sat, 29 Jun 2019 20:09:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 77F9C215EA for ; Sat, 29 Jun 2019 20:09:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726909AbfF2UJG (ORCPT ); Sat, 29 Jun 2019 16:09:06 -0400 Received: from mx2.suse.de ([195.135.220.15]:52216 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726906AbfF2UJF (ORCPT ); Sat, 29 Jun 2019 16:09:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 20195AD70; Sat, 29 Jun 2019 20:09:03 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id AA7D51E3F56; Sat, 29 Jun 2019 22:09:01 +0200 (CEST) Date: Sat, 29 Jun 2019 22:09:01 +0200 From: Jan Kara To: " Darrick J. Wong " Cc: adilger.kernel@dilger.ca, clm@fb.com, yuchao0@huawei.com, hch@infradead.org, jaegeuk@kernel.org, shaggy@kernel.org, ard.biesheuvel@linaro.org, tytso@mit.edu, matthew.garrett@nebula.com, jk@ozlabs.org, David Sterba , Jan Kara , josef@toxicpanda.com, viro@zeniv.linux.org.uk, linux-mtd@lists.infradead.org, jfs-discussion@lists.sourceforge.net, linux-f2fs-devel@lists.sourceforge.net, ocfs2-devel@oss.oracle.com, cluster-devel@redhat.com, linux-btrfs@vger.kernel.org, linux-efi@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-xfs@vger.kernel.org, reiserfs-devel@vger.kernel.org Subject: Re: [PATCH 5/5] vfs: only allow FSSETXATTR to set DAX flag on files and dirs Message-ID: <20190629200901.GA18642@quack2.suse.cz> References: <156174682897.1557318.14418894077683701275.stgit@magnolia> <156174687185.1557318.13703922197244050336.stgit@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <156174687185.1557318.13703922197244050336.stgit@magnolia> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org On Fri 28-06-19 11:34:31, Darrick J. Wong wrote: > From: Darrick J. Wong > > The DAX flag only applies to files and directories, so don't let it get > set for other types of files. > > Signed-off-by: Darrick J. Wong Looks good to me. You can add: Reviewed-by: Jan Kara Honza > --- > fs/inode.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > > diff --git a/fs/inode.c b/fs/inode.c > index 670d5408d022..f08711b34341 100644 > --- a/fs/inode.c > +++ b/fs/inode.c > @@ -2259,6 +2259,14 @@ int vfs_ioc_fssetxattr_check(struct inode *inode, const struct fsxattr *old_fa, > !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); > > -- Jan Kara SUSE Labs, CR