Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1598379ybb; Thu, 9 Apr 2020 05:30:40 -0700 (PDT) X-Google-Smtp-Source: APiQypI547W1vKT70DlxFFmNjqnyHjS7iJX8DzFXiTXFJYC6sHBUHIlKg8RbM2iOTSYxEQmjiCoZ X-Received: by 2002:a05:620a:13eb:: with SMTP id h11mr10512328qkl.404.1586435440715; Thu, 09 Apr 2020 05:30:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586435440; cv=none; d=google.com; s=arc-20160816; b=aVLd0l+JEbI1x4NAZAzDD3hm1HDHvdTXgXKf2u8iJKjdJbNeNGamDVc7KfakMIrE2B FL1HEa6yCnMGKEGIGF6N1e/isJjO+tYh+5cYn2ppVkpEOJ0bZ+xRTOC1WOx/Pbgh5RzY Bx59XrN0ATxFjolDgAHe2MXqcpkVdzCSXlwTdE3TC8EFDG1kvICRNog7gL30230uULUp glwIY4xPAKmEU/su5oMn0wV7jZ5V6bvQs7NPpS9Kl7uwlrwMrD2THhSXzESGdogpcp7r EC4eUhRkluO/rs4oRmp99LCfCuojCta0xQZGv2tZTN6l4HWkz240vLrK8TuoynOcB74c 30KQ== 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=PzNI8JuN3Ai8hidPoPMG5ayFBTm0CDpDALn0ghCEZO0=; b=updC2TEmDsOHMgNJtKsbORQz09dQfiXxX6VRjLpNqeEAy/Pf1ujn77yxtMt4W37iQU 4OkyV+iOzmbv7n4cV4FLDnQ+tl+GeK/UBmu9nEYII8fqJz6JdsYO+w0ihrKIHUp+GmC+ okSEO21MWRKXrWXgVTH3AIQOfL+tp5e+G/vhI0hiHVGZyDXvoQ7gGsFEjvtQdJUy2H9U Iyzdwoi3zsYlt5vYQnoevDHbZk9bx8ezCP5AtFzL1I4YWGB/37mXqcoSpS1VMhRk+dr/ DrSMTS1uU9gVgwZuA7jjaPSIqnPwswy4BVyuBMd8pg4gtneENkwWJau9FnPBgH8vd1we QR3w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 x13si5100100qvp.100.2020.04.09.05.30.14; Thu, 09 Apr 2020 05:30:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725987AbgDIM3B (ORCPT + 99 others); Thu, 9 Apr 2020 08:29:01 -0400 Received: from verein.lst.de ([213.95.11.211]:46513 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725970AbgDIM3B (ORCPT ); Thu, 9 Apr 2020 08:29:01 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id DE2B068C4E; Thu, 9 Apr 2020 14:28:56 +0200 (CEST) Date: Thu, 9 Apr 2020 14:28:56 +0200 From: Christoph Hellwig To: Dave Chinner Cc: Ira Weiny , Jan Kara , linux-kernel@vger.kernel.org, "Darrick J. Wong" , Dan Williams , Christoph Hellwig , "Theodore Y. Ts'o" , Jeff Moyer , linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH V6 7/8] fs/xfs: Change xfs_ioctl_setattr_dax_invalidate() to xfs_ioctl_dax_check() Message-ID: <20200409122856.GA17929@lst.de> References: <20200407182958.568475-1-ira.weiny@intel.com> <20200407182958.568475-8-ira.weiny@intel.com> <20200408022318.GJ24067@dread.disaster.area> <20200408095803.GB30172@quack2.suse.cz> <20200408210950.GL24067@dread.disaster.area> <20200408222636.GC664132@iweiny-DESK2.sc.intel.com> <20200408234817.GP24067@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200408234817.GP24067@dread.disaster.area> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Apr 09, 2020 at 09:48:17AM +1000, Dave Chinner wrote: > > Christoph in particular said that a 'lazy change' is: "... straight from > > the playbook for arcane and confusing API designs." > > > > "But returning an error and doing a lazy change anyway is straight from > > the playbook for arcane and confusing API designs." > > > > -- https://lore.kernel.org/lkml/20200403072731.GA24176@lst.de/ > > > > Did I somehow misunderstand this? > > Yes. Clearing the on-disk flag successfully should not return an > error. > > What is wrong is having it clear the flag successfully and returning > an error because the operation doesn't take immediate effect, then > having the change take effect later after telling the application > there was an error. > > That's what Christoph was saying is "straight from the playbook for > arcane and confusing API designs." Yes. > There's absolutely nothing wrong with setting/clearing the on-disk > flag and having the change take effect some time later depending on > some external context. We've done this sort of thing for a -long > time- and it's not XFS specific at all. > > e.g. changing the on-disk APPEND flag doesn't change the write > behaviour of currently open files - it only affects the behaviour of > future file opens. IOWs, we can have the flag set on disk, but we > can still write randomly to the inode as long as we have a file > descriptor that was opened before the APPEND on disk flag was set. > > That's exactly the same class of behaviour as we are talking about > here for the on-disk DAX flag. Some people consider that a bug, though. But I don't think we can change that now. In general I don't think APIs that don't take immediate effect are all that great, but in some cases we can live with them if they are properly documented. But APIs that return an error, but actually take effect later anyway are just crazy.