Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp4022462rdh; Fri, 29 Sep 2023 09:00:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGqi78HEppXriGIKtHJOBrIBLcK6HFd6f3Zp3pRuxjjdGZhtj+d2Xsskg7a+NYbh+uaSrj7 X-Received: by 2002:a17:902:d3cc:b0:1c6:2780:3adc with SMTP id w12-20020a170902d3cc00b001c627803adcmr4110639plb.24.1696003213973; Fri, 29 Sep 2023 09:00:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696003213; cv=none; d=google.com; s=arc-20160816; b=jehqXIwrrmU+g0tJPG3FhZmjQC3VRIGs3Bo9qeWuOvqCJVfHbem7YSVOm5Da4+iT1E Kq1UpOrjzu1RPPCk2l0oU0ft6y9inLx+xbYqa8iZDe+/MF4yUbLzCfDg7S73OZ0E2dIa 1dsxzzpAGbAVf3Tz4lemlwW3TgHPeKyOX8cHHd0UjxHNUqyddV9XJa15PmPCFlOYgoOg 3OG9aWa3419DOOnDLFoTs9flqE5ERYfvrTPpzYuP2ZVs2AYHJKeKXKnAgNItq7sMa5v2 ZUd4jna5OmrdY3+yrH4hMoUjrIToJZk10wOgy5jAyDsZ4+QNEMszDCrHwncEGOltgpMw Xe3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TmHeRReypOC1/PTNYdEeOv0TmfOCqlGndNJrCadbeNo=; fh=29bv11XLHA/pUtKdB1tTzrGNLhgOtXn5FEQfDsHOuOU=; b=NOKK9ayhG2wphnjlt/vds9AAoPt2EHArLXrlo4M9nx2MoZ1WK4yyMdrEndsBHk6iz+ YWVtoUyCSkhtNBgxabVOc9H7ndo2cqCJ0rTB2IdX/e8XtZCmFUqjxmQ+OUxxzxU5B1I8 sKj1Kmby8HA/Amd+azZbrKPbw4CWfidjijRwdf4EBsskgQyPf76NiMruaNxmRXE5HzPF Bha133GiI5ZT2v/oeqc/Eo9k2lRKpvS+wKqd+GhcCsHPgE7Jx7NrJcyk1/5+lBLbmSu4 nemcCARncxFR1TqsEvQ99k8lvj4nsukwutiOeTBBkiRcmTDtWJthTLmFFDVMhSaBv6Ka UERQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=q5zVxBi3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id j3-20020a170903028300b001c624237977si13712324plr.252.2023.09.29.09.00.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 09:00:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=q5zVxBi3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 0600B82922EC; Fri, 29 Sep 2023 05:59:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232997AbjI2M7h (ORCPT + 99 others); Fri, 29 Sep 2023 08:59:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232732AbjI2M7g (ORCPT ); Fri, 29 Sep 2023 08:59:36 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58BBAB7; Fri, 29 Sep 2023 05:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=TmHeRReypOC1/PTNYdEeOv0TmfOCqlGndNJrCadbeNo=; b=q5zVxBi33+Nmp9sMvNQxIi5Dum dThXVAqNoC3JwqJ59jU8OZ0hV/jd6QMLq2riYYbdMzzXvmiJIGDeejnFdIyPOqik2nndUT8FLSXJB /9PJEjlgqyxWOQ2vAaneH0kH00AXJ4tKkh5Z/uRANmE74ZU0ji1y7Flw3c8HQ/AQAEK6tjMKiEoIu Dbtl+jfgoG+YDzkPkRLhApIwz+OzLPW/zV4oAuSc8C8oX6VDcEAcXwi3ZDFH/POsa4Fbu1dNn3zJ4 PCHwhz+bxClpQ4CevUPXhH4MHw3nx1KXUB7hvVas5h+7Af0zSCAIZ7IvmLrdVOXeS31P1qA+l0M+F HNiCTCag==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qmD5e-008rPk-G8; Fri, 29 Sep 2023 12:59:30 +0000 Date: Fri, 29 Sep 2023 13:59:30 +0100 From: Matthew Wilcox To: Mateusz Guzik Cc: brauner@kernel.org, viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, torvalds@linux-foundation.org Subject: Re: [PATCH v3] vfs: avoid delegating to task_work when cleaning up failed open Message-ID: References: <20230928102516.186008-1-mjguzik@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230928102516.186008-1-mjguzik@gmail.com> 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Fri, 29 Sep 2023 05:59:56 -0700 (PDT) On Thu, Sep 28, 2023 at 12:25:16PM +0200, Mateusz Guzik wrote: > Below is my rebased patch + rewritten commit message with updated bench > results. I decided to stick to fput_badopen name because with your patch > it legitimately has to unref. Naming that "release_empty_file" or > whatever would be rather misleading imho. Do we still need fput_badopen()? Couldn't we just make this part of regular fput() at this point? ie: +++ b/fs/file_table.c @@ -435,6 +435,10 @@ void fput(struct file *file) if (atomic_long_dec_and_test(&file->f_count)) { struct task_struct *task = current; + if (!(file->f_mode & FMODE_OPENED)) { + file_free(file); + return; + } if (likely(!in_interrupt() && !(task->flags & PF_KTHREAD))) { init_task_work(&file->f_rcuhead, ____fput); if (!task_work_add(task, &file->f_rcuhead, TWA_RESUME))