Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3872176imm; Mon, 4 Jun 2018 10:36:56 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLB/xEYGtWQTR6+VNfsheotlQuz/z0vx+0Wa8eJWAwTMRqSrjUffMTso4YXvm6vE1mHQcpX X-Received: by 2002:a62:6f86:: with SMTP id k128-v6mr5575346pfc.150.1528133816747; Mon, 04 Jun 2018 10:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528133816; cv=none; d=google.com; s=arc-20160816; b=MtCCIQMJFjxz6Iq8wVreCK/Jbu34zGqdCZGmqERVocJDMPI2uk5APDpyw+pOW1stve 16aELIT67SK5aCmpG8p0g71UXPpCoF9r4FdWLBNUuwiMmmm8Cha3vrePt6F2NBgmSWRM q7Z5oVkoWHXRcDnPkQ6Fu9zp7D4G7dITs4Fp0sIuivPP6V5ETnRTjqxG4z0el4jScnUl rBveyWXOt0eup3Zc2CTeGfJWrduRMzeuOS1aMJJYcaAOLAerWhd5enxC+LRsJoUzwW/l Axytglt1khAeerkRWD4ttyLH5jag9Oi+6/Myoi/Q5Gvap9JpBdsfTxstso6qVd/CXRDH iKKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=gxZiM0S553sW4hgk2Ja5+KBd1eivbqaKRZgpZG1jsas=; b=DCIvvjZk6dtwpCtEmD8sqxNpmZBgBxsxSwqZ4SkbkjNB+NFkYZI8AD++qUwDxug/Q0 NlpmM2RKCzKV2dbPwl7yoCN8OlNSsC5quQXxkannfEDXNGRI6YlT4tFN+fNqFsxn6V1i vFo1wK6R5+P+2lkusrnfUD5e1xc14FoZFywmerdRD8NTUoMZLi2CD6vYpQFB0jedMCfg lYr5hYB9QvnwhAwwdtNEU0cLZMsIwoxkye9cDWuqBGs/+n32pQitQlwPRyaaqGfKGOcg 4iV8wGydAoUHvtrKiJpMxIux0lnfUdYxfAYkEEerFqwbR3yTCmBCiP07lKyL417Ho+A0 zLBw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3-v6si106067pli.18.2018.06.04.10.36.12; Mon, 04 Jun 2018 10:36:56 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751230AbeFDRfN (ORCPT + 99 others); Mon, 4 Jun 2018 13:35:13 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:38660 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750934AbeFDRfM (ORCPT ); Mon, 4 Jun 2018 13:35:12 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fPtNs-0004ux-Hy; Mon, 04 Jun 2018 17:35:08 +0000 Date: Mon, 4 Jun 2018 18:35:08 +0100 From: Al Viro To: Matthew Wilcox Cc: David Howells , Christoph Hellwig , linux-fsdevel@vger.kernel.org, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH][RFC] open_tree(2) (was Re: [PATCH 30/32] vfs: Allow cloning of a mount tree with open(O_PATH|O_CLONE_MOUNT) [ver #8]) Message-ID: <20180604173508.GJ30522@ZenIV.linux.org.uk> References: <152720672288.9073.9868393448836301272.stgit@warthog.procyon.org.uk> <152720691829.9073.10564431140980997005.stgit@warthog.procyon.org.uk> <20180601062654.GA32397@infradead.org> <7067.1527841663@warthog.procyon.org.uk> <20180602030913.GU30522@ZenIV.linux.org.uk> <20180602034255.GV30522@ZenIV.linux.org.uk> <21804.1527954321@warthog.procyon.org.uk> <20180602174957.GX30522@ZenIV.linux.org.uk> <20180603005532.GZ30522@ZenIV.linux.org.uk> <20180604171630.GA29059@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180604171630.GA29059@bombadil.infradead.org> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 04, 2018 at 10:16:30AM -0700, Matthew Wilcox wrote: > On Sun, Jun 03, 2018 at 01:55:37AM +0100, Al Viro wrote: > > +SYSCALL_DEFINE3(open_tree, int, dfd, const char *, filename, unsigned, flags) > > +{ > > + struct file *file; > > + struct path path; > > + int lookup_flags = LOOKUP_AUTOMOUNT | LOOKUP_FOLLOW; > > + bool detached = flags & OPEN_TREE_CLONE; > > + int error; > > + int fd; > > + > > + BUILD_BUG_ON(OPEN_TREE_CLOEXEC != O_CLOEXEC); > > Why do we need OPEN_TREE_CLOEXEC? Wouldn't we be better off just making > the fd returned by open_tree implicitly close-on-exec? I can think of > no good reason for these file descriptors to be inherited across exec() How are they different from any file descriptor? It's not as if it was something usable only for mounting stuff - again, you can use them with any ...at() syscalls. > and if someone comes up with such a reason, fcntl(F_SETFD) is not an > expensive call to make.