Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5194568ybv; Tue, 11 Feb 2020 10:58:25 -0800 (PST) X-Google-Smtp-Source: APXvYqx9NzKvvHfNfRoaJ3Xgq+nD/GxvaGqik6gjK829xA8elNTqP1aE3PaLcqBLnm9qlJKyL4c2 X-Received: by 2002:aca:f10:: with SMTP id 16mr3647910oip.117.1581447505451; Tue, 11 Feb 2020 10:58:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581447505; cv=none; d=google.com; s=arc-20160816; b=tVRzJB8T2wjSyo/m5+ZN0HXf2JR4+ANvFmMH9M7d51UTztpuZvvHZskKPP5wLytnJ7 EHZz0yXSqgJLFzoq5zfZnStKqSgWwMpxHmaDMX+a4Ns6ef2XP5nK+E6wQJoe7pBfWZqF iE4p//P/WfC1o6/v0WYGwTo+8uQx8ZpddNFVwtng/wvFTO37yqhltqNmbBCX/PRpTRUp t67fSEdjhOYFPVbV03k1ez2PhxWjiSLeXRebKhXG/GXorutjhVPg9sFR5Oy4Nq1KqkGs rNaid+M4i/lqfAojd3JEGkbVSQlowbnEcdYCFIAldAjaLeMjIrWnA1Ccx/R0FPzt837J Oc/Q== 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; bh=ZcZ2N8Xy8jJyvVp1rSvO5i7JwOVcm/1t331mFC02Udg=; b=iAY1iDJxTyFJVr5t4eoupffSPXn8ahKuFftn/pGT4XxU5akKIylPQVkB+AThdgWxyA kLbsuz4RiLlNbNAw58qB+JQ1v0G0v1CpmAuG7j7wcS8VxoekP65+4F574fdr5/l+ho3m cl4VB311m4gTeWzVU3J7+ifdqzM8nGWPu5HdiUMpqRkFwx/0yQLGBvk+fRp4NpSe5qg3 ltoaY1XUtNiJR1EpzY6HuLbGXL0xNL+DcPJt8NljrT5hEqEklo7NINjxXraCGjzsZAcJ kPrcX/SIyTcVT7Lhk/kYXzo41x/73lyiZm6U1y5QDXiCxSVvPbXRLdZO09QWkvmT5p8b nZFw== ARC-Authentication-Results: i=1; mx.google.com; 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 d23si2081586oij.270.2020.02.11.10.58.14; Tue, 11 Feb 2020 10:58:25 -0800 (PST) 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; 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 S1730021AbgBKQid (ORCPT + 99 others); Tue, 11 Feb 2020 11:38:33 -0500 Received: from mga06.intel.com ([134.134.136.31]:63625 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728049AbgBKQid (ORCPT ); Tue, 11 Feb 2020 11:38:33 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Feb 2020 08:38:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,428,1574150400"; d="scan'208";a="405993172" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by orsmga005.jf.intel.com with ESMTP; 11 Feb 2020 08:38:31 -0800 Date: Tue, 11 Feb 2020 08:38:31 -0800 From: Ira Weiny To: Dave Chinner Cc: linux-kernel@vger.kernel.org, Jan Kara , Alexander Viro , "Darrick J. Wong" , Dan Williams , Christoph Hellwig , "Theodore Y. Ts'o" , linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v3 05/12] fs: remove unneeded IS_DAX() check Message-ID: <20200211163831.GC12866@iweiny-DESK2.sc.intel.com> References: <20200208193445.27421-1-ira.weiny@intel.com> <20200208193445.27421-6-ira.weiny@intel.com> <20200211053401.GE10776@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200211053401.GE10776@dread.disaster.area> 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 Tue, Feb 11, 2020 at 04:34:01PM +1100, Dave Chinner wrote: > On Sat, Feb 08, 2020 at 11:34:38AM -0800, ira.weiny@intel.com wrote: > > From: Ira Weiny > > > > The IS_DAX() check in io_is_direct() causes a race between changing the > > DAX state and creating the iocb flags. > > > > Remove the check because DAX now emulates the page cache API and > > therefore it does not matter if the file state is DAX or not when the > > iocb flags are created. > > This statement is ... weird. > > DAX doesn't "emulate" the page cache API at all ah... yea emulate is a bad word here. > - it has it's own > read/write methods that filesystems call based on the iomap > infrastructure (dax_iomap_rw()). i.e. there are 3 different IO paths > through the filesystems: the DAX IO path, the direct IO path, and > the buffered IO path. > > Indeed, it seems like this works a bit by luck: Ext4 and XFS always > check IS_DAX(inode) in the read/write_iter methods before checking > for IOCB_DIRECT, and hence the IOCB_DIRECT flag is ignored by the > filesystems. i.e. when we got rid of the O_DIRECT paths from DAX, we > forgot to clean up io_is_direct() and it's only due to the ordering > of checks that we went down the DAX path correctly.... > > That said, the code change is good, but the commit message needs a > rewrite. How about? fs: Remove unneeded IS_DAX() check The IS_DAX() check in io_is_direct() causes a race between changing the DAX state and creating the iocb flags. Remove the check because DAX now has it's own read/write methods and file systems which support DAX check IS_DAX() prior to IOCB_DIRECT. Therefore, it does not matter if the file state is DAX when the iocb flags are created, and we can avoid the race. Reviewed-by: Jan Kara Signed-off-by: Ira Weiny Ira > > Cheers, > > Dave. > -- > Dave Chinner > david@fromorbit.com