Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp278654rdb; Sat, 30 Sep 2023 04:26:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFma6/yD7uhBpP5WAdnTJZB5RwheGWtHt8u2nwneIcc0rdAw76hr7gO8gvPNVI5hPkRdas3 X-Received: by 2002:a17:90a:b304:b0:277:5cd5:6f80 with SMTP id d4-20020a17090ab30400b002775cd56f80mr10621139pjr.16.1696073159716; Sat, 30 Sep 2023 04:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696073159; cv=none; d=google.com; s=arc-20160816; b=J7TLH5CaXIAB36I21ViPj82yIc0aiDvLZ4JOOU2dCjQPGV1FqYT0cTZWOiqE/7W2Z9 8oDAntbyC4gRuGgbuGKd088voyyr0yaLgmdICsuZS9zXgckRY35OS8qjTr/8Mw6DSQN4 gCPdwcfK0wOBsGDCtKy0zcXqH6JskLxDaFIWRG2qUDPARWphvLsJx3c4t8pXVC8tpsBD eYssJoxbeSGx/gn3gS9cZ3QxWna5j7HHgV5p9hbPbdIoegmMNBW19amc6T1GUYVLsx6i dcOPrSCHFplpN2gdpMImzhK9RkeK0iY9VpB2mfyKGfAsMYtzbirAQr0MoG7v94tttgEi i6GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=p6arnneMpUAz4OILpzifu1P4tUCrP8Vk4FTrbxGUOVI=; fh=d2LH+etV1ck6pGZlZ+upkwGnByvX182MzvjDspLFtto=; b=rYDeDOT5i7gIJ7nzJ4W67cJJ3b6i1kuz2SlFLbysH3tJNPe5qi6oeF/LDDi6tWinfS 2QBRju8ZkDDV2XE224m1XkrgQgZ1kseCFVmKcvu7K5TIDigDRb8vYM3YNX3iswwlEI+Q hFtJxP4hOeaQTVaBrcq9Xvx3CGHRfUpGKCaX9PeevO0FJIDu+/PG/yX66J9/jV6oeezg sZyEQzK71At1JXZG0J45toDzcSsliGQtjGIEq+EhG8AoMXrEh37bhx87DtUxI4o9AKnC XgFlLsH5lqTnDLF1MeiWTiLInxamnzkRb0G1nr/M8rvDjz9lwfiTjb4zFDL69523GL1h Rxcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=cWkblA4h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id bg26-20020a056a02011a00b0057c3fb18aafsi20933421pgb.78.2023.09.30.04.25.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 04:25:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=cWkblA4h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 83E528374ACD; Fri, 29 Sep 2023 16:58:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232410AbjI2X5y (ORCPT + 99 others); Fri, 29 Sep 2023 19:57:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbjI2X5x (ORCPT ); Fri, 29 Sep 2023 19:57:53 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 328A6193 for ; Fri, 29 Sep 2023 16:57:50 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-536071e79deso2692554a12.1 for ; Fri, 29 Sep 2023 16:57:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1696031868; x=1696636668; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=p6arnneMpUAz4OILpzifu1P4tUCrP8Vk4FTrbxGUOVI=; b=cWkblA4hgsbrGfxjhWGgeDyWlrS/T0c6Yfn0uf8ITG2GVx9uryE2k4DMpUgVLEUfjb ZdF5iri8eDgK+OnNh1or4m6YZym769+B7Ro/IJ20hVJgTXodJZHMF59QYvtdKcLEQhL9 BClbsYbvDZkAyISUmuOLtP5NLVnygiY5vDpT4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696031868; x=1696636668; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=p6arnneMpUAz4OILpzifu1P4tUCrP8Vk4FTrbxGUOVI=; b=tEGTU2TD98viFdXAFAJNfrY75Ohz2oHNbuskJyj3H0C3PzpR2QI0rQn4vyUPV5b9pb F/SZuBUVzfXn3g2/U0OhW2t/zWehJLCaFYHv4pZhLlhG6JYYQma6mFkclxiUFMBag7p5 FYEtFOP5pnMBUEXePbPH1z3gQjI9wBuHoPmsQWBGbAvH2LdV3jjGFUf/pI5xaLq1aA3J CMR488XvQhmN8C3NTYkYEIRp4XMtQOC0Kcr7VDGDVkjUHZo/wgMdWuCSKYh11bbx5a64 dIEMadJY05Hhf6o2GX+prz3fEQGKWtuxGA1h4uBEwTeRXLfXunO9R0kbcTXmrzFQ4F8Z DRgg== X-Gm-Message-State: AOJu0Yw25uTuKMA0r1UJiBS8iyLeuDwZLzKkvaIgJZpc4eTITX63zJU7 BWHiQr5G0jQuxSRBfv86G6KcD93eDZ4g8eiOBB1zy/YCrG0= X-Received: by 2002:a05:6402:42c3:b0:522:405f:a7 with SMTP id i3-20020a05640242c300b00522405f00a7mr5134780edc.16.1696031868481; Fri, 29 Sep 2023 16:57:48 -0700 (PDT) Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com. [209.85.218.54]) by smtp.gmail.com with ESMTPSA id dm3-20020a05640222c300b0053635409213sm2653766edb.34.2023.09.29.16.57.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Sep 2023 16:57:47 -0700 (PDT) Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-9b275afb6abso268376166b.1 for ; Fri, 29 Sep 2023 16:57:47 -0700 (PDT) X-Received: by 2002:a17:907:6092:b0:9a5:c38d:6b75 with SMTP id ht18-20020a170907609200b009a5c38d6b75mr5518234ejc.15.1696031866848; Fri, 29 Sep 2023 16:57:46 -0700 (PDT) MIME-Version: 1.0 References: <20230928-kulleraugen-restaurant-dd14e2a9c0b0@brauner> <20230928-themen-dilettanten-16bf329ab370@brauner> <20230929-kerzen-fachjargon-ca17177e9eeb@brauner> <20230929-test-lauf-693fda7ae36b@brauner> In-Reply-To: From: Linus Torvalds Date: Fri, 29 Sep 2023 16:57:29 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] vfs: shave work on failed file open To: Mateusz Guzik Cc: Christian Brauner , Jann Horn , viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 29 Sep 2023 16:58:35 -0700 (PDT) On Fri, 29 Sept 2023 at 14:39, Mateusz Guzik wrote: > > So to be clear, obtaining the initial count would require a dedicated > accessor. Please, no. Sequence numbers here are fundamentally broken, since getting that initial sequence number would involve either (a) making it something outside of 'struct file' itself or (b) require the same re-validation of the file pointer that the non-sequence number code needed in the first place. We already have the right model in the only place that really matters (ie fd lookup). Using that same "validate file pointer after you got the ref to it" for the two or three other cases that didn't do it (and are simpler: the exec pointer in particular doesn't need the fdt re-validation at all). The fact that we had some fd lookup that didn't do the full thing that a *real* fd lookup did is just bad. Let's fix it, not introduce a sequence counter that only adds more complexity. Linus