Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2386777ybv; Fri, 21 Feb 2020 14:44:49 -0800 (PST) X-Google-Smtp-Source: APXvYqz7DeNJq95o8m9fpbOnjeXfS9TfNvMhUgr1q5nZypIG9XFqfBPWg++STEllhYe1ZXo/ixEM X-Received: by 2002:a05:6808:a83:: with SMTP id q3mr4151354oij.0.1582325089072; Fri, 21 Feb 2020 14:44:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582325089; cv=none; d=google.com; s=arc-20160816; b=x4kc0gvvK6LGQHTUHLDk1YArA7U4SRzffNDoZfDMAgS0IebyffF5/MHahF6H38MtG1 gmuJ0urlV/sKIe/KS18zVf47ethgDqKhI9uD+yLGfo8x6NJbuAYTfCGEUxES1HkdZtoR OnttC6sksDPJ97bhTpP9TZC43RQITuD6xMgNdckEPp/y6tDCQk1qMMdEZby/qT2IYni5 gVGljfKUDE37saEXf8SS4mZt6Oy9RkmkAT25GnUileQ+HY9ANvf02hXYBO7QlJU1qc1c 3TBDgMwQDmWcfGuidiZ0ueS3cMNpJ/EHtngUFBwvpdLa4+HJpaISXRA5ot9i8i9yUsa8 xtJg== 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=1ESOyPJ0zlwBl/J+ecs/TDI2g3dviu1Nn+hxY15+JeQ=; b=PQmkDlz2OUAsmsUXmTL7sp3ZahkiZmhxS7CniR+NcI9lB9u1jDuXn/pNTeEcsncmQ1 LMaNYuAxyzIwAzbuKOhMIClG2Svyipwuv8FhBk2SvdaktGeGpyh23b1YPLiNkDRcUVwh kfG6lzT7c5Ehe8kvs+RkQ9KWezDQMgtfiNqrcqUz/eiu0HIwJQxv5nQmAWgs7a9R8K9V ayjjvDFuf60aBwXxAoQx09GWPay/KzxZelS7Eu7BryGa9c3gN1VKrMCeJ+1mGP10KNnB YKj3s0RoWvn4JkiwpmfKK3mwVZOak2ELUTRXT3UjrM1B9EZdIICn85xOf6ctnvsQzGdg zPNA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y23si2126659oti.65.2020.02.21.14.44.36; Fri, 21 Feb 2020 14:44:49 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729266AbgBUWo1 (ORCPT + 99 others); Fri, 21 Feb 2020 17:44:27 -0500 Received: from mail104.syd.optusnet.com.au ([211.29.132.246]:39462 "EHLO mail104.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726802AbgBUWo1 (ORCPT ); Fri, 21 Feb 2020 17:44:27 -0500 Received: from dread.disaster.area (pa49-195-185-106.pa.nsw.optusnet.com.au [49.195.185.106]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id D5E3782097C; Sat, 22 Feb 2020 09:44:21 +1100 (AEDT) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1j5H1v-0004KQ-A8; Sat, 22 Feb 2020 09:44:19 +1100 Date: Sat, 22 Feb 2020 09:44:19 +1100 From: Dave Chinner To: Christoph Hellwig Cc: ira.weiny@intel.com, linux-kernel@vger.kernel.org, Alexander Viro , "Darrick J. Wong" , Dan Williams , "Theodore Y. Ts'o" , Jan Kara , linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH V4 07/13] fs: Add locking for a dynamic address space operations state Message-ID: <20200221224419.GW10776@dread.disaster.area> References: <20200221004134.30599-1-ira.weiny@intel.com> <20200221004134.30599-8-ira.weiny@intel.com> <20200221174449.GB11378@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200221174449.GB11378@lst.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=X6os11be c=1 sm=1 tr=0 a=bkRQb8bsQZKWSSj4M57YXw==:117 a=bkRQb8bsQZKWSSj4M57YXw==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=l697ptgUJYAA:10 a=QyXUC8HyAAAA:8 a=7-415B0cAAAA:8 a=dh8Lkc1bKYycxuq4kUYA:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 21, 2020 at 06:44:49PM +0100, Christoph Hellwig wrote: > On Thu, Feb 20, 2020 at 04:41:28PM -0800, ira.weiny@intel.com wrote: > > From: Ira Weiny > > > > DAX requires special address space operations (aops). Changing DAX > > state therefore requires changing those aops. > > > > However, many functions require aops to remain consistent through a deep > > call stack. > > > > Define a vfs level inode rwsem to protect aops throughout call stacks > > which require them. > > > > Finally, define calls to be used in subsequent patches when aops usage > > needs to be quiesced by the file system. > > I am very much against this. There is a reason why we don't support > changes of ops vectors at runtime anywhere else, because it is > horribly complicated and impossible to get right. IFF we ever want > to change the DAX vs non-DAX mode (which I'm still not sold on) the > right way is to just add a few simple conditionals and merge the > aops, which is much easier to reason about, and less costly in overall > overhead. *cough* That's exactly what the original code did. And it was broken because page faults call multiple aops that are dependent on the result of the previous aop calls setting up the state correctly for the latter calls. And when S_DAX changes between those calls, shit breaks. It's exactly the same problem as switching aops between two dependent aops method calls - we don't solve anything by merging aops and checking IS_DAX in each method because the race condition is still there. /me throws his hands in the air and walks away -Dave. -- Dave Chinner david@fromorbit.com