Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3857581imm; Mon, 4 Jun 2018 10:22:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL0SEzXoKO5Ypn+KrWzciyVXNNhnThOkEUHrBP7wRnQ99fC9jE61d2SDZsr/6ChXFYM+xHX X-Received: by 2002:a63:7459:: with SMTP id e25-v6mr2114896pgn.186.1528132945827; Mon, 04 Jun 2018 10:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528132945; cv=none; d=google.com; s=arc-20160816; b=Kpb0+SNrVaGjCJAodbKHEHrj0vnX6jFW2SBv6JYjUgWOqI5tNDLxUR/Py+0lusNQuP 2Vwje5RHq6AoSlmxbJwFvba+Gvw8uLbDA4+IrgamCIMOv7GyB9FM7j5zVOHXO3ZPKuBh OzvrkwxDV15d9Bfs/phkmjSqh5T+0gzz5liAplP52dVYQnQSJnT8sOg9BaiN+5zhwH1A sHS+hZ9SGBV+Y/x+JB2PenGdAd7hKYXkHoYTbSyyDkZiWpq5CYBrqpU2eHnfI2lL7rAi fScpM2im+y099VeVlMgmUa7RVidtaWkAo4X1VX5LUJR7WAOK/NbJCkKG3Pqi93OKSQOi hylg== 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:dkim-signature:arc-authentication-results; bh=czSRYPFbagnY2QQFqbNlN8ts8BFGOyjvTl+RGf1i8rQ=; b=D10QxGp4we4Gfc+ZAZ/f3R4wNdXKpmKy1iI+cc7+HuD0TA3M/UTys5A0IGpMEhOr10 LSde3sRsTNNRk+UUVaTcLYDhR/oHTsp+Bwb/9iHbk5AQXWYyFiSDr+fclgvJ+ZZcvVPg XJzVM8WQQXeURIHNEZL2L9FQGAg3QW8VO7nY2UpvqYDuV5fWYx0u/zabYq6vmCvugzjn yC9X0nv24ou5Yuv9Gc3gy/4MglEe7KUok+o3E/xcEi2DXzfxXv7DYRH983wcPEOp45UQ dC3J8jAadHrfKL/ObMVH37h2Wudg1qi3k4TtV9l00qotd/nlLmDM1DVaCaY1YlsHjoWO +vYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=k1oGf52H; 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 j84-v6si13302083pfj.79.2018.06.04.10.21.41; Mon, 04 Jun 2018 10:22:25 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=k1oGf52H; 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 S1751377AbeFDRQf (ORCPT + 99 others); Mon, 4 Jun 2018 13:16:35 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:43140 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750950AbeFDRQd (ORCPT ); Mon, 4 Jun 2018 13:16:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=czSRYPFbagnY2QQFqbNlN8ts8BFGOyjvTl+RGf1i8rQ=; b=k1oGf52Hulkxw4MjRkial2gJY 9QzKnc264DKqpw98ZI+fYdPdOScHMb+pyxNf/hpzffZL4Fs1Uk3W1fk2zBjHqwzrGvqNWN1+AQGtG TeOru0Wh21W1zWTenBP5GxPrKCg43ohvqX2oRr9FWhMNPf1Y5/4HQQNxmM3jYoHUM7ulrEuzIZvf9 ENfp904jZOPxZR0ItfAv82SSO65F+UdlIw7lz0y5sMWSgpzHKZDxxiZk70eGkjtIfkRG38cyp1UPY lwjyoL1ebVR+7nbhIMDvi2VNWtRlcZc5p66SQg8aCzdbODX6gBWjDmUmLH00kIVRUhXJhDadJjLyh AX/IL/slQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fPt5q-0003Ic-L0; Mon, 04 Jun 2018 17:16:30 +0000 Date: Mon, 4 Jun 2018 10:16:30 -0700 From: Matthew Wilcox To: Al Viro 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: <20180604171630.GA29059@bombadil.infradead.org> References: <20180601063928.GS30522@ZenIV.linux.org.uk> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180603005532.GZ30522@ZenIV.linux.org.uk> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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() and if someone comes up with such a reason, fcntl(F_SETFD) is not an expensive call to make.