Received: by 10.223.185.116 with SMTP id b49csp4486094wrg; Mon, 26 Feb 2018 19:37:47 -0800 (PST) X-Google-Smtp-Source: AH8x225hJtvKFzCCOWjmUel/5OhH/X8MOKbgNmKuoZFylZcF15gGkNoWQ1xyOwRMCvd3aJwoJflp X-Received: by 10.101.101.217 with SMTP id y25mr10057685pgv.165.1519702667509; Mon, 26 Feb 2018 19:37:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519702667; cv=none; d=google.com; s=arc-20160816; b=eQv8jnsJdFOzh2cQ8gvdZa5lolmS7atsVMvt+Wix66GpmLyH9prSbskGZvVjdm0+XG UhJH8jsxUxZ3fHk+4MB0pFYTioq7UaEfHO5eJZabqtxvFKNFyPwEAtaX/xyAeU4VSBpo L1blDbsdTmJBEDyF+hRC95GnyNdkacbQnS/PddPsF4+xGkA31tlOURB9d+8ORZET7Isx mZ0DJ1d6WNYzc8/flly+h7qIveFnddv7pj5JWBOyRC5GBC9Hh80p/Uzj6sok/czaYwxU Vu7z915IaibOtmDK/f8wQll3wf2jyNenQLH9J/j8xwPz3GrgZUR4Rx91N/5Xx0bvnUl4 MnBg== 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=DJ1NW+Y3wAewRPRD6BH8mB0FdHM5p5NZsDgarMYJUm8=; b=UumB3WZKs9hnsXPn8PPe1e9tgeCULlRLmSbimh1s0JzvMEh6pFX4jMNHv9kpxk7Qpt /cXmsdq8UC4T+h8MuA0rrKMjzC71EWz5eQxBQlcMg7quwCsZUF7OMKfQMJySR3n7/d/J CTwJY12l3lMDR7WIjKHM+l4nJeIiVLFFW16+vjoM2bSn5vK8yeDLr1tYhDZv/4QLV7vO r2ZPcC4fI/46KrclsCeSzdHCAAnoDsoJSumIQjYU6kZenxp0XyBMbyKOaNmqb7ZkZNwm OFgbemxXVJySUaGp6L9wBP/nmdFblbgrGkTdziEB/StqL5u5UdjIvnCHtKER3DJuSatZ 7pow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=YLpEwvAD; 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 g7-v6si7813780pll.826.2018.02.26.19.37.32; Mon, 26 Feb 2018 19:37:47 -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=YLpEwvAD; 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 S1751631AbeB0Dgw (ORCPT + 99 others); Mon, 26 Feb 2018 22:36:52 -0500 Received: from mail-io0-f176.google.com ([209.85.223.176]:38989 "EHLO mail-io0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751507AbeB0Dgu (ORCPT ); Mon, 26 Feb 2018 22:36:50 -0500 Received: by mail-io0-f176.google.com with SMTP id b34so19631347ioj.6; Mon, 26 Feb 2018 19:36:50 -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=DJ1NW+Y3wAewRPRD6BH8mB0FdHM5p5NZsDgarMYJUm8=; b=YLpEwvAD/R8e7TJlIRkTPoKk9ICtW01cbI83HWnUbfCdvYdY2MNMS34g6qP0z/Z4eA PjO1l+c3YOSo16dhWeqGsDVYbppPBQB1GA/teDBHt8S7+g3qoxzDuEfIuBDIt96OQ0R1 P9PfuVjb/WT9RyFE4QhUY2TznGMq7AMue0CGo534eBGOlsyqqjwqmj1tXY2a7VU1ABch +biio+ZoHOlBMVB7knvtFJiwFN+tfcEsKUvisruDCZrd5TXpscjjKqCH9UdFj/qv9MFA xTTFmyZqrJYNV2T8wl1r2J7r67KbqDUdwwjxV/j57AB5OiMdCx2BoNoozFFFxpfuSppl aBVg== 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=DJ1NW+Y3wAewRPRD6BH8mB0FdHM5p5NZsDgarMYJUm8=; b=nJKNNZcpL08cwKniMH7BIkpSAQbGpmMlCpaFUrGT9xcCf4V0NvFGNqEsa/LUxCKu0R DBa1j/bS6x9X8sGsYN0/gAkAGm50D/PMaI2PG7K+gL5FyzdeHEw+r8XtFpzBMLSIvc24 fYY7BmCdppGeW1n1RzZAnBhlzfRqX7p11FKB3PvRVF4ugF2AmeIt8rJEvrOWqQFthPkf BTL2jyyAjk9vXcSC964wQ0n5uhqw+jzu3OPvm93NbfWclnm2cXf/HW6JpGplacZzkULM ddwMyz16Z1y32tnuXm5a5uPmxiE2IY0oDpYOJ5uqUtTlxE1cLq/0YzbWo9ZhMD6MLG9M xk7Q== X-Gm-Message-State: APf1xPAg4uZdPfnrWHUf8GlS6wCpNPMVRhlPVpEL7RSRKky8ttDChyLq NOazAMfvlGGwvoEq/4zBzf5cdLngX2DU7cTjjOM= X-Received: by 10.107.9.138 with SMTP id 10mr14107742ioj.257.1519702609819; Mon, 26 Feb 2018 19:36:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.135.221 with HTTP; Mon, 26 Feb 2018 19:36:48 -0800 (PST) In-Reply-To: <87r2p7rvn5.fsf@xmission.com> References: <87po4rz4ui.fsf_-_@xmission.com> <20180226235302.12708-3-ebiederm@xmission.com> <87r2p7rvn5.fsf@xmission.com> From: Linus Torvalds Date: Mon, 26 Feb 2018 19:36:48 -0800 X-Google-Sender-Auth: -nKnweAw8x76Ioyruwq9CyN5L1A Message-ID: Subject: Re: [PATCH v7 3/7] fs/posix_acl: Document that get_acl respects ACL_DONT_CACHE To: "Eric W. Biederman" Cc: Miklos Szeredi , Linux Kernel Mailing List , Linux Containers , linux-fsdevel , Alban Crequy , Seth Forshee , Sargun Dhillon , Dongsu Park , "Serge E. Hallyn" 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, Feb 26, 2018 at 6:53 PM, Eric W. Biederman wrote: > > So the purpose for having a patch in the first place is that > 2a3a2a3f3524 ("ovl: don't cache acl on overlay layer") > which addded ACL_DONT_CACHED did not result in any comment updates > to get_acl. I'm not opposed to just updating the comments. I just think your updates were somewhat misleading. > Which mean that if you read the comments in get_acl() that you > don't even think of ACL_DONT_CACHED. Right. By all means add a comment about ACL_DONT_CACHE disabling the cache entirely. But don't _remove_ the other valid way to flush the cache, and don't make that comment above cmpxchg() be even more confusing than the code is. > Does this look better as a comment updating patch? > > diff --git a/fs/posix_acl.c b/fs/posix_acl.c > index 2fd0fde16fe1..5453094b8828 100644 > --- a/fs/posix_acl.c > +++ b/fs/posix_acl.c > @@ -98,6 +98,11 @@ struct posix_acl *get_acl(struct inode *inode, int type) > struct posix_acl **p; > struct posix_acl *acl; > > + /* > + * To avoid caching the result of ->get_acl > + * set inode->i_acl = inode->i_default_acl = ACL_DONT_CACHE; > + */ > + > /* > * The sentinel is used to detect when another operation like > * set_cached_acl() or forget_cached_acl() races with get_acl(). > @@ -126,9 +131,7 @@ struct posix_acl *get_acl(struct inode *inode, int type) > /* fall through */ ; > > /* > - * Normally, the ACL returned by ->get_acl will be cached. > - * A filesystem can prevent that by calling > - * forget_cached_acl(inode, type) in ->get_acl. > + * The ACL returned by ->get_acl will be cached. Why do you hate forget_cached_acl()? It's perfectly valid too. Don't remove that comment. Maybe reword it to talk not about "preventing", but about "invalidating the cache". But the old comment that you remove isn't _wrong_, it's just that the "preventing" from returning the cached state with forget_cached_acl() is just a one-time thing. So forget_cached_acl() exists, and it works, and it does exactly what its name says. It is a perfectly valid way to prevent the current entry from being used in the future. See? I object to you removing that, and trying to make it be like ACL_DONT_CACHE is the *onyl* way to not cache something. Because honestly, that's what your comment updates do. They take the comments about _one_ case, and switch it over to be about the _othger_ case. But dammit, there are _two_ ways to not cache things. "Fixing" the comment to talk about one and removing the other isn't a fix. It's just a stupid change that now has the problem the other way around! So fix the comment to really just talk about both things. First: talk about how to avoid caching entirely (ACL_DONT_CACHE). Then, talk about how to invalidate the cache once it has been instantiated (forget_cached_acl()). Don't do this idiotic "remove the valid comment just because you happened to care about the _other_ case" Linus