Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp614946lqo; Wed, 8 May 2024 09:27:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVIxCWMh+t6my57Zs1IvUi2Xm0np54QJeYq4iDtWJR9wWgCJMcH2gGQSOynP6QzWsrT1Wn+wTM2CIsP8OdFhFDlOvSEYXwQXo1yzDdSOg== X-Google-Smtp-Source: AGHT+IGR+loWZuoP+SIR9mOMar79mnFLwAYKoHfhqZiBryTz4/MKMhZ2JLZSbWgf4ucJTQgN2fef X-Received: by 2002:a17:90a:a78d:b0:2b4:39cd:1fb8 with SMTP id 98e67ed59e1d1-2b6165c5057mr3167516a91.23.1715185642275; Wed, 08 May 2024 09:27:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715185642; cv=pass; d=google.com; s=arc-20160816; b=HNTlX4Sjkhcn4ai+iodN0Pzi80NVjkac+IFnClI/bRx40vQ0KRBmtQT1b/t57oxUcL 6T09k9zxMFoZ+cskUYhbvLyhPGRPlbkO5DovJs0MM0AP45yOUYfaRwytAQezOnxn3ke8 65CLl+fRwPbKXkHi2GS23bqQGyw0KRa69BNTKEW2PRo6Zy9wJZpG5G5W7WQg13+J1kai yiHp05MBD8bq1ZF+bQJcHKLspQlPQHXr1+2coaIE6D8W5wif8mKMLdDnAIAjDrNZua2V uEAqGeScrz6wJ7WEEsGOIsErDWzOke9evvwmnAPKX49jPiGyLdIoQt/9RgMTUWTrP5X5 qP2A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=GRnWniI6weHLAZe+jcS6e3kntzKq8xydvJSod9mqGMY=; fh=3cvsuveKFWJIPdIRbGmKZCyIcVP1DJZJbIh1lGUcGHY=; b=H7tUqnNWLZ5UEIKY1wCpIbY/2e5mLXWqDqmzEuWh+1PapsqTw6WdpUYB/zJzKpVFqZ xaprEqJUIFaPXxik7zWrCI7ttaj0li5QDJHg8W5i/Zv4c6jZ+f7QQG8p9Do0iWxNiEZE 7wMhAXZXxYYXoFMkmwC7Vf9qER5UvZAAVQXpLiONwbT3j+8EAlg3C2AJEZCTJ/OZLxYE Iv8mHaG4AaDRJPLrafoJpmEhPjbg0nftrzZJtsXj16kwQlXpAJVb3nSeNVWo+cVdceyM OVC0HK7FSZJMj1v6B6dQRURuLUz43w3BxErb5to/Ysp8AMVjDQMHi7Bm+o+zGBRflvHf kQLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=S8lpRhWx; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-173529-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173529-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b628868d31si1671077a91.3.2024.05.08.09.27.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 09:27:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173529-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=S8lpRhWx; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-173529-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173529-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BEC88B2160A for ; Wed, 8 May 2024 16:19:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 077FB128396; Wed, 8 May 2024 16:19:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="S8lpRhWx" Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15CC9127E28 for ; Wed, 8 May 2024 16:19:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715185166; cv=none; b=j87Lq7+f1RrHdZDEgzudtvzElZpviarUAspImot3kYxkvrI9T3G46A7FToIbEBksBiSWxbYOoga0Ck8KvIajySTwSqzCBclKjPZXSkxXqQRsvpO52kzgcLISQXaLe+gczJpEpuyyR0fU8E+jYulGr1DlynM7YuVZjg1I3mr30v4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715185166; c=relaxed/simple; bh=EBgZslqy6XCFdm2svCR8wdSgwC1c5tdTUgjKXU1N4nc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Rx/68Rj57/GPF6WN9ScAt5sVGBUpgZpMcOvVqHEp+F/5uW4MnOCOfyJC3e8UZJCapIoq/WgE/cfg6gC0HX+SuXcA6DtK5u1AF15NJ5ILszgn3gx7psO4EWyYtqDfctm8/RNGfVAx1NKA06nId4Owbob4AHkTmBgkkwzS7AoTzcU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=S8lpRhWx; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a59a352bbd9so196375766b.1 for ; Wed, 08 May 2024 09:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1715185162; x=1715789962; 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=GRnWniI6weHLAZe+jcS6e3kntzKq8xydvJSod9mqGMY=; b=S8lpRhWxSbC2lPt9deECHsu3p+I3K+45f3bb40YBkCrupQMsboscLRFdzvWqhaHFtU FnzVbbOhcNlu/NKCeN8G/s41Lcn+mz+QGXBI5GCSmqa6ym2cHX1Toxyg0T807+UCFv8d +LVVNQHGHtzloL6RSRQ0u074eghzOJEm6L7YA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715185162; x=1715789962; 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=GRnWniI6weHLAZe+jcS6e3kntzKq8xydvJSod9mqGMY=; b=ao1BmUEy0E2bz1nLKk26fX6mthbYs8ILkRG3RFAeq66+wMRFaRgbAKWkAQYA9921bA laKu5LLI7Nl69h9PBGOhO6oiMwQAxhzX0xqkXZ1IUJqXOrMRf83uzRzatuce+zepSY6K DWaba6KN8LYT4uydyg2QM2o1P8mlbsfoeUT3i8mfWiFshAwSy+Vvs/SrtMPKVloHPk/G yLbsAJZEB+QOHKcHN/Dkgz1SZnNnR6MMsIUB+s5Vmb4YrmF3hHxnl52tzfwPkTjy0lHZ JTPJPibitiJjYl1DuX6EpUSp3bBZeYgHgDrrIp5xmPnOSE0LGTrklx8b0n7gmG3v/Agd WvhQ== X-Forwarded-Encrypted: i=1; AJvYcCVsUE1IZho/y+Yi1ic/92x3qt29EGSMNZpK7cyAZVe6NK8Nt91ZxI5mutzt/hgJFhWp0NNO4LGoXzdxAdmMifrFpAb5X3AjrKE8SHXt X-Gm-Message-State: AOJu0Yw/rjfBPPTZOx0OWnGoAbBpoNAt/yynRsKFyahwTAt88dhaUvsY G79+Myt+l4WbWDIBLV40DoUQJJfwAfSxQ4YKhmpSYQNKWRRi7AQFbB7XxDtvizEub5sMxKzmuCC rTlM3kA== X-Received: by 2002:a17:906:7c4f:b0:a59:c3a7:59d3 with SMTP id a640c23a62f3a-a5a1165d1d6mr11201266b.13.1715185162313; Wed, 08 May 2024 09:19:22 -0700 (PDT) Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com. [209.85.218.50]) by smtp.gmail.com with ESMTPSA id wt4-20020a170906ee8400b00a59e061ffdcsm2873767ejb.41.2024.05.08.09.19.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 May 2024 09:19:21 -0700 (PDT) Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a59cdd185b9so190576566b.1 for ; Wed, 08 May 2024 09:19:21 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUgNgPtx5qO2y51eUo3RMhutP6q9TrDmdNsRy/CsSbER5f2DT6n8BP2VuVNbs8fy5tWsIEBoYx9yrUkbbP3KR22aiyHDhVwKTBtWC2S X-Received: by 2002:a17:906:1c10:b0:a59:9c2f:c7d4 with SMTP id a640c23a62f3a-a5a1167be68mr9921366b.19.1715185161053; Wed, 08 May 2024 09:19:21 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <202405031110.6F47982593@keescook> <20240503211129.679762-2-torvalds@linux-foundation.org> <20240503212428.GY2118490@ZenIV> <20240504-wohngebiet-restwert-6c3c94fddbdd@brauner> In-Reply-To: From: Linus Torvalds Date: Wed, 8 May 2024 09:19:03 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [Linaro-mm-sig] Re: [PATCH] epoll: try to be a _bit_ better about file lifetimes To: Daniel Vetter Cc: Simon Ser , Pekka Paalanen , =?UTF-8?Q?Christian_K=C3=B6nig?= , Christian Brauner , Al Viro , keescook@chromium.org, axboe@kernel.dk, christian.koenig@amd.com, dri-devel@lists.freedesktop.org, io-uring@vger.kernel.org, jack@suse.cz, laura@labbott.name, linaro-mm-sig@lists.linaro.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, minhquangbui99@gmail.com, sumit.semwal@linaro.org, syzbot+045b454ab35fd82a35fb@syzkaller.appspotmail.com, syzkaller-bugs@googlegroups.com Content-Type: multipart/mixed; boundary="0000000000003fddda0617f3aa7b" --0000000000003fddda0617f3aa7b Content-Type: text/plain; charset="UTF-8" On Tue, 7 May 2024 at 12:07, Linus Torvalds wrote: > > That example thing shows that we shouldn't make it a FISAME ioctl - we > should make it a fcntl() instead, and it would just be a companion to > F_DUPFD. > > Doesn't that strike everybody as a *much* cleaner interface? I think > F_ISDUP would work very naturally indeed with F_DUPFD. So since we already have two versions of F_DUPFD (the other being F_DUPFD_CLOEXEC) I decided that the best thing to do is to just extend on that existing naming pattern, and called it F_DUPFD_QUERY instead. I'm not married to the name, so if somebody hates it, feel free to argue otherwise. But with that, the suggested patch would end up looking something like the attached (I also re-ordered the existing "F_LINUX_SPECIFIC_BASE" users, since one of them was out of numerical order). This really feels like a very natural thing, and yes, the 'same_fd()' function in systemd that Christian also pointed at could use this very naturally. Also note that I obviously haven't tested this. Because obviously this is trivially correct and cannot possibly have any bugs. Right? RIGHT? And yes, I did check - despite the odd jump in numbers, we've never had anything between F_NOTIFY (+2) and F_CANCELLK (+5). We added F_SETLEASE (+0) , F_GETLEASE (+1) and F_NOTIFY (+2) in 2.4.0-test9 (roughly October 2000, I didn't dig deeper). And then back in 2007 we suddenly jumped to F_CANCELLK (+5) in commit 9b9d2ab4154a ("locks: add lock cancel command"). I don't know why 3/4 were shunned. After that we had 22d2b35b200f ("F_DUPFD_CLOEXEC implementation") add F_DUPFD_CLOEXEC (+6). I'd have loved to put F_DUPFD_QUERY next to it, but +5 and +7 are both used. Linus --0000000000003fddda0617f3aa7b Content-Type: text/x-patch; charset="US-ASCII"; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lvy090o10 IGZzL2ZjbnRsLmMgICAgICAgICAgICAgICAgIHwgMjMgKysrKysrKysrKysrKysrKysrKysrKysK IGluY2x1ZGUvdWFwaS9saW51eC9mY250bC5oIHwgMTQgKysrKysrKystLS0tLS0KIDIgZmlsZXMg Y2hhbmdlZCwgMzEgaW5zZXJ0aW9ucygrKSwgNiBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9m cy9mY250bC5jIGIvZnMvZmNudGwuYwppbmRleCA1NGNjODVkMzMzOGUuLjFkZGI2M2Y3MDQ0NSAx MDA2NDQKLS0tIGEvZnMvZmNudGwuYworKysgYi9mcy9mY250bC5jCkBAIC0zMjcsNiArMzI3LDI1 IEBAIHN0YXRpYyBsb25nIGZjbnRsX3NldF9yd19oaW50KHN0cnVjdCBmaWxlICpmaWxlLCB1bnNp Z25lZCBpbnQgY21kLAogCXJldHVybiAwOwogfQogCisvKgorICogSXMgdGhlIGZpbGUgZGVzY3Jp cHRvciBhIGR1cCBvZiB0aGUgZmlsZT8KKyAqLworc3RhdGljIGxvbmcgZl9kdXBmZF9xdWVyeShp bnQgZm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