Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5697767imm; Wed, 12 Sep 2018 09:43:37 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb6myCjpt7DwZ7FdOmgjCNJuy0GEah6U6QyIKkMvhxzi69mXmHbWuFXin6AN2YMUiJ4csv2 X-Received: by 2002:a63:1921:: with SMTP id z33-v6mr3339827pgl.302.1536770617859; Wed, 12 Sep 2018 09:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536770617; cv=none; d=google.com; s=arc-20160816; b=dHdaMenluZ7iSkZxQn2PyJoZ8XH9eTmcmjXDymCT9HQ4h1+L1S8c5Vv5CEfRN5IpT9 59LfB7NrkNJmH7NeLnsD05US1aXTCP3va98CrjnUzoGpn7njTF/zk++N+LB678foib4N M6AIHhmzG+X3cn75Vz5u3Uewdy9SKCUQQk4VbQ5EYAkRADYij7vbfwkqNAQQqxUwAv9f 0RjOSzsyPSznY/RLz2012YXN4oFpFXuIEGwtoGjdufEeEXQkTKLSnZ7ni9xLtQgFx5ig iiP1M2qptNW1guHffvsHhvLuTv3i9XIK6ffiI7jYnpVxOzuGBlWjjLG53zEU3n9/5DRl 0agQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=MQNS2+MB1WvXQGkFzimTkm0YZw5DiZDJ2X2JPuJ35ag=; b=kdeuH7l7oNZnnONbz2tA64f12A2+6pEHX45FfF9ilc4YqwIJhN74Hv9qqwuFPwlgKC lDpU3pjzUrWrwCEeD+N4eC6J89CpTbyVXzXxhfOtLGVgtcCL8d1Vh2VrMNZTqDC+pExT Loo7byb+ikhHMR6l2gbuOdydYQk5T/ag0hgQP4ytxgjd5qkxCAU2M6QsO4bFSgWYZ185 Y7iThIhjPXtH9eD581jA2xLWNQ1hpi0hgL6IGYcjsdU4jlQhJMd/mLEsf1sRo6up2GTF gpaHXyGN3zb+S2sxZ5BVFD93RWKc6FA76OM5ILG0Ke7G/Pzoe5oWX8EtYPEXiJdGWlZ4 OiMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=NR6YfcU9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id q4-v6si1582566pgh.412.2018.09.12.09.43.10; Wed, 12 Sep 2018 09:43:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=NR6YfcU9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727795AbeILVrE (ORCPT + 99 others); Wed, 12 Sep 2018 17:47:04 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:38713 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726798AbeILVrE (ORCPT ); Wed, 12 Sep 2018 17:47:04 -0400 Received: by mail-oi0-f67.google.com with SMTP id x197-v6so5030054oix.5 for ; Wed, 12 Sep 2018 09:41:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=MQNS2+MB1WvXQGkFzimTkm0YZw5DiZDJ2X2JPuJ35ag=; b=NR6YfcU99ypdGj9sr2JvQW3ENYi+kWO8iNPRGpnfKoElOWQhudS2c+4UQHKZRyOtjY 9sFRu0VK+su1/b6ZeMZSh8z2OAG5PZo884q44fzrbFqpW9Ln37NYBfvslW0JaCt7is5k c6NbEV0vt3sZXSdODnxlIwQBNeWjmoa9+6fBns3KtbWDtzo8U3KP62RetAeKSW37qnEb D5DLQ4GRIpw5JbTSdgF5Qh9TR+3M7HVgTAN2Uk8AfxLRAc7A7BYxfysqnKEGJzpyN+f8 nk4gqQLSo/PLlChtZh/v91cn7Bo/UylKlOs9HNdzbLT36f+gBOnP2gMsOiUtbeCrnhL6 WHQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=MQNS2+MB1WvXQGkFzimTkm0YZw5DiZDJ2X2JPuJ35ag=; b=MR7ICTzsVhh4LotDHt3a5jC2IvdJxZOh1RsGE/PNBvmhL5G629b8hOPi511ez5i+Mu q/hXpcFwwsYk//dbITB23N2uLdb1SBhT4RmJwRBSfx46cRdddxEAHHS77EjryUOJ9wKa mjd2UOFB3Z/QXf+ZpSr+bGjs6TbIRn3yfXUE2iIgmQqiSJVEenMCSiZejZ//WrbbLEN/ veCNnmwN1Yp4XixDLcPHk66YLrHePMzhtiMXV9Puqw2lnR2yJNWQDEEdulPKhzKLISxw 7pciIUt2Ms+J1W8ROdkvrUS+nJeCxAL2KCpGq1avBgtlouuMl9zFiv9wtU3bWlpMyPJr jdDw== X-Gm-Message-State: APzg51ABIUjrx893iZxHLFm5BmHqfcPfIhXF7yw9EkPYK+HfuWdjLIOw OUgS0UXh+FMcfK6/d0bOV0kHorJmmFqmFvdY2KIfcg== X-Received: by 2002:aca:4914:: with SMTP id w20-v6mr3070467oia.5.1536770503164; Wed, 12 Sep 2018 09:41:43 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:8e85:0:0:0:0:0 with HTTP; Wed, 12 Sep 2018 09:41:42 -0700 (PDT) In-Reply-To: <1f1cf9db3981390d2ad5a08d5f1987d9c933e687.camel@hpe.com> References: <20180911154246.6844-1-toshi.kani@hpe.com> <20180911154246.6844-3-toshi.kani@hpe.com> <20180912093140.GB7782@quack2.suse.cz> <1f1cf9db3981390d2ad5a08d5f1987d9c933e687.camel@hpe.com> From: Dan Williams Date: Wed, 12 Sep 2018 09:41:42 -0700 Message-ID: Subject: Re: [PATCH 2/2] ext4, dax: set ext4_dax_aops for dax files To: "Kani, Toshi" Cc: "jack@suse.cz" , "adilger.kernel@dilger.ca" , "linux-ext4@vger.kernel.org" , "linux-nvdimm@lists.01.org" , "linux-kernel@vger.kernel.org" , "tytso@mit.edu" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 12, 2018 at 9:08 AM, Kani, Toshi wrote: > On Wed, 2018-09-12 at 11:31 +0200, Jan Kara wrote: >> On Tue 11-09-18 11:15:18, Dan Williams wrote: >> > On Tue, Sep 11, 2018 at 8:42 AM, Toshi Kani wrote: >> > > Sync syscall to an existing DAX file needs to flush processor cache, >> > > but it does not currently. This is because 'ext4_da_aops' is set to >> > > address_space_operations of existing DAX files, instead of 'ext4_dax_aops', >> > > since S_DAX flag is set after ext4_set_aops() in the open path. >> > > >> > > New file >> > > -------- >> > > lookup_open >> > > ext4_create >> > > __ext4_new_inode >> > > ext4_set_inode_flags // Set S_DAX flag >> > > ext4_set_aops // Set aops to ext4_dax_aops >> > > >> > > Existing file >> > > ------------- >> > > lookup_open >> > > ext4_lookup >> > > ext4_iget >> > > ext4_set_aops // Set aops to ext4_da_aops >> > > ext4_set_inode_flags // Set S_DAX flag >> > > >> > > Change ext4_iget() to call ext4_set_inode_flags() before ext4_set_aops(). >> > > >> > > Fixes: 5f0663bb4a64f588f0a2dd6d1be68d40f9af0086 >> > >> > Same format nit: >> > >> > Fixes: 5f0663bb4a64 ("ext4, dax: introduce ext4_dax_aops") >> > Cc: >> > >> > >> > > Signed-off-by: Toshi Kani >> > > Cc: Jan Kara >> > > Cc: Dan Williams >> > > Cc: "Theodore Ts'o" >> > > Cc: Andreas Dilger >> > > --- >> > > fs/ext4/inode.c | 3 ++- >> > > 1 file changed, 2 insertions(+), 1 deletion(-) >> > > >> > > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c >> > > index 775cd9b4af55..93cbbb859c40 100644 >> > > --- a/fs/ext4/inode.c >> > > +++ b/fs/ext4/inode.c >> > > @@ -4998,6 +4998,8 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) >> > > if (ret) >> > > goto bad_inode; >> > > >> > > + ext4_set_inode_flags(inode); >> > > + >> > >> > Hmm, does this have unintended behavior changes? >> > >> > I notice that there are some checks for flags "IS_APPEND(inode) || >> > IS_IMMUTABLE(inode)" *before* the call to ext4_set_inode_flags(). I >> > didn't look too much deeper at whether those checks are bogus, but it >> > would seem safer to do something like this for a lower risk fix. >> > >> > Thoughts? >> >> Well, safer but it would leave the landmine around for others to hit. >> Toshi, please move the ext4_set_inode_flags() call to be just after the >> assignment: >> >> ei->i_flags = le32_to_cpu(raw_inode->i_flags); >> >> in ext4_iget(). That way people won't introduce checks for i_flags that can >> never hit... And yes, it fixes also other bugs (mostly in sanity checks >> AFAICS) than the DAX issue. > > Sure. Assuming you think the implicit change Dan pointed out is not a > problem, yes, I will go with this cleaner approach. > Yes, Jan's proposal looks best to me.