Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1292512ybz; Wed, 22 Apr 2020 17:49:38 -0700 (PDT) X-Google-Smtp-Source: APiQypIEhWImQKVubmb0pRSABx8Qzt8VfvhZVlDUkolz1n1vu8HZdMELqHIrf2amTvDAnBsn1rrC X-Received: by 2002:a17:906:a3ca:: with SMTP id ca10mr738474ejb.298.1587602978063; Wed, 22 Apr 2020 17:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587602978; cv=none; d=google.com; s=arc-20160816; b=dUkZtxcI5vqbJXm3PgXnFHCRNyPN1DLZiQX3aABeT+YTvVsulBq09Vg8iZCPyaZKJW GqqFNA/JLkwgPJH2nnuLm5zlI7sYDnkww5h4GrvEeh3GYO7UyrvQrncf8yWRPgOKQzsm JOy1vKmrSO17afxPkZekZDmjB+n5cBbPHnjzkEFYt77nJ7sNPsW1Y5YWxy1YzLIrcu1F ffg524+xkRL2Y8Mang+k6iFtNwd3drQpTRYEOMN5KzY2Z4rm7+ZPBbx40Ujp/NhIMNnz CCFXGL9r65al/C8gUTmQz1Dyat4RrdZuN3i+8gApFJn7Yn/n7aLFZ0M35qwBsOEYzCWL cE7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=D0za56CcPRjdlGzfvUIYsBqJwSJ8O/nFePNdJFvUQtY=; b=knigPtd2r/HkuHA93PnBYN9048ASDzdA7cjGZsHQG0pDSRi6tqcjbOHrG7kCuoOKE6 /SBJz4dM7MBfU3T7MRSsAQg7/gom7+ZptTiSlGlqggSww1yMToLhB0QjZPC1dT4OQ6Da M3IKpz/g3S0M6SMz/JjwP9DNzh758C//dUjO0S5CxOuTqd4MXe6lLcRbC3n/3TNZxGkP cUke2io59frKliXnr57cxPItF2bIQE+vDLGSCuYs1P7cFPQo1+1pJ/mkpNfIEFbSUB8R VQz8f8ylTECHwOjR1ALzNPn2jxacybKThzO1FsAFrvCI5O9qzPyHuRojniKZDdqJBMEn cyaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hk16si416906ejb.263.2020.04.22.17.49.15; Wed, 22 Apr 2020 17:49:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726201AbgDWAsR (ORCPT + 99 others); Wed, 22 Apr 2020 20:48:17 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:2817 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725846AbgDWAsR (ORCPT ); Wed, 22 Apr 2020 20:48:17 -0400 X-Originating-IP: 50.39.163.217 Received: from localhost (50-39-163-217.bvtn.or.frontiernet.net [50.39.163.217]) (Authenticated sender: josh@joshtriplett.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 9A5F1240008; Thu, 23 Apr 2020 00:48:10 +0000 (UTC) Date: Wed, 22 Apr 2020 17:48:07 -0700 From: Josh Triplett To: Miklos Szeredi Cc: Michael Kerrisk , io-uring@vger.kernel.org, "linux-fsdevel@vger.kernel.org" , lkml , Alexander Viro , Arnd Bergmann , Jens Axboe , Aleksa Sarai , linux-man , Linux API Subject: Re: [PATCH v5 2/3] fs: openat2: Extend open_how to allow userspace-selected fds Message-ID: <20200423004807.GC161058@localhost> References: <9873b8bd7d14ff8cd2a5782b434b39f076679eeb.1587531463.git.josh@joshtriplett.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 22, 2020 at 09:55:56AM +0200, Miklos Szeredi wrote: > On Wed, Apr 22, 2020 at 8:06 AM Michael Kerrisk (man-pages) > wrote: > > > > [CC += linux-api] > > > > On Wed, 22 Apr 2020 at 07:20, Josh Triplett wrote: > > > > > > Inspired by the X protocol's handling of XIDs, allow userspace to select > > > the file descriptor opened by openat2, so that it can use the resulting > > > file descriptor in subsequent system calls without waiting for the > > > response to openat2. > > > > > > In io_uring, this allows sequences like openat2/read/close without > > > waiting for the openat2 to complete. Multiple such sequences can > > > overlap, as long as each uses a distinct file descriptor. > > If this is primarily an io_uring feature, then why burden the normal > openat2 API with this? This feature was inspired by io_uring; it isn't exclusively of value with io_uring. (And io_uring doesn't normally change the semantics of syscalls.) > This would also allow Implementing a private fd table for io_uring. > I.e. add a flag interpreted by file ops (IORING_PRIVATE_FD), including > openat2 and freely use the private fd space without having to worry > about interactions with other parts of the system. I definitely don't want to add a special kind of file descriptor that doesn't work in normal syscalls taking file descriptors. A file descriptor allocated via O_SPECIFIC_FD is an entirely normal file descriptor, and works anywhere a file descriptor normally works.