Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp5210741rwb; Tue, 8 Aug 2023 23:50:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxTxrMcRrMo2y7rgN/182bArQyd1wqW0FtEudv4lw7cloOTJ8I1Biq7kDETKZI2Fljb1SI X-Received: by 2002:aa7:d816:0:b0:51d:88b2:872e with SMTP id v22-20020aa7d816000000b0051d88b2872emr1295223edq.42.1691563845155; Tue, 08 Aug 2023 23:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691563845; cv=none; d=google.com; s=arc-20160816; b=buzoEa7oyRew6OGsfutn7fA5zpjnUzsFWniF/28GWbDpZadkBUhU3slp5t+ps8ZeJC uQVitG7ZbluPXThGZWjM+HblUIWZUbLcY0rD983YzUcJk/bItwdC+wPYvRAHov9MryM8 FmcI27rFlfnaxGOCAW30B0+7rHPedfFusUB1LRsEwZHxzQ6hTCwnc7hjj/13Hmc3OfID gMwVvoUnq53xLVZM6wy/jS4ILqUku206gjChdUJ5zpg6ydSdEzLzNMABUjLK8S7T50OB 3zsN0EaojynZ3bvrHB8hrytdusazkJAZDPc8h7/NNDkyARys1A7xvoUKlwqYPfyQe97k Hp/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=aNuO8maW3k3biYUipfRcSFSTTKrtXD3lVQL4G6LBK5w=; fh=fGTYNAYs0Kd1Rh5llQC7yQHAm7sdPCoWvLjyqO+/8ns=; b=VLOk79cGM+QC5j2TxVcpSHBdmyrhszw0VUqztTeiENADXc7WrZ95ctgWepHPJCrgWe bRoTnhZrr2k1ijG316NXGjCUCmuJcOpl7AUBs8S8tLJoFzPX3qJ7APKMISK23a49gGAo qrX/7vYgDBX9wTERq0c818pfBR5XHsn+N4c3BLaCloYYgselZFxTLaZpgHiZYP9YWit7 Vi8WD9d7QGJQJ7JZbrz/DlpRYjZETWLFYoq4W3NE+n+vRLiHOld2A0hwLR8fEy3Fix+b AJ5WeYfUd9sMYf66N0qr3xGArb/6P93kv3Hp+gbCB6GcFR/6QrBmiAp8KC+BUkEG1Y5u VeiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HMNhAZoC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g18-20020a056402181200b0052322c44db3si2429978edy.678.2023.08.08.23.50.20; Tue, 08 Aug 2023 23:50:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HMNhAZoC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230306AbjHIEfH (ORCPT + 99 others); Wed, 9 Aug 2023 00:35:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230158AbjHIEfD (ORCPT ); Wed, 9 Aug 2023 00:35:03 -0400 Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 418151BF3; Tue, 8 Aug 2023 21:34:55 -0700 (PDT) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-1bb782974f4so4946612fac.3; Tue, 08 Aug 2023 21:34:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691555694; x=1692160494; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=aNuO8maW3k3biYUipfRcSFSTTKrtXD3lVQL4G6LBK5w=; b=HMNhAZoCzWrw2LiU0SnsgmGnnq7sUGxddlTDeiaWnkPApFKIO1YsxIGzTmlbQ1nhxU d/1CUW2Hk88KQp5/6dsDIEqn1WplnEkG7ZCQ8hkHdOFOjwZvo9wvt4oWupSY1ynhANFY HpW/pC4icZP7XTSTeUGIM53yvMMBLBW9EherLgpsT8QJQ89pqok75dXaHXE+mRLiwub4 pulu6FSvp7M0ndW0C2brOfYHRtFw+yk3UW6XX+Ce59ZgbxS9lIAAZurwJ8fEuTaIAU5k VCl0n7RAeP8fYe8dhdKzpS1a13EZ4zstAUzcKum1zvHaDWoJosDlFjUB0RUuEKAMw+Yv o99g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691555694; x=1692160494; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aNuO8maW3k3biYUipfRcSFSTTKrtXD3lVQL4G6LBK5w=; b=BgRLw+PlAspGOU0Ov1kwXeOz12dTkUcJAQraZQBK4umfU8ijxEPyGToAuvHgm0GOaj 5Mag+UhMTCFGKLI+vT7lsQVI4L1zXbmcyTNh2RKz4RXmr/bPlThS+y6AyMHjebTnzoYm Ao5mpYD+UMSaDcWpfcJ76vueWouh6EKt+r09Ovmc3RYzW/jYX4W9Anerz1iuLFcmDQXs RsatIhWIKRJ9ZnX5n0OdrxF3CG9GVVgaMOPTOcdvub/L3EyMjF0l9lmgMOeNldKX6a56 lIN5hTnsqrC5HN7AMp8Zx/PboVZPDvS1RuKGodGudxp749CVUrT7DRgBTHhJZ26CFbDd a4Iw== X-Gm-Message-State: AOJu0YzMTDpPYP1l+apjkSMGda7lD1utW3SOydCIumwR4gsiK0g/SQJF b5/so5taFGX6M/YMuk6oBtE= X-Received: by 2002:a05:6871:1c6:b0:1bb:8483:a807 with SMTP id q6-20020a05687101c600b001bb8483a807mr1893306oad.44.1691555694018; Tue, 08 Aug 2023 21:34:54 -0700 (PDT) Received: from [192.168.54.90] (static.220.238.itcsa.net. [190.15.220.238]) by smtp.gmail.com with ESMTPSA id n26-20020a9d741a000000b006b87f593877sm6552031otk.37.2023.08.08.21.34.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Aug 2023 21:34:53 -0700 (PDT) Message-ID: Date: Wed, 9 Aug 2023 01:33:29 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v1 5/5] rust: file: add `DeferredFdCloser` Content-Language: en-US To: Alice Ryhl , rust-for-linux@vger.kernel.org, linux-fsdevel@vger.kernel.org, Miguel Ojeda , Alexander Viro , Christian Brauner Cc: Wedson Almeida Filho , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , linux-kernel@vger.kernel.org, patches@lists.linux.dev References: <20230720152820.3566078-1-aliceryhl@google.com> <20230720152820.3566078-6-aliceryhl@google.com> From: Martin Rodriguez Reboredo In-Reply-To: <20230720152820.3566078-6-aliceryhl@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/20/23 12:28, Alice Ryhl wrote: > This adds a new type called `DeferredFdCloser` that can be used to close > files by their fd in a way that is safe even if the file is currently > held using `fdget`. > > This is done by grabbing an extra refcount to the file and dropping it > in a task work once we return to userspace. > > See comments on `binder_do_fd_close` and commit `80cd795630d65` for > motivation. Please provide links, at least for the doc comment. > > Signed-off-by: Alice Ryhl > --- > [...] > > +/// Helper used for closing file descriptors in a way that is safe even if the file is currently > +/// held using `fdget`. > +/// > +/// See comments on `binder_do_fd_close` and commit `80cd795630d65`. Ditto. > +pub struct DeferredFdCloser { > + inner: Box, > +} > + > [...]