Received: by 10.223.176.5 with SMTP id f5csp3478821wra; Mon, 29 Jan 2018 13:52:06 -0800 (PST) X-Google-Smtp-Source: AH8x227PvO+bEfx0vS0zCcajkoQ/2PnQy4B19zecUSIKg5BttJzbTepKtxlKgsXXkC4CIrBef09j X-Received: by 2002:a17:902:4523:: with SMTP id m32-v6mr14690474pld.449.1517262726577; Mon, 29 Jan 2018 13:52:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517262726; cv=none; d=google.com; s=arc-20160816; b=iiM5aBoN1GqN9lUqLF1onWJvX1yGvHuKb6jQA076RwIhJvPvtUKVeC+pQNhAQFAl0W 4s5Q7fAtte1yqAT9NBSt3yPCT0NXZRGAqKxQJe08la2qSYnjZAde2XPSQSJ2vPTHASud u97pkeGoWjaDA2ixtQaGJ+WFdRyMnZxjuOqhUzCGviuBBH1UrZTUQB7Tnoj21Kuhw2J7 NdELLwrqzTBxVC3nH2/dYODGmcW7JaHwQQYAbOuyFzKyi0mzd3XnBn+WJQ9ug7uMeaZR 97LSzRw8787C0SRNgZOMCSuF+qRV8OroTzOYhDtZ/LfMp2hwB8K1m0sKvrbMskcGfCCs zCxw== 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 :arc-authentication-results; bh=eeMus06KklkCitKLWZhR7OBOYazonc2bmY+VbRiDxy8=; b=t9ersgPPg75ZpGh6X8FYO2FWvll1e2W3+GKkshE+VOc3m2VDeHbp/VUflm5FqIss0g fsAFIP4MqPPzevJDr62IqdE9kOeBrxjc47/wHDB7OHGp/OOGS7+MwknEgShNOa8EIiBK 8hpAJpHh0yiz8bKUJZNQuiwltFAUl4w+rJUpfWVKsK1JhGDsuYQ/BdQrOWdGwwNS7vDS Q83sOKYTcdqvHLz9gaxxJwiTRQD/3yTa+gDIXcXJyvtzxJKE58xO2LFmz4nXTVoeEo84 gbO+vVdEtmG6XhQT58t/IEW9LYMDOXNopyILVAGdQg7N4j1PyZdSmHtwrr7D8I6q45qw kGmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=F7YKVa3T; 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 y5si92282pfl.267.2018.01.29.13.51.52; Mon, 29 Jan 2018 13:52:06 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=F7YKVa3T; 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 S1752093AbeA2Vux (ORCPT + 99 others); Mon, 29 Jan 2018 16:50:53 -0500 Received: from mail-it0-f41.google.com ([209.85.214.41]:33606 "EHLO mail-it0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751574AbeA2Vut (ORCPT ); Mon, 29 Jan 2018 16:50:49 -0500 Received: by mail-it0-f41.google.com with SMTP id u12so627169ite.0; Mon, 29 Jan 2018 13:50:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=eeMus06KklkCitKLWZhR7OBOYazonc2bmY+VbRiDxy8=; b=F7YKVa3TQKNfhCNMAq+HZQ/0VeNVdIJPHJ5CO4+1mH3YMwtZ3P6wNV3MEa/wPN3dUq Eva9N51NpVND/8FTg6KJbCxhUDJELiFDAYtfMuZB5zF2TUJQ8kAVcCo/UtFwnTP1/7D3 G4tJmt4NvPyktn5xotPONWkp4SQ6MYLkcjxfJ7y7tw1jnMf66KD3QfYXRwGOsiW13TDK wfbpwuY985Br3L++P0zmU997QA/G6J4ftIpXj9otQ2btuvpq0tE/FnhiIxdfbZpp+qcP 3kdLZeS1mIzXSuyqyQdaRPLThvbCG3IhIsSw006sI08bP1s1LPQz4pFo+LOMWJ6+isVs FKfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=eeMus06KklkCitKLWZhR7OBOYazonc2bmY+VbRiDxy8=; b=kH2kxJgcDNIbHZjOmWJNuyxA13gCDdL/u/Sezy8rpjiWDJBZ3oFHi2ZTeLG6ur1WYc g4qM43OaxTBgqoepzDeVDZHAqUzhe0c758Scq4v3UVUprM2eLFqJq1kgFbRR/6H1jN1/ RNute5lruuExV6M2dSRT3VwTyrTfg6lHvkzzv7meJoUPPvpEzxXym4+3SHzXl6T2C7fC yCu8JaWzJUrrGTxN10M2KM9tXbscMcKDR2K8UecL9f+QDoe5kmCeh+ouEl9m/cvQ3J4r haaEArP+nC9KKz+tTZii+5U9XmbEXgPa5VuZtwr4PIE4ZfkTcM0gHRzb5YTKBEvsOezL osgQ== X-Gm-Message-State: AKwxytfoTErqnKVbKxGWKICP0QshN2Npw/g8j0ue0yEo3R+rH6eT45PT bjjgDudbNEcxFhp80ZDetsU6dAYg4v7Lnth7M0o= X-Received: by 10.36.47.5 with SMTP id j5mr27744477itj.123.1517262648477; Mon, 29 Jan 2018 13:50:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.59.196 with HTTP; Mon, 29 Jan 2018 13:50:47 -0800 (PST) In-Reply-To: <1517228795.5965.24.camel@redhat.com> References: <1517228795.5965.24.camel@redhat.com> From: Linus Torvalds Date: Mon, 29 Jan 2018 13:50:47 -0800 X-Google-Sender-Auth: phLgjEgrgDsyI25E7jZVMkrz1Nc Message-ID: Subject: Re: [GIT PULL] inode->i_version rework for v4.16 To: Jeff Layton Cc: open list , "" , Al Viro , xfs , "open list:NFS, SUNRPC, AND..." , linux-btrfs , linux-integrity , Andrew Morton , "linux-ext4@vger.kernel.org" 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 Mon, Jan 29, 2018 at 4:26 AM, Jeff Layton wrote: > > This pile of patches is a rework of the inode->i_version field. We have > traditionally incremented that field on every inode data or metadata > change. Typically this increment needs to be logged on disk even when > nothing else has changed, which is rather expensive. Hmm. I have pulled this, but it is really really broken in one place, to the degree that I always went "no, I won't pull this garbage". But the breakage is potential, not actual, and can be fixed trivially, so I'll let it slide - but I do require it to be fixed. And I require people to *think* about it. So what's to horribly horribly wrong? The inode_cmp_iversion{+raw}() functions are pure and utter crap. Why? You say that they return 0/negative/positive, but they do so in a completely broken manner. They return that ternary value as the sequence number difference in a 's64', which means that if you actually care about that ternary value, and do the *sane* thing that the kernel-doc of the function implies is the right thing, you would do int cmp = inode_cmp_iversion(inode, old); if (cmp < 0 ... and as a result you get code that looks sane, but that doesn't actually *WORK* right. To make it even worse, it will actually work in practice by accident in 99.99999% of all cases, so now you have (a) subtly buggy code (b) that looks fine (c) and that works in testing which is just about the worst possible case for any code. The interface is simply garbage that encourages bugs. And the bug wouldn't be in the user, the bug would be in this code you just sent me. The interface is simply wrong. So this absolutely needs to be fixed. I see two fixes: - just return a boolean. That's all that any current user actually wants, so the ternary value seems pointless. - make it return an 'int', and not just any int, but -1/0/1. That way there is no worry about uses, and if somebody *really* cares about the ternary value, they can now use a "switch" statement to get it (alternatively, make it return an enum, but whatever). That "ternary" function that has 18446744069414584320 incorrect return values really is unacceptable. Linus