Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3830872ybf; Tue, 3 Mar 2020 13:44:54 -0800 (PST) X-Google-Smtp-Source: ADFU+vuavwBBWB9zyKE4zZabuWxjPtA1aDoOfe6OuLqREZVjpvh9Tupi9ShRZ96He1gx47dtm57f X-Received: by 2002:a9d:463:: with SMTP id 90mr3145147otc.283.1583271894588; Tue, 03 Mar 2020 13:44:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583271894; cv=none; d=google.com; s=arc-20160816; b=jfSo4vIzoau+9d6Ha0JGHElA6pnlRzrH7duzMrJ6XRGXMjVC1XLOMdTR06BrrDDVKz aEWCDmhh7VIXmynh0W0/c8Y9ReQRzPQQpYvijkjSaAluJiahJua4HVJWnsulvEqfrpXy dCj3LSM/38o2bJvU0Uo/cJee6BW4NEJhfzK4m7dXFzHgnFCLFGlXDKr9tdBwf3efeoUN P98rFpDyyUpgG59gXey1AGaU9voYKR/Giom9PINVxN0LLpg3m/6IXarAk41+r4D+lUet VCBVO8JbwAAL6P5aYgPjF/GKspM7K8fdKiv3Ef7Sdfw/cL5WlspiZXrwuRzl/Cjsb5UH cxeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=ydnuyxbHZreS12lqvc6zgwDMN8igBHqBdtlGtlGE/M0=; b=iyhZWUnjrdbCLIo3LKC0PDwY6IAeEfDEgYxy7cpww4gQCGZa8Xxhen9cuTrp2RuHsw 6fHTNnJ27HlLWszTbYtEoO5nTnj74n9AG63W2/Lk3Svf4JzYBZ2eBr27lmGBMvaicc3R HxG0i6F3tnjkkFq6L4K+4CNovFE0/EAn7FetLaiaPzFInDjh/LuT314Rj+SjeSJjAA1M mJhaSX+PWYp5+gOEgVmJJjp+Bhzvvs5q5C0Hr376uySPxVI5MUMlDT/gMEd/Ksi4U7dG TGN58SmD83Y58Q0d6AFzwdtswYhzlB9EDS0vH5NuDQByXoly2Q1XmjtEhjXTos9I4e/Y YBMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nsnxIjRO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a23si24424oie.81.2020.03.03.13.44.42; Tue, 03 Mar 2020 13:44:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nsnxIjRO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731053AbgCCTnr (ORCPT + 99 others); Tue, 3 Mar 2020 14:43:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:56852 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728180AbgCCTnr (ORCPT ); Tue, 3 Mar 2020 14:43:47 -0500 Received: from tleilax.poochiereds.net (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4610C20870; Tue, 3 Mar 2020 19:43:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583264626; bh=DCL8ykDk5TOwzA/Lva4sncSGdbnsdat+IzdI+ZVWZEM=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=nsnxIjROrEOodcoUUfkk/9UAGrJoxMgXXvExx4ZJ1oy3uKRSiHXRuNctJDwDeDirA 7ZET8GMx3MYvCWFDkyjivIzeX3cJBF06lF6UjdaVvg/2ggQmcZ9XdalkwXSBYUv4av dCAXLU/OlF9SpunpiAM6TNnLQnQyInzDnUUfblgA= Message-ID: Subject: Re: [PATCH 00/17] VFS: Filesystem information and notifications [ver #17] From: Jeff Layton To: Jens Axboe , Greg Kroah-Hartman , Jann Horn Cc: Miklos Szeredi , Karel Zak , David Howells , Ian Kent , Christian Brauner , James Bottomley , Steven Whitehouse , Miklos Szeredi , viro , Christian Brauner , "Darrick J. Wong" , Linux API , linux-fsdevel , lkml Date: Tue, 03 Mar 2020 14:43:44 -0500 In-Reply-To: References: <1509948.1583226773@warthog.procyon.org.uk> <20200303113814.rsqhljkch6tgorpu@ws.net.home> <20200303130347.GA2302029@kroah.com> <20200303131434.GA2373427@kroah.com> <20200303134316.GA2509660@kroah.com> <20200303141030.GA2811@kroah.com> <20200303142407.GA47158@kroah.com> <030888a2-db3e-919d-d8ef-79dcc10779f9@kernel.dk> <7a05adc8-1ca9-c900-7b24-305f1b3a9b86@kernel.dk> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2020-03-03 at 12:23 -0700, Jens Axboe wrote: > On 3/3/20 12:02 PM, Jeff Layton wrote: > > Basically, all you'd need to do is keep a pointer to struct file in the > > internal state for the chain. Then, allow userland to specify some magic > > fd value for subsequent chained operations that says to use that instead > > of consulting the fdtable. Maybe use -4096 (-MAX_ERRNO - 1)? > > BTW, I think we need two magics here. One that says "result from > previous is fd for next", and one that says "fd from previous is fd for > next". The former allows inheritance from open -> read, the latter from > read -> write. > Do we? I suspect that in almost all of the cases, all we'd care about is the last open. Also if you have unrelated operations in there you still have to chain the fd through somehow to the next op which is a bit hard to do with that scheme. I'd just have a single magic carveout that means "use the result of last open call done in this chain". If you do a second open (or pipe, or...), then that would put the old struct file pointer and drop a new one in there. If we really do want to enable multiple opens in a single chain though, then we might want to rethink this and consider some sort of slot table for storing open fds. -- Jeff Layton