Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp777532ybs; Sun, 24 May 2020 21:42:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfSMpleoAtxhxc8+JlK11MiTZq2UcbvNIsTBskb4KGgFaScKwHGpflDwf/E+F0Xw0T09mh X-Received: by 2002:a17:906:d10f:: with SMTP id b15mr16822061ejz.227.1590381731214; Sun, 24 May 2020 21:42:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590381731; cv=none; d=google.com; s=arc-20160816; b=qquorVvb3hJz6TL5n7+A9ajLevqUmL9DR1tH7OoxN1HIRnVKnhramEXZK5knJcisAa 9PxH/EEyUDxznjsd6o8n1YbFXRSro2AEAu5SpjU1+o3EneKPVOKgLwLKJWaLus6t8YKc XD0uhbNqAVM09IOSk4w+WDpg3LKSTuUxUwQFVk3A+7bQ2wJlQOqI9P7GPwNJl6MqLiNC JRQUSm/uvnx70if/MsktCV2hqGNEBFl3OBj5c+zXp5OhhGRkpjr4Q8hUe3E9N5Eir/V7 xGhUKIe2LJCUe5yw32d6yOoZFELUxM/me5zLXl1Rt3w3Ug/A0h/6NvXEfTnm7CQ3drsv 3cjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=K3IoPmqZ1vIXf8JnmbYj4GsIKAFFkjbBgY+grE/t13E=; b=DpHtyTrp1wjNQ+f5N6Nbui6Bsy3e42wqzzop8QqasnRWRDWTbcrJCd72XvUtQ/r65j FQ1TK8lIJpCLOEJPJJKrQoljY6Di5mr/pwr1T9+0U3z9ZtZQVSyXzdH1RzNgkAmqoeyJ UK4QQn97xRJk7nWYyqxBYN18MliNH9q3IvGenm2M+XucJndeisyvYp17OkjzOEKBT7L5 B3HkMhfMTBJnYaAkIJ0W+RgaEOYS2vtRABDKzLxFbfzjw62pUsjXMd2xmGmOZ2MBPBSK kFCLeIkPPByQoj+ipC9r2u9FTVad9rZd2x59F2H30Qc7yNNqkKweZ2dH6UFDEv7Fjrkx J8tQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g59si9123319edd.467.2020.05.24.21.41.48; Sun, 24 May 2020 21:42:11 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728879AbgEYEjM (ORCPT + 99 others); Mon, 25 May 2020 00:39:12 -0400 Received: from mga04.intel.com ([192.55.52.120]:12919 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725949AbgEYEjL (ORCPT ); Mon, 25 May 2020 00:39:11 -0400 IronPort-SDR: 02gefz82HyRqGfp/DRwWDX50sWBfFAzDWMGuXzBsU1a73YdFMPpbQM72TATUXdRw5AdQA3eSLW 2+0/b/HqfNPQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2020 21:39:11 -0700 IronPort-SDR: mkPIiir/SIIp5RsIl2SkJX+dMgspH7qHmH92MoBbroHS+PWpT9tKflWqEGsybUNTzLAYcNacxR ymSYNh1hOXyA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,432,1583222400"; d="scan'208";a="269644158" Received: from iweiny-desk2.sc.intel.com ([10.3.52.147]) by orsmga006.jf.intel.com with ESMTP; 24 May 2020 21:39:10 -0700 Date: Sun, 24 May 2020 21:39:10 -0700 From: Ira Weiny To: Jan Kara Cc: linux-ext4@vger.kernel.org, Andreas Dilger , "Theodore Y. Ts'o" , Eric Biggers , Al Viro , Dan Williams , Dave Chinner , Christoph Hellwig , Jeff Moyer , "Darrick J. Wong" , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V4 7/8] fs/ext4: Introduce DAX inode flag Message-ID: <20200525043910.GA319107@iweiny-DESK2.sc.intel.com> References: <20200521191313.261929-1-ira.weiny@intel.com> <20200521191313.261929-8-ira.weiny@intel.com> <20200522114848.GC14199@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200522114848.GC14199@quack2.suse.cz> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 22, 2020 at 01:48:48PM +0200, Jan Kara wrote: > On Thu 21-05-20 12:13:12, ira.weiny@intel.com wrote: > > From: Ira Weiny > > > > Add a flag to preserve FS_XFLAG_DAX in the ext4 inode. > > > > Set the flag to be user visible and changeable. Set the flag to be > > inherited. Allow applications to change the flag at any time with the > > exception of if VERITY or ENCRYPT is set. > > > > Disallow setting VERITY or ENCRYPT if DAX is set. > > > > Finally, on regular files, flag the inode to not be cached to facilitate > > changing S_DAX on the next creation of the inode. > > > > Signed-off-by: Ira Weiny > > ... > > > @@ -303,6 +318,16 @@ static int ext4_ioctl_setflags(struct inode *inode, > > unsigned int jflag; > > struct super_block *sb = inode->i_sb; > > > > + if (ext4_test_inode_flag(inode, EXT4_INODE_DAX)) { > > + if (ext4_test_inode_flag(inode, EXT4_INODE_VERITY) || > > + ext4_test_inode_flag(inode, EXT4_INODE_ENCRYPT) || > > + ext4_test_inode_state(inode, > > + EXT4_STATE_VERITY_IN_PROGRESS)) { > > + err = -EOPNOTSUPP; > > + goto flags_out; > > + } > > + } > > The way this check is implemented wouldn't IMO do what we need... It > doesn't check the flags that are being set but just the current inode > state. I think it should rather be: Sorry, I got confused by the flags when I wrote this. > > if ((flags ^ oldflags) & EXT4_INODE_DAX_FL) { > ... > } > > And perhaps move this to a place in ext4_ioctl_setflags() where we check > other similar conflicts. Sure. It seems like a ext4_setflags_prepare() helper would be in order. I'll see what I can do. > > And then we should check conflicts with the journal flag as well, as I > mentioned in reply to the first patch. There it is more complicated by the > fact that we should disallow setting of both EXT4_INODE_DAX_FL and > EXT4_JOURNAL_DATA_FL at the same time so the checks will be somewhat more > complicated. I'm confused by jflag. Why is EXT4_JOURNAL_DATA_FL stored in jflag? Ira > > Honza > > > + > > /* Is it quota file? Do not allow user to mess with it */ > > if (ext4_is_quota_file(inode)) > > goto flags_out; > -- > Jan Kara > SUSE Labs, CR