Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1431502ybz; Wed, 22 Apr 2020 21:31:19 -0700 (PDT) X-Google-Smtp-Source: APiQypKHcC3JUjQsaBSKlmUUGI5zrBG04jbccxmLyvF8fKqDm0pLulVqUNS/AI4gAh5kB1z/XtcN X-Received: by 2002:a05:6402:1684:: with SMTP id a4mr1220379edv.99.1587616279332; Wed, 22 Apr 2020 21:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587616279; cv=none; d=google.com; s=arc-20160816; b=IvuJRf8T/hRoFynYdVh+Iq1ILbWY8BP9PNL2niaRooGdzcFNaFdmceCHPvoJQ2EfXU Xqel8N0Jb3a8/EYMIb+uDpJdF0aUmfRepFqIev4zx4lc6Gg3Tu5pcZbY0l/YuQT6wojb fZQ5nTJogpOBXQ8TDsY2rI97sQVp5WMxYhcRxNRfBKUBOEkA0RzAiBNqqNuK75b/HjA6 mKJe7L8XnhX8atLbyJSVZUPgtGtgW+YYncdWFgtmh/3NHkgiIRJPyuw3L+weB/xD2yBO L2+MoJssaPYyH+pFsuBmH0t5PhV7hpuC4Rtz73bKwQcYb5wrj+e+7ka7bD/wP20I8wlh iljw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=W1DMwknr8Mv5esWhXjaUd0WNvn+/fUVQmBus68SdeKI=; b=chu6oKS9oue2RL2erVz628laFWlBjBggQEZLosvQwPD9q8auhb+MhC8jdjavRxkUUW 3DRJJUJfh+AKpNIbs2NXoMxMf0io02EYtmBCEtbUA/rqyqScEIwjj4P014AxfPbWvL3E 6QohIheWITWJ/eIUAuhnvyzPwDvlOWLjAj0sjTCOb/VV/W0VuDrfbQxg/g6SxAzazIs5 /XGCFJcQlGX08OrDzDhiLAcAs9Fyzz/yk9nDVfPj5s6hgwQ6FmL2ArYInPqG0Tsfu6KZ 3zIAp8DGP+4ql1qepTvh5/HYGp/hgdJCYKNZOXHrf4jAX8Rn5VZW9PjfJWQsbmd5njp5 5fKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=Ttz2w7rb; 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 l9si539714edf.315.2020.04.22.21.30.44; Wed, 22 Apr 2020 21:31:19 -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; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=Ttz2w7rb; 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 S1726027AbgDWEYc (ORCPT + 99 others); Thu, 23 Apr 2020 00:24:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725562AbgDWEYc (ORCPT ); Thu, 23 Apr 2020 00:24:32 -0400 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F641C03C1AB for ; Wed, 22 Apr 2020 21:24:31 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id j20so3330307edj.0 for ; Wed, 22 Apr 2020 21:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=W1DMwknr8Mv5esWhXjaUd0WNvn+/fUVQmBus68SdeKI=; b=Ttz2w7rbGa7bL4xh9pO5D01ts9bopo8zmXqwhb6SJpuJqdNz8GT63pO+DS3o5rFExI 91FDNSYgk46tTG7Z7myPIWIqQOs9vaczQphPBJwn1EJSP3KphnVypF5PWJUyTfiS1+ju I3mogJgoyAiEEbYmdzuht+uXeeqbjhAf9VKrM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=W1DMwknr8Mv5esWhXjaUd0WNvn+/fUVQmBus68SdeKI=; b=gWgTSBhrryypkf0XfjNQjd58nbdSzoOPlDW7rwyN9wdY2eqg2XYZV8rjiHsHcwQLfJ UL156K3yg+69wIdYzk7NMlhzOfnbVZKvD3+bj8GLDW3swob9Wciz/rM2WX9P2sykohTu smVkoFekoBqoUMjvkKSk9XfdI++OaqVTvr9QzqZb4kPepdGFPcNct7/6xmT5b2NNasj1 LDUepv2x7wAR/lU+zAHThuHo83r86c75CZECwsXaKIBUY6R3PTq88I91lz83u2gimu80 Js7WrBD3O9/wVKCEpSwxKrgVu2ANAr6hxntcuIOdHH/SPQpOJU52EzhFZ6tyu6d88tcW 6MQQ== X-Gm-Message-State: AGi0PubUgmTEbkE/ecgfcoS/mV+MJjUKzTsBbuBBAqgFXD1Lt92aFEb8 9xAeaNwg9V1Vviq2BNp9a4Iw48nHbkRkbK5PUWpveA== X-Received: by 2002:a05:6402:22ed:: with SMTP id dn13mr1254167edb.212.1587615865963; Wed, 22 Apr 2020 21:24:25 -0700 (PDT) MIME-Version: 1.0 References: <9873b8bd7d14ff8cd2a5782b434b39f076679eeb.1587531463.git.josh@joshtriplett.org> <20200423004807.GC161058@localhost> In-Reply-To: <20200423004807.GC161058@localhost> From: Miklos Szeredi Date: Thu, 23 Apr 2020 06:24:14 +0200 Message-ID: Subject: Re: [PATCH v5 2/3] fs: openat2: Extend open_how to allow userspace-selected fds To: Josh Triplett 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 23, 2020 at 2:48 AM Josh Triplett wrote: > > 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.) What's the use case of O_SPECIFIC_FD beyond io_uring? > > > 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. What's the use case of allocating a file descriptor within io_uring and using it outside of io_uring? Thanks, Miklos