From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (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 13F0F1A2C22 for ; Wed, 8 May 2024 16:19:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715185166; cv=none; b=pLEeNFCdraOUIECwqF0ynMUUm6gTQ1lh9SQYKJxXZA3gJ+rOEyrfM11SliIOjSKY51PHOaGK6TB5NHTtA9cmZIXZpLqFIkKxHY1T/KBwGxeCsC2ZumHCCiPVH+ji863a4O63TCx00pPY4aPdes1PhyiuwFRn4ciez1jGhdxjYB4= 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=GAffK5oY; arc=none smtp.client-ip=209.85.208.42 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="GAffK5oY" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-572baf393ddso1764297a12.1 for ; Wed, 08 May 2024 09:19:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1715185163; x=1715789963; 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=GAffK5oYWr5Q3pwT2GGdyTX/VZ1TzEofweFABNg1+buE/XuVy01Ekvff4lC6jpaX5E qtgdQZCDOmoIT5fEijq3C4aJoBI3TKrJK48S3s0OsiV6E27aGsH5K9QGclK9I3ZTbE8f vC93LQfgD1pcl/Yi34lRPb7ONYbBXkjUzqRPI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715185163; x=1715789963; 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=QYlEaEW9N/dFi0ac7dgOYc+tMIJLIA5NIwDRo//ZEUIMUXpSZEQSnozL9Zt+13r5lb 4f9h7ZezOBEtpkbGSDyoNTAJyjpw6AwCTfx9BFSrbgaHOAgvHkTDDOK2wAcaMUTYV7yA DmYZndEZ/v2I7Y4Jh/YrwTg/7FBFebZvMYFtaDUxfGxxW+QRfu2g+fDTGNMfByW1vI+H P24hUH9B7eRCQyjuWs6QmV65hB3yQ58m4BDoFeDacXcFVrMPTW957Mf9pWIVc310iZ4p hQlDW5xpw3nCQ/fosOKj4e3dZ9+LeLy2J9bv1TGfCEP3ZQpegpYoKdtP6RqMrDwBjftm IJSA== X-Forwarded-Encrypted: i=1; AJvYcCXbyPDb/e4sqdoe0CrZ/K+KhdZkdfn5VkLRiPfdQhYwc1ucgbkIvKmacFDfgAS9bjEyODJrHby0VqII3aNi188n4tbXV9Tf4Po= X-Gm-Message-State: AOJu0YxpQ8jTuLtZxvAom0RWIX7LkNDIXBwEhKXqyptRowaScdokDF5n bLN3Bi0zaP+gMe2S1NXOQZ18kkFSGMrWik9NJfsqtB8/518r6bu15QxTBsml1RgGT4j2q0crz9Z U5u5CyA== X-Google-Smtp-Source: AGHT+IFfSWaSrfTsXkkDrxRtp2zdQIaasYMmfXOxLcBEimP4IH/GOf7nxXoDxkb9+mhZKsV0fjoGRQ== X-Received: by 2002:a17:906:c8c3:b0:a59:a866:15a9 with SMTP id a640c23a62f3a-a5a118c4bcdmr6383966b.35.1715185163288; Wed, 08 May 2024 09:19:23 -0700 (PDT) Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com. [209.85.218.52]) by smtp.gmail.com with ESMTPSA id g17-20020a170906395100b00a59c3db0c50sm4539064eje.199.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-f52.google.com with SMTP id a640c23a62f3a-a59cdd185b9so190576866b.1 for ; Wed, 08 May 2024 09:19:21 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCX1LoaIhSOoD7/mjbrWoo+5AIRVM6EEGUIkO09amYoDagqIuBIOe/DmqFtaLP0NARMdJz0/Otfzd58Xd8t+MOpyknM0UqqY5RU= 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: io-uring@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 bnQgZmQsIHN0cnVjdCBmaWxlICpmaWxwKQoreworCXN0cnVjdCBmZCBmID0gZmRnZXRfcmF3KGZk KTsKKworCS8qCisJICogV2UgY2FuIGRvIHRoZSAnZmRwdXQoKScgaW1tZWRpYXRlbHksIGFzIHRo ZSBvbmx5IHRoaW5nI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